Added threshold for lambda in NonlinearOptimizer so that if lambda has gotten unreasonably large, optimization will throw a runtime exception to prevent infinite loops where lambda goes to infinity.
parent
c20498c688
commit
a46dc4cea0
|
@ -147,6 +147,8 @@ namespace gtsam {
|
|||
// if error decreased, return the new state
|
||||
if (next.error_ <= error_)
|
||||
return next;
|
||||
else if (lambda_ / factor > 1e+80) // if lambda gets too big, something is broken
|
||||
throw runtime_error("Lambda has grown too large!");
|
||||
else {
|
||||
// TODO: can we avoid copying the config ?
|
||||
NonlinearOptimizer cautious(graph_, config_, solver_, lambda_ * factor);
|
||||
|
|
Loading…
Reference in New Issue