minor changes to cout when verbosity is TRYLAMBDA
parent
4123053c81
commit
d8fafce224
|
|
@ -256,6 +256,9 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
double newlinearizedError = linear->error(delta);
|
double newlinearizedError = linear->error(delta);
|
||||||
|
|
||||||
double linearizedCostChange = state_.error - newlinearizedError;
|
double linearizedCostChange = state_.error - newlinearizedError;
|
||||||
|
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
||||||
|
cout << "newlinearizedError = " << newlinearizedError <<
|
||||||
|
"linearizedCostChange = " << linearizedCostChange << endl;
|
||||||
|
|
||||||
if (linearizedCostChange >= 0) { // step is valid
|
if (linearizedCostChange >= 0) { // step is valid
|
||||||
// update values
|
// update values
|
||||||
|
|
@ -266,10 +269,14 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
// compute new error
|
// compute new error
|
||||||
gttic(compute_error);
|
gttic(compute_error);
|
||||||
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
||||||
cout << "calculating error" << endl;
|
cout << "calculating error:" << endl;
|
||||||
newError = graph_.error(newValues);
|
newError = graph_.error(newValues);
|
||||||
gttoc(compute_error);
|
gttoc(compute_error);
|
||||||
|
|
||||||
|
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
||||||
|
cout << "old error (" << state_.error
|
||||||
|
<< ") new (tentative) error (" << newError << ")" << endl;
|
||||||
|
|
||||||
// cost change in the original, nonlinear system (old - new)
|
// cost change in the original, nonlinear system (old - new)
|
||||||
double costChange = state_.error - newError;
|
double costChange = state_.error - newError;
|
||||||
|
|
||||||
|
|
@ -297,8 +304,7 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
break;
|
break;
|
||||||
} else if (!stopSearchingLambda) { // we failed to solved the system or we had no decrease in cost
|
} else if (!stopSearchingLambda) { // we failed to solved the system or we had no decrease in cost
|
||||||
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
||||||
cout << "increasing lambda: old error (" << state_.error
|
cout << "increasing lambda" << endl;
|
||||||
<< ") new error (" << newError << ")" << endl;
|
|
||||||
increaseLambda();
|
increaseLambda();
|
||||||
|
|
||||||
// check if lambda is too big
|
// check if lambda is too big
|
||||||
|
|
@ -310,6 +316,8 @@ void LevenbergMarquardtOptimizer::iterate() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { // the change in the cost is very small and it is not worth trying bigger lambdas
|
} else { // the change in the cost is very small and it is not worth trying bigger lambdas
|
||||||
|
if (lmVerbosity >= LevenbergMarquardtParams::TRYLAMBDA)
|
||||||
|
cout << "Levenberg-Marquardt: stopping as relative cost reduction is small" << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue