From daae77771b5230d638f516c3870a8f6ad45fa8fd Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Sat, 24 Mar 2012 19:53:32 +0000 Subject: [PATCH] Changed nonlinear convergence to <= (from <) --- gtsam/nonlinear/NonlinearOptimizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/nonlinear/NonlinearOptimizer.cpp b/gtsam/nonlinear/NonlinearOptimizer.cpp index 42e33d4a8..785ee8195 100644 --- a/gtsam/nonlinear/NonlinearOptimizer.cpp +++ b/gtsam/nonlinear/NonlinearOptimizer.cpp @@ -90,7 +90,7 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold // check if diverges double absoluteDecrease = currentError - newError; if (verbosity >= 2) { - if (absoluteDecrease < absoluteErrorTreshold) + if (absoluteDecrease <= absoluteErrorTreshold) cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " < " << absoluteErrorTreshold << endl; else cout << "absoluteDecrease: " << setprecision(12) << absoluteDecrease << " >= " << absoluteErrorTreshold << endl; @@ -99,13 +99,13 @@ bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold // calculate relative error decrease and update currentError double relativeDecrease = absoluteDecrease / currentError; if (verbosity >= 2) { - if (relativeDecrease < relativeErrorTreshold) + if (relativeDecrease <= relativeErrorTreshold) cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " < " << relativeErrorTreshold << endl; else cout << "relativeDecrease: " << setprecision(12) << relativeDecrease << " >= " << relativeErrorTreshold << endl; } - bool converged = (relativeErrorTreshold && (relativeDecrease < relativeErrorTreshold)) - || (absoluteDecrease < absoluteErrorTreshold); + bool converged = (relativeErrorTreshold && (relativeDecrease <= relativeErrorTreshold)) + || (absoluteDecrease <= absoluteErrorTreshold); if (verbosity >= 1 && converged) { if(absoluteDecrease >= 0.0) cout << "converged" << endl;