|
g2o
|
Implementation of the Levenberg Algorithm. More...
#include <optimization_algorithm_levenberg.h>


Public Member Functions | |
| OptimizationAlgorithmLevenberg (std::unique_ptr< Solver > solver) | |
| virtual | ~OptimizationAlgorithmLevenberg () |
| virtual SolverResult | solve (int iteration, bool online=false) |
| virtual void | printVerbose (std::ostream &os) const |
| double | currentLambda () const |
| return the currently used damping factor | |
| void | setMaxTrialsAfterFailure (int max_trials) |
| int | maxTrialsAfterFailure () const |
| get the number of inner iterations for Levenberg-Marquardt | |
| double | userLambdaInit () |
| void | setUserLambdaInit (double lambda) |
| int | levenbergIteration () |
| return the number of levenberg iterations performed in the last round | |
| Public Member Functions inherited from g2o::OptimizationAlgorithmWithHessian | |
| OptimizationAlgorithmWithHessian (Solver &solver) | |
| virtual | ~OptimizationAlgorithmWithHessian () |
| virtual bool | init (bool online=false) |
| virtual bool | computeMarginals (SparseBlockMatrix< MatrixX > &spinv, const std::vector< std::pair< int, int > > &blockIndices) |
| virtual bool | buildLinearStructure () |
| virtual void | updateLinearSystem () |
| virtual bool | updateStructure (const std::vector< HyperGraph::Vertex * > &vset, const HyperGraph::EdgeSet &edges) |
| Solver & | solver () |
| return the underlying solver used to solve the linear system | |
| virtual void | setWriteDebug (bool writeDebug) |
| virtual bool | writeDebug () const |
| Public Member Functions inherited from g2o::OptimizationAlgorithm | |
| OptimizationAlgorithm () | |
| virtual | ~OptimizationAlgorithm () |
| const SparseOptimizer * | optimizer () const |
| return the optimizer operating on | |
| SparseOptimizer * | optimizer () |
| void | setOptimizer (SparseOptimizer *optimizer) |
| const PropertyMap & | properties () const |
| return the properties of the solver | |
| bool | updatePropertiesFromString (const std::string &propString) |
| void | printProperties (std::ostream &os) const |
Protected Member Functions | |
| double | computeLambdaInit () const |
| double | computeScale () const |
Protected Attributes | |
| Property< int > * | _maxTrialsAfterFailure |
| Property< double > * | _userLambdaInit |
| double | _currentLambda |
| double | _tau |
| double | _goodStepLowerScale |
| double | _goodStepUpperScale |
| double | _ni |
| int | _levenbergIterations |
| Protected Attributes inherited from g2o::OptimizationAlgorithmWithHessian | |
| Solver & | _solver |
| Property< bool > * | _writeDebug |
| Protected Attributes inherited from g2o::OptimizationAlgorithm | |
| SparseOptimizer * | _optimizer |
| the optimizer the solver is working on | |
| PropertyMap | _properties |
Private Attributes | |
| std::unique_ptr< Solver > | m_solver |
Implementation of the Levenberg Algorithm.
Definition at line 40 of file optimization_algorithm_levenberg.h.
|
explicit |
construct the Levenberg algorithm, which will use the given Solver for solving the linearized system.
Definition at line 41 of file optimization_algorithm_levenberg.cpp.
References _currentLambda, _goodStepLowerScale, _goodStepUpperScale, _levenbergIterations, _maxTrialsAfterFailure, _ni, g2o::OptimizationAlgorithm::_properties, _tau, _userLambdaInit, g2o::cst(), m_solver, g2o::OptimizationAlgorithmWithHessian::OptimizationAlgorithmWithHessian(), and g2o::OptimizationAlgorithmWithHessian::solver().
|
virtual |
Definition at line 57 of file optimization_algorithm_levenberg.cpp.
|
protected |
helper for Levenberg, this function computes the initial damping factor, if the user did not specify an own value, see setUserLambdaInit()
Definition at line 154 of file optimization_algorithm_levenberg.cpp.
References g2o::OptimizationAlgorithm::_optimizer, _tau, _userLambdaInit, g2o::OptimizableGraph::Vertex::dimension(), and g2o::OptimizableGraph::Vertex::hessian().
Referenced by solve().
|
protected |
Definition at line 168 of file optimization_algorithm_levenberg.cpp.
References _currentLambda, and g2o::OptimizationAlgorithmWithHessian::_solver.
Referenced by solve().
|
inline |
return the currently used damping factor
Definition at line 55 of file optimization_algorithm_levenberg.h.
References _currentLambda.
|
inline |
return the number of levenberg iterations performed in the last round
Definition at line 72 of file optimization_algorithm_levenberg.h.
References _levenbergIterations.
|
inline |
get the number of inner iterations for Levenberg-Marquardt
Definition at line 62 of file optimization_algorithm_levenberg.h.
References _maxTrialsAfterFailure.
|
virtual |
called by the optimizer if verbose. re-implement, if you want to print something
Reimplemented from g2o::OptimizationAlgorithm.
Definition at line 185 of file optimization_algorithm_levenberg.cpp.
References _currentLambda, _levenbergIterations, and g2o::OptimizationAlgorithmWithHessian::_solver.
| void g2o::OptimizationAlgorithmLevenberg::setMaxTrialsAfterFailure | ( | int | max_trials | ) |
the number of internal iteration if an update step increases chi^2 within Levenberg-Marquardt
Definition at line 177 of file optimization_algorithm_levenberg.cpp.
References _maxTrialsAfterFailure.
| void g2o::OptimizationAlgorithmLevenberg::setUserLambdaInit | ( | double | lambda | ) |
specify the initial lambda used for the first iteraion, if not given the SparseOptimizer tries to compute a suitable value
Definition at line 181 of file optimization_algorithm_levenberg.cpp.
References _userLambdaInit.
|
virtual |
Solve one iteration. The SparseOptimizer running on-top will call this for the given number of iterations.
| iteration | indicates the current iteration |
Implements g2o::OptimizationAlgorithm.
Definition at line 59 of file optimization_algorithm_levenberg.cpp.
References __PRETTY_FUNCTION__, _currentLambda, _goodStepLowerScale, _goodStepUpperScale, _levenbergIterations, _maxTrialsAfterFailure, _ni, g2o::OptimizationAlgorithm::_optimizer, g2o::OptimizationAlgorithmWithHessian::_solver, computeLambdaInit(), computeScale(), g2o::cst(), g2o_isfinite, G2O_WARN, g2o::get_monotonic_time(), g2o::G2OBatchStatistics::globalStats(), g2o::G2OBatchStatistics::levenbergIterations, OK, Terminate, g2o::G2OBatchStatistics::timeLinearSolution, g2o::G2OBatchStatistics::timeQuadraticForm, g2o::G2OBatchStatistics::timeResiduals, and g2o::G2OBatchStatistics::timeUpdate.
|
inline |
return the lambda set by the user, if < 0 the SparseOptimizer will compute the initial lambda
Definition at line 66 of file optimization_algorithm_levenberg.h.
References _userLambdaInit.
|
protected |
Definition at line 78 of file optimization_algorithm_levenberg.h.
Referenced by computeScale(), currentLambda(), OptimizationAlgorithmLevenberg(), printVerbose(), and solve().
|
protected |
lower bound for lambda decrease if a good LM step
Definition at line 80 of file optimization_algorithm_levenberg.h.
Referenced by OptimizationAlgorithmLevenberg(), and solve().
|
protected |
upper bound for lambda decrease if a good LM step
Definition at line 82 of file optimization_algorithm_levenberg.h.
Referenced by OptimizationAlgorithmLevenberg(), and solve().
|
protected |
the number of levenberg iterations performed to accept the last step
Definition at line 85 of file optimization_algorithm_levenberg.h.
Referenced by levenbergIteration(), OptimizationAlgorithmLevenberg(), printVerbose(), and solve().
|
protected |
Definition at line 76 of file optimization_algorithm_levenberg.h.
Referenced by maxTrialsAfterFailure(), OptimizationAlgorithmLevenberg(), setMaxTrialsAfterFailure(), and solve().
|
protected |
Definition at line 84 of file optimization_algorithm_levenberg.h.
Referenced by OptimizationAlgorithmLevenberg(), and solve().
|
protected |
Definition at line 79 of file optimization_algorithm_levenberg.h.
Referenced by computeLambdaInit(), and OptimizationAlgorithmLevenberg().
|
protected |
Definition at line 77 of file optimization_algorithm_levenberg.h.
Referenced by computeLambdaInit(), OptimizationAlgorithmLevenberg(), setUserLambdaInit(), and userLambdaInit().
|
private |
Definition at line 96 of file optimization_algorithm_levenberg.h.
Referenced by OptimizationAlgorithmLevenberg().