g2o
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
g2o::OptimizationAlgorithm Class Referenceabstract

Generic interface for a non-linear solver operating on a graph. More...

#include <optimization_algorithm.h>

Inheritance diagram for g2o::OptimizationAlgorithm:
Inheritance graph
[legend]
Collaboration diagram for g2o::OptimizationAlgorithm:
Collaboration graph
[legend]

Public Member Functions

 OptimizationAlgorithm ()
 
virtual ~OptimizationAlgorithm ()
 
virtual bool init (bool online=false)=0
 
virtual SolverResult solve (int iteration, bool online=false)=0
 
virtual bool computeMarginals (SparseBlockMatrix< MatrixXD > &spinv, const std::vector< std::pair< int, int > > &blockIndices)=0
 
virtual bool updateStructure (const std::vector< HyperGraph::Vertex * > &vset, const HyperGraph::EdgeSet &edges)=0
 
virtual void printVerbose (std::ostream &os) const
 
const SparseOptimizeroptimizer () const
 return the optimizer operating on More...
 
SparseOptimizeroptimizer ()
 
void setOptimizer (SparseOptimizer *optimizer)
 
const PropertyMapproperties () const
 return the properties of the solver More...
 
bool updatePropertiesFromString (const std::string &propString)
 
void printProperties (std::ostream &os) const
 

Protected Attributes

SparseOptimizer_optimizer
 the optimizer the solver is working on More...
 
PropertyMap _properties
 the properties of your solver, use this to store the parameters of your solver More...
 

Private Member Functions

 OptimizationAlgorithm (const OptimizationAlgorithm &)
 
OptimizationAlgorithmoperator= (const OptimizationAlgorithm &)
 

Detailed Description

Generic interface for a non-linear solver operating on a graph.

Definition at line 47 of file optimization_algorithm.h.

Constructor & Destructor Documentation

g2o::OptimizationAlgorithm::OptimizationAlgorithm ( )

Definition at line 33 of file optimization_algorithm.cpp.

33  :
34  _optimizer(0)
35 {
36 }
SparseOptimizer * _optimizer
the optimizer the solver is working on
g2o::OptimizationAlgorithm::~OptimizationAlgorithm ( )
virtual

Definition at line 38 of file optimization_algorithm.cpp.

39 {
40 }
g2o::OptimizationAlgorithm::OptimizationAlgorithm ( const OptimizationAlgorithm )
inlineprivate

Definition at line 112 of file optimization_algorithm.h.

112 { }

Member Function Documentation

virtual bool g2o::OptimizationAlgorithm::computeMarginals ( SparseBlockMatrix< MatrixXD > &  spinv,
const std::vector< std::pair< int, int > > &  blockIndices 
)
pure virtual

computes the block diagonal elements of the pattern specified in the input and stores them in given SparseBlockMatrix. If your solver does not support computing the marginals, return false.

Implemented in g2o::StructureOnlySolver< PointDoF >, and g2o::OptimizationAlgorithmWithHessian.

Referenced by g2o::SparseOptimizer::computeMarginals().

virtual bool g2o::OptimizationAlgorithm::init ( bool  online = false)
pure virtual
OptimizationAlgorithm& g2o::OptimizationAlgorithm::operator= ( const OptimizationAlgorithm )
inlineprivate

Definition at line 113 of file optimization_algorithm.h.

113 { return *this; }
const SparseOptimizer* g2o::OptimizationAlgorithm::optimizer ( ) const
inline

return the optimizer operating on

Definition at line 85 of file optimization_algorithm.h.

Referenced by g2o::StructureOnlySolver< PointDoF >::init(), and setOptimizer().

85 { return _optimizer;}
SparseOptimizer * _optimizer
the optimizer the solver is working on
SparseOptimizer* g2o::OptimizationAlgorithm::optimizer ( )
inline

Definition at line 86 of file optimization_algorithm.h.

86 { return _optimizer;}
SparseOptimizer * _optimizer
the optimizer the solver is working on
void g2o::OptimizationAlgorithm::printProperties ( std::ostream &  os) const

print the properties to a stream in a human readable fashion

Definition at line 42 of file optimization_algorithm.cpp.

References _properties, and g2o::BaseProperty::toString().

Referenced by main().

43 {
44  os << "------------- Algorithm Properties -------------" << endl;
45  for (PropertyMap::const_iterator it = _properties.begin(); it != _properties.end(); ++it) {
46  BaseProperty* p = it->second;
47  os << it->first << "\t" << p->toString() << endl;
48  }
49  os << "------------------------------------------------" << endl;
50 }
PropertyMap _properties
the properties of your solver, use this to store the parameters of your solver
virtual void g2o::OptimizationAlgorithm::printVerbose ( std::ostream &  os) const
inlinevirtual

called by the optimizer if verbose. re-implement, if you want to print something

Reimplemented in g2o::OptimizationAlgorithmDogleg, g2o::OptimizationAlgorithmGaussNewton, and g2o::OptimizationAlgorithmLevenberg.

Definition at line 81 of file optimization_algorithm.h.

Referenced by g2o::SparseOptimizer::optimize().

81 {(void) os;};
const PropertyMap& g2o::OptimizationAlgorithm::properties ( ) const
inline

return the properties of the solver

Definition at line 94 of file optimization_algorithm.h.

Referenced by MainWindow::on_btnOptimizerParamaters_clicked().

94 { return _properties;}
PropertyMap _properties
the properties of your solver, use this to store the parameters of your solver
void g2o::OptimizationAlgorithm::setOptimizer ( SparseOptimizer optimizer)

specify on which optimizer the solver should work on

Definition at line 57 of file optimization_algorithm.cpp.

References _optimizer, and optimizer().

Referenced by g2o::SparseOptimizer::setAlgorithm().

58 {
60 }
const SparseOptimizer * optimizer() const
return the optimizer operating on
SparseOptimizer * _optimizer
the optimizer the solver is working on
virtual SolverResult g2o::OptimizationAlgorithm::solve ( int  iteration,
bool  online = false 
)
pure virtual

Solve one iteration. The SparseOptimizer running on-top will call this for the given number of iterations.

Parameters
iterationindicates the current iteration

Implemented in g2o::StructureOnlySolver< PointDoF >, g2o::SolverSLAM2DLinear, g2o::OptimizationAlgorithmDogleg, g2o::OptimizationAlgorithmGaussNewton, and g2o::OptimizationAlgorithmLevenberg.

Referenced by g2o::SparseOptimizer::optimize().

bool g2o::OptimizationAlgorithm::updatePropertiesFromString ( const std::string &  propString)

update the properties from a string, see PropertyMap::updateMapFromString()

Definition at line 52 of file optimization_algorithm.cpp.

References _properties, and g2o::PropertyMap::updateMapFromString().

Referenced by main().

53 {
54  return _properties.updateMapFromString(propString);
55 }
PropertyMap _properties
the properties of your solver, use this to store the parameters of your solver
bool updateMapFromString(const std::string &values)
Definition: property.cpp:88
virtual bool g2o::OptimizationAlgorithm::updateStructure ( const std::vector< HyperGraph::Vertex * > &  vset,
const HyperGraph::EdgeSet edges 
)
pure virtual

update the structures for online processing

Implemented in g2o::StructureOnlySolver< PointDoF >, and g2o::OptimizationAlgorithmWithHessian.

Referenced by g2o::SparseOptimizer::updateInitialization().

Member Data Documentation

SparseOptimizer* g2o::OptimizationAlgorithm::_optimizer
protected
PropertyMap g2o::OptimizationAlgorithm::_properties
protected

The documentation for this class was generated from the following files: