g2o
|
Generic interface for a sparse solver operating on a graph which solves one iteration of the linearized objective function. More...
#include <solver.h>
Public Member Functions | |
Solver () | |
virtual | ~Solver () |
virtual bool | init (SparseOptimizer *optimizer, bool online=false)=0 |
virtual bool | buildStructure (bool zeroBlocks=false)=0 |
virtual bool | updateStructure (const std::vector< HyperGraph::Vertex * > &vset, const HyperGraph::EdgeSet &edges)=0 |
virtual bool | buildSystem ()=0 |
virtual bool | solve ()=0 |
virtual bool | computeMarginals (SparseBlockMatrix< MatrixXD > &spinv, const std::vector< std::pair< int, int > > &blockIndices)=0 |
virtual bool | setLambda (double lambda, bool backup=false)=0 |
virtual void | restoreDiagonal ()=0 |
double * | x () |
return x, the solution vector More... | |
const double * | x () const |
double * | b () |
return b, the right hand side of the system More... | |
const double * | b () const |
size_t | vectorSize () const |
return the size of the solution vector (x) and b More... | |
SparseOptimizer * | optimizer () const |
the optimizer (graph) on which the solver works More... | |
void | setOptimizer (SparseOptimizer *optimizer) |
bool | levenberg () const |
the system is Levenberg-Marquardt More... | |
void | setLevenberg (bool levenberg) |
virtual bool | supportsSchur () |
virtual bool | schur ()=0 |
should the solver perform the schur complement or not More... | |
virtual void | setSchur (bool s)=0 |
size_t | additionalVectorSpace () const |
void | setAdditionalVectorSpace (size_t s) |
virtual void | setWriteDebug (bool)=0 |
virtual bool | writeDebug () const =0 |
virtual bool | saveHessian (const std::string &) const =0 |
write the hessian to disk using the specified file name More... | |
Protected Member Functions | |
void | resizeVector (size_t sx) |
Protected Attributes | |
SparseOptimizer * | _optimizer |
double * | _x |
double * | _b |
size_t | _xSize |
size_t | _maxXSize |
bool | _isLevenberg |
the system we gonna solve is a Levenberg-Marquardt system More... | |
size_t | _additionalVectorSpace |
Private Member Functions | |
Solver (const Solver &) | |
Solver & | operator= (const Solver &) |
Generic interface for a sparse solver operating on a graph which solves one iteration of the linearized objective function.
g2o::Solver::Solver | ( | ) |
Definition at line 34 of file solver.cpp.
|
virtual |
Definition at line 40 of file solver.cpp.
|
inlineprivate |
|
inline |
return b, the right hand side of the system
Definition at line 99 of file solver.h.
Referenced by g2o::OptimizationAlgorithmLevenberg::computeScale(), g2o::SparseOptimizerOnline::optimize(), g2o::BlockSolver< Traits >::restoreDiagonal(), g2o::BlockSolver< Traits >::setLambda(), and g2o::OptimizationAlgorithmDogleg::solve().
|
pure virtual |
build the structure of the system
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::buildLinearStructure(), g2o::SparseOptimizerOnline::optimize(), g2o::OptimizationAlgorithmGaussNewton::solve(), g2o::OptimizationAlgorithmLevenberg::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
|
pure virtual |
build the current system
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::SparseOptimizerOnline::optimize(), g2o::OptimizationAlgorithmGaussNewton::solve(), g2o::OptimizationAlgorithmLevenberg::solve(), g2o::OptimizationAlgorithmDogleg::solve(), and g2o::OptimizationAlgorithmWithHessian::updateLinearSystem().
|
pure virtual |
computes the block diagonal elements of the pattern specified in the input and stores them in given SparseBlockMatrix
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::computeMarginals().
|
pure virtual |
initialize the solver, called once before the first iteration
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::init().
|
inline |
the system is Levenberg-Marquardt
Definition at line 110 of file solver.h.
Referenced by setLevenberg().
|
inline |
the optimizer (graph) on which the solver works
Definition at line 106 of file solver.h.
Referenced by g2o::BlockSolver< Traits >::init(), setOptimizer(), g2o::OptimizationAlgorithmLevenberg::solve(), g2o::OptimizationAlgorithmGaussNewton::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
|
protected |
Definition at line 46 of file solver.cpp.
References _additionalVectorSpace, _b, _maxXSize, _x, and _xSize.
Referenced by g2o::BlockSolver< Traits >::resize(), and g2o::BlockSolver< Traits >::updateStructure().
|
pure virtual |
restore a previosly made backup of the diagonal
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmLevenberg::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
|
pure virtual |
write the hessian to disk using the specified file name
Implemented in g2o::BlockSolver< Traits >.
|
pure virtual |
should the solver perform the schur complement or not
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmGaussNewton::printVerbose(), and g2o::OptimizationAlgorithmLevenberg::printVerbose().
void g2o::Solver::setAdditionalVectorSpace | ( | size_t | s | ) |
Definition at line 82 of file solver.cpp.
References _additionalVectorSpace.
Referenced by g2o::SparseOptimizerIncremental::initSolver().
|
pure virtual |
update the system while performing Levenberg, i.e., modifying the diagonal components of A by doing += lambda along the main diagonal of the Matrix. Note that this function may be called with a positive and a negative lambda. The latter is used to undo a former modification. If backup is true, then the solver should store a backup of the diagonal, which can be restored by restoreDiagonal()
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmLevenberg::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
void g2o::Solver::setLevenberg | ( | bool | levenberg | ) |
Definition at line 77 of file solver.cpp.
References _isLevenberg, and levenberg().
void g2o::Solver::setOptimizer | ( | SparseOptimizer * | optimizer | ) |
Definition at line 72 of file solver.cpp.
References _optimizer, and optimizer().
|
pure virtual |
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::init().
|
pure virtual |
write debug output of the Hessian if system is not positive definite
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::init().
|
pure virtual |
solve Ax = b
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::SparseOptimizerOnline::optimize(), g2o::OptimizationAlgorithmGaussNewton::solve(), g2o::OptimizationAlgorithmLevenberg::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
|
inlinevirtual |
does this solver support the Schur complement for solving a system consisting of poses and landmarks. Re-implemement in a derived solver, if your solver supports it.
Reimplemented in g2o::BlockSolver< Traits >.
Definition at line 117 of file solver.h.
Referenced by g2o::OptimizationAlgorithmWithHessian::init().
|
pure virtual |
update the structures for online processing
Implemented in g2o::BlockSolver< Traits >.
Referenced by g2o::OptimizationAlgorithmWithHessian::updateStructure().
|
inline |
return the size of the solution vector (x) and b
Definition at line 103 of file solver.h.
Referenced by g2o::OptimizationAlgorithmLevenberg::computeScale(), and g2o::OptimizationAlgorithmDogleg::solve().
|
pure virtual |
Implemented in g2o::BlockSolver< Traits >.
|
inline |
return x, the solution vector
Definition at line 96 of file solver.h.
Referenced by g2o::OptimizationAlgorithmLevenberg::computeScale(), g2o::SparseOptimizerOnline::optimize(), g2o::OptimizationAlgorithmGaussNewton::solve(), g2o::OptimizationAlgorithmLevenberg::solve(), and g2o::OptimizationAlgorithmDogleg::solve().
|
protected |
Definition at line 141 of file solver.h.
Referenced by resizeVector(), and setAdditionalVectorSpace().
|
protected |
Definition at line 138 of file solver.h.
Referenced by g2o::BlockSolver< Traits >::buildSystem(), resizeVector(), g2o::BlockSolver< Traits >::solve(), and ~Solver().
|
protected |
the system we gonna solve is a Levenberg-Marquardt system
Definition at line 140 of file solver.h.
Referenced by setLevenberg().
|
protected |
Definition at line 139 of file solver.h.
Referenced by resizeVector().
|
protected |
Definition at line 136 of file solver.h.
Referenced by g2o::BlockSolver< Traits >::buildStructure(), g2o::BlockSolver< Traits >::buildSystem(), g2o::BlockSolver< Traits >::init(), and setOptimizer().
|
protected |
Definition at line 137 of file solver.h.
Referenced by resizeVector(), g2o::BlockSolver< Traits >::solve(), and ~Solver().
|
protected |
Definition at line 139 of file solver.h.
Referenced by g2o::BlockSolver< Traits >::BlockSolver(), and resizeVector().