Used verbosity constants instead of numbers
parent
a5d7695fac
commit
db1948e058
|
|
@ -119,7 +119,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
|
||||||
double errorThreshold, double currentError, double newError,
|
double errorThreshold, double currentError, double newError,
|
||||||
NonlinearOptimizerParams::Verbosity verbosity) {
|
NonlinearOptimizerParams::Verbosity verbosity) {
|
||||||
|
|
||||||
if ( verbosity >= 2 ) {
|
if ( verbosity >= NonlinearOptimizerParams::ERROR ) {
|
||||||
if ( newError <= errorThreshold )
|
if ( newError <= errorThreshold )
|
||||||
cout << "errorThreshold: " << newError << " < " << errorThreshold << endl;
|
cout << "errorThreshold: " << newError << " < " << errorThreshold << endl;
|
||||||
else
|
else
|
||||||
|
|
@ -130,7 +130,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
|
||||||
|
|
||||||
// check if diverges
|
// check if diverges
|
||||||
double absoluteDecrease = currentError - newError;
|
double absoluteDecrease = currentError - newError;
|
||||||
if (verbosity >= 2) {
|
if (verbosity >= NonlinearOptimizerParams::ERROR) {
|
||||||
if (absoluteDecrease <= absoluteErrorTreshold)
|
if (absoluteDecrease <= absoluteErrorTreshold)
|
||||||
cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " < " << absoluteErrorTreshold << endl;
|
cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " < " << absoluteErrorTreshold << endl;
|
||||||
else
|
else
|
||||||
|
|
@ -139,7 +139,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
|
||||||
|
|
||||||
// calculate relative error decrease and update currentError
|
// calculate relative error decrease and update currentError
|
||||||
double relativeDecrease = absoluteDecrease / currentError;
|
double relativeDecrease = absoluteDecrease / currentError;
|
||||||
if (verbosity >= 2) {
|
if (verbosity >= NonlinearOptimizerParams::ERROR) {
|
||||||
if (relativeDecrease <= relativeErrorTreshold)
|
if (relativeDecrease <= relativeErrorTreshold)
|
||||||
cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " < " << relativeErrorTreshold << endl;
|
cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " < " << relativeErrorTreshold << endl;
|
||||||
else
|
else
|
||||||
|
|
@ -147,7 +147,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold
|
||||||
}
|
}
|
||||||
bool converged = (relativeErrorTreshold && (relativeDecrease <= relativeErrorTreshold))
|
bool converged = (relativeErrorTreshold && (relativeDecrease <= relativeErrorTreshold))
|
||||||
|| (absoluteDecrease <= absoluteErrorTreshold);
|
|| (absoluteDecrease <= absoluteErrorTreshold);
|
||||||
if (verbosity >= 1 && converged) {
|
if (verbosity >= NonlinearOptimizerParams::ERROR && converged) {
|
||||||
if(absoluteDecrease >= 0.0)
|
if(absoluteDecrease >= 0.0)
|
||||||
cout << "converged" << endl;
|
cout << "converged" << endl;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue