fixed a bug that causes the optimizer return an incorrect error
parent
880040a6f6
commit
eada34bd76
|
|
@ -149,10 +149,9 @@ namespace gtsam {
|
||||||
|
|
||||||
if( lambdaMode >= Parameters::CAUTIOUS) throw runtime_error("CAUTIOUS mode not working yet, please use BOUNDED.");
|
if( lambdaMode >= Parameters::CAUTIOUS) throw runtime_error("CAUTIOUS mode not working yet, please use BOUNDED.");
|
||||||
|
|
||||||
bool first_iteration = true;
|
|
||||||
double next_error = error_;
|
double next_error = error_;
|
||||||
|
|
||||||
shared_values next_values;
|
shared_values next_values = values_;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
if (verbosity >= Parameters::TRYLAMBDA) cout << "trying lambda = " << lambda << endl;
|
if (verbosity >= Parameters::TRYLAMBDA) cout << "trying lambda = " << lambda << endl;
|
||||||
|
|
@ -189,12 +188,8 @@ namespace gtsam {
|
||||||
|
|
||||||
if (verbosity >= Parameters::TRYLAMBDA) cout << "next error = " << error << endl;
|
if (verbosity >= Parameters::TRYLAMBDA) cout << "next error = " << error << endl;
|
||||||
|
|
||||||
if(first_iteration || error <= error_) {
|
|
||||||
next_values = newValues;
|
|
||||||
first_iteration = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( error <= error_ ) {
|
if( error <= error_ ) {
|
||||||
|
next_values = newValues;
|
||||||
next_error = error;
|
next_error = error;
|
||||||
lambda /= factor;
|
lambda /= factor;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue