g2o
Loading...
Searching...
No Matches
g2o::SparseOptimizer Class Reference

#include <sparse_optimizer.h>

Inheritance diagram for g2o::SparseOptimizer:
Collaboration diagram for g2o::SparseOptimizer:

Public Types

enum  { AT_COMPUTEACTIVERROR = OptimizableGraph::AT_NUM_ELEMENTS , AT_NUM_ELEMENTS }
Public Types inherited from g2o::OptimizableGraph
enum  ActionType { AT_PREITERATION , AT_POSTITERATION , AT_NUM_ELEMENTS }
typedef std::set< HyperGraphAction * > HyperGraphActionSet
typedef std::vector< OptimizableGraph::Vertex * > VertexContainer
 vector container for vertices
typedef std::vector< OptimizableGraph::Edge * > EdgeContainer
 vector container for edges
Public Types inherited from g2o::HyperGraph
typedef std::bitset< HyperGraph::HGET_NUM_ELEMS > GraphElemBitset
typedef std::set< Edge * > EdgeSet
typedef std::set< Vertex * > VertexSet
typedef std::unordered_map< int, Vertex * > VertexIDMap
typedef std::vector< Vertex * > VertexContainer

Public Member Functions

 SparseOptimizer ()
virtual ~SparseOptimizer ()
virtual bool initializeOptimization (HyperGraph::EdgeSet &eset)
virtual bool initializeOptimization (HyperGraph::VertexSet &vset, int level=0)
virtual bool initializeOptimization (int level=0)
virtual bool updateInitialization (HyperGraph::VertexSet &vset, HyperGraph::EdgeSet &eset)
virtual void computeInitialGuess ()
virtual void computeInitialGuess (EstimatePropagatorCost &propagator)
virtual void setToOrigin ()
int optimize (int iterations, bool online=false)
bool computeMarginals (SparseBlockMatrix< MatrixX > &spinv, const std::vector< std::pair< int, int > > &blockIndices)
bool computeMarginals (SparseBlockMatrix< MatrixX > &spinv, const Vertex *vertex)
bool computeMarginals (SparseBlockMatrix< MatrixX > &spinv, const VertexContainer &vertices)
virtual Vertex * findGauge ()
 finds a gauge in the graph to remove the undefined dof.
bool gaugeFreedom ()
double activeChi2 () const
double activeRobustChi2 () const
bool verbose () const
 verbose information during optimization
void setVerbose (bool verbose)
void setForceStopFlag (bool *flag)
bool * forceStopFlag () const
bool terminate ()
 if external stop flag is given, return its state. False otherwise
const VertexContainer & indexMapping () const
 the index mapping of the vertices
const VertexContainer & activeVertices () const
 the vertices active in the current optimization
const EdgeContainer & activeEdges () const
 the edges active in the current optimization
virtual bool removeVertex (HyperGraph::Vertex *v, bool detach=false)
VertexContainer::const_iterator findActiveVertex (const OptimizableGraph::Vertex *v) const
EdgeContainer::const_iterator findActiveEdge (const OptimizableGraph::Edge *e) const
const OptimizationAlgorithm * algorithm () const
 the solver used by the optimizer
OptimizationAlgorithm * solver ()
void setAlgorithm (OptimizationAlgorithm *algorithm)
void push (SparseOptimizer::VertexContainer &vlist)
 push the estimate of a subset of the variables onto a stack
void push (HyperGraph::VertexSet &vlist)
 push the estimate of a subset of the variables onto a stack
void push ()
 push all the active vertices onto a stack
void pop (SparseOptimizer::VertexContainer &vlist)
 pop (restore) the estimate a subset of the variables from the stack
void pop (HyperGraph::VertexSet &vlist)
 pop (restore) the estimate a subset of the variables from the stack
void pop ()
 pop (restore) the estimate of the active vertices from the stack
void discardTop (SparseOptimizer::VertexContainer &vlist)
void discardTop ()
 same as above, but for the active vertices
virtual void clear ()
void computeActiveErrors ()
 G2O_ATTRIBUTE_DEPRECATED (void linearizeSystem())
void update (const double *update)
const BatchStatisticsContainer & batchStatistics () const
BatchStatisticsContainer & batchStatistics ()
void setComputeBatchStatistics (bool computeBatchStatistics)
bool computeBatchStatistics () const
bool addComputeErrorAction (HyperGraphAction *action)
 add an action to be executed before the error vectors are computed
bool removeComputeErrorAction (HyperGraphAction *action)
virtual void discardTop (HyperGraph::VertexSet &vset)
Public Member Functions inherited from g2o::OptimizableGraph
Vertex * vertex (int id)
 returns the vertex number id appropriately casted
const Vertex * vertex (int id) const
 returns the vertex number id appropriately casted
 OptimizableGraph ()
 empty constructor
virtual ~OptimizableGraph ()
virtual bool addVertex (HyperGraph::Vertex *v, Data *userData)
virtual bool addVertex (HyperGraph::Vertex *v)
bool addVertex (OptimizableGraph::Vertex *v, Data *userData)
bool addVertex (OptimizableGraph::Vertex *v)
virtual bool addEdge (HyperGraph::Edge *e)
bool addEdge (OptimizableGraph::Edge *e)
virtual bool setEdgeVertex (HyperGraph::Edge *e, int pos, HyperGraph::Vertex *v)
double chi2 () const
 returns the chi2 of the current configuration
int maxDimension () const
 return the maximum dimension of all vertices in the graph
void recomputeJacobianWorkspaceSize ()
std::set< int > dimensions () const
virtual void preIteration (int)
virtual void postIteration (int)
bool addPreIterationAction (HyperGraphAction *action)
 add an action to be executed before each iteration
bool addPostIterationAction (HyperGraphAction *action)
 add an action to be executed after each iteration
bool removePreIterationAction (HyperGraphAction *action)
 remove an action that should no longer be executed before each iteration
bool removePostIterationAction (HyperGraphAction *action)
 remove an action that should no longer be executed after each iteration
virtual bool load (std::istream &is)
bool load (const char *filename)
virtual bool save (std::ostream &os, int level=0) const
 save the graph to a stream. Again uses the Factory system.
bool save (const char *filename, int level=0) const
 function provided for convenience, see save() above
bool saveSubset (std::ostream &os, HyperGraph::VertexSet &vset, int level=0)
 save a subgraph to a stream. Again uses the Factory system.
bool saveSubset (std::ostream &os, HyperGraph::EdgeSet &eset)
 save a subgraph to a stream. Again uses the Factory system.
virtual void setFixed (HyperGraph::VertexSet &vset, bool fixed)
 fixes/releases a set of vertices
void setRenamedTypesFromString (const std::string &types)
bool isSolverSuitable (const OptimizationAlgorithmProperty &solverProperty, const std::set< int > &vertDims=std::set< int >()) const
virtual void clearParameters ()
bool addParameter (Parameter *p)
Parameter * parameter (int id)
bool verifyInformationMatrices (bool verbose=false) const
bool saveVertex (std::ostream &os, Vertex *v) const
bool saveParameter (std::ostream &os, Parameter *v) const
bool saveEdge (std::ostream &os, Edge *e) const
bool saveUserData (std::ostream &os, HyperGraph::Data *v) const
JacobianWorkspace & jacobianWorkspace ()
 the workspace for storing the Jacobians of the graph
const JacobianWorkspace & jacobianWorkspace () const
ParameterContainer & parameters ()
const ParameterContainer & parameters () const
void forEachVertex (std::function< void(OptimizableGraph::Vertex *)> fn)
 apply a unary function to all vertices
void forEachVertex (HyperGraph::VertexSet &vset, std::function< void(OptimizableGraph::Vertex *)> fn)
 apply a unary function to the vertices in vset
Public Member Functions inherited from g2o::HyperGraph
 HyperGraph ()
 constructs an empty hyper graph
virtual ~HyperGraph ()
 destroys the hyper-graph and all the vertices of the graph
Vertex * vertex (int id)
const Vertex * vertex (int id) const
virtual bool removeEdge (Edge *e)
const VertexIDMap & vertices () const
VertexIDMap & vertices ()
const EdgeSet & edges () const
EdgeSet & edges ()
virtual bool mergeVertices (Vertex *vBig, Vertex *vSmall, bool erase)
virtual bool detachVertex (Vertex *v)
virtual bool changeId (Vertex *v, int newId)

Protected Member Functions

void sortVectorContainers ()
bool buildIndexMapping (SparseOptimizer::VertexContainer &vlist)
void clearIndexMapping ()
Protected Member Functions inherited from g2o::OptimizableGraph
void performActions (int iter, HyperGraphActionSet &actions)

Protected Attributes

bool * _forceStopFlag
bool _verbose
VertexContainer _ivMap
VertexContainer _activeVertices
 sorted according to VertexIDCompare
EdgeContainer _activeEdges
 sorted according to EdgeIDCompare
OptimizationAlgorithm * _algorithm
BatchStatisticsContainer _batchStatistics
bool _computeBatchStatistics
Protected Attributes inherited from g2o::OptimizableGraph
std::map< std::string, std::string > _renamedTypesLookup
long long _nextEdgeId
std::vector< HyperGraphActionSet > _graphActions
ParameterContainer _parameters
JacobianWorkspace _jacobianWorkspace
Protected Attributes inherited from g2o::HyperGraph
VertexIDMap _vertices
EdgeSet _edges

Friends

class ActivePathCostFunction

Additional Inherited Members

Static Public Member Functions inherited from g2o::OptimizableGraph
static bool initMultiThreading ()
Public Attributes inherited from g2o::OptimizableGraph
class G2O_CORE_API Vertex
class G2O_CORE_API Edge
Public Attributes inherited from g2o::HyperGraph
class G2O_CORE_API Data
class G2O_CORE_API DataContainer
class G2O_CORE_API Vertex
class G2O_CORE_API Edge
Static Public Attributes inherited from g2o::HyperGraph
static const int UnassignedId = -1
static const int InvalidId = -2

Detailed Description

Definition at line 42 of file sparse_optimizer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
AT_COMPUTEACTIVERROR 
AT_NUM_ELEMENTS 

Definition at line 44 of file sparse_optimizer.h.

Constructor & Destructor Documentation

◆ SparseOptimizer()

◆ ~SparseOptimizer()

g2o::SparseOptimizer::~SparseOptimizer ( )
virtual

Member Function Documentation

◆ activeChi2()

double g2o::SparseOptimizer::activeChi2 ( ) const

returns the cached chi2 of the active portion of the graph

Definition at line 94 of file sparse_optimizer.cpp.

References _activeEdges, and g2o::OptimizableGraph::Edge::chi2().

Referenced by ActivePathCostFunction, computeInitialGuess(), main(), g2o::SparseOptimizerIncremental::optimize(), and g2o::SparseOptimizerOnline::optimize().

◆ activeEdges()

const EdgeContainer & g2o::SparseOptimizer::activeEdges ( ) const
inline

the edges active in the current optimization

Definition at line 190 of file sparse_optimizer.h.

References _activeEdges.

Referenced by g2o::activeVertexChi().

◆ activeRobustChi2()

double g2o::SparseOptimizer::activeRobustChi2 ( ) const

returns the cached chi2 of the active portion of the graph. In contrast to activeChi2() this functions considers the weighting of the error according to the robustification of the error functions.

Definition at line 104 of file sparse_optimizer.cpp.

References _activeEdges, g2o::OptimizableGraph::Edge::chi2(), g2o::RobustKernel::robustify(), and g2o::OptimizableGraph::Edge::robustKernel().

Referenced by ActivePathCostFunction, g2o::SparseOptimizerTerminateAction::operator()(), and optimize().

◆ activeVertices()

const VertexContainer & g2o::SparseOptimizer::activeVertices ( ) const
inline

the vertices active in the current optimization

Definition at line 188 of file sparse_optimizer.h.

References _activeVertices.

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

◆ addComputeErrorAction()

bool g2o::SparseOptimizer::addComputeErrorAction ( HyperGraphAction * action)

add an action to be executed before the error vectors are computed

Definition at line 615 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::_graphActions, and AT_COMPUTEACTIVERROR.

◆ algorithm()

const OptimizationAlgorithm * g2o::SparseOptimizer::algorithm ( ) const
inline

the solver used by the optimizer

Definition at line 214 of file sparse_optimizer.h.

References _algorithm.

Referenced by setAlgorithm().

◆ batchStatistics() [1/2]

BatchStatisticsContainer & g2o::SparseOptimizer::batchStatistics ( )
inline

returns the set of batch statistics about the optimisation

Definition at line 274 of file sparse_optimizer.h.

References _batchStatistics.

◆ batchStatistics() [2/2]

const BatchStatisticsContainer & g2o::SparseOptimizer::batchStatistics ( ) const
inline

returns the set of batch statistics about the optimisation

Definition at line 268 of file sparse_optimizer.h.

References _batchStatistics.

Referenced by main().

◆ buildIndexMapping()

bool g2o::SparseOptimizer::buildIndexMapping ( SparseOptimizer::VertexContainer & vlist)
protected

builds the mapping of the active vertices to the (block) row / column in the Hessian

Definition at line 162 of file sparse_optimizer.cpp.

References _ivMap, g2o::OptimizableGraph::Vertex::fixed(), g2o::OptimizableGraph::Vertex::marginalized(), and g2o::OptimizableGraph::Vertex::setHessianIndex().

Referenced by initializeOptimization(), and initializeOptimization().

◆ clear()

void g2o::SparseOptimizer::clear ( )
virtual

clears the graph, and polishes some intermediate structures Note that this only removes nodes / edges. Parameters can be removed with clearParameters().

Reimplemented from g2o::HyperGraph.

Definition at line 514 of file sparse_optimizer.cpp.

References _activeEdges, _activeVertices, _ivMap, and g2o::HyperGraph::clear().

Referenced by main(), main(), and g2o::Gm2dlIO::readGm2dl().

◆ clearIndexMapping()

void g2o::SparseOptimizer::clearIndexMapping ( )
protected

Definition at line 189 of file sparse_optimizer.cpp.

References _ivMap.

Referenced by initializeOptimization(), initializeOptimization(), and removeVertex().

◆ computeActiveErrors()

◆ computeBatchStatistics()

bool g2o::SparseOptimizer::computeBatchStatistics ( ) const
inline

Definition at line 278 of file sparse_optimizer.h.

References _computeBatchStatistics.

Referenced by setComputeBatchStatistics().

◆ computeInitialGuess() [1/2]

void g2o::SparseOptimizer::computeInitialGuess ( )
virtual

Propagates an initial guess from the vertex specified as origin. It should be called after initializeOptimization(...), as it relies on the _activeVertices/_edges structures. It constructs a set of trees starting from the nodes in the graph which are fixed and eligible for preforming optimization. The trees are constructed by utlizing a cost-function specified.

Parameters
costFunctionthe cost function used @patam maxDistance: the distance where to stop the search

Definition at line 320 of file sparse_optimizer.cpp.

References computeInitialGuess().

Referenced by ActivePathCostFunction, computeInitialGuess(), g2o::computeSimpleStars(), and main().

◆ computeInitialGuess() [2/2]

◆ computeMarginals() [1/3]

bool g2o::SparseOptimizer::computeMarginals ( SparseBlockMatrix< MatrixX > & spinv,
const std::vector< std::pair< int, int > > & blockIndices )

computes the blocks of the inverse of the specified pattern. the pattern is given via pairs <row, col> of the blocks in the hessian

Parameters
blockIndicesthe pattern
spinvthe sparse block matrix with the result
Returns
false if the operation is not supported by the solver

Definition at line 577 of file sparse_optimizer.cpp.

References _algorithm.

Referenced by ActivePathCostFunction, computeMarginals(), computeMarginals(), main(), main(), and testMarginals().

◆ computeMarginals() [2/3]

bool g2o::SparseOptimizer::computeMarginals ( SparseBlockMatrix< MatrixX > & spinv,
const Vertex * vertex )

computes the inverse of the specified vertex.

Parameters
vertexthe vertex whose state is to be marginalised
spinvthe sparse block matrix with the result
Returns
false if the operation is not supported by the solver

Definition at line 583 of file sparse_optimizer.cpp.

References computeMarginals(), and g2o::OptimizableGraph::vertex().

◆ computeMarginals() [3/3]

bool g2o::SparseOptimizer::computeMarginals ( SparseBlockMatrix< MatrixX > & spinv,
const VertexContainer & vertices )

computes the inverse of the set specified vertices, assembled into a single covariance matrix.

Parameters
vertexthe pattern
spinvthe sparse block matrix with the result
Returns
false if the operation is not supported by the solver

Definition at line 593 of file sparse_optimizer.cpp.

References computeMarginals(), and g2o::HyperGraph::vertices().

◆ discardTop() [1/3]

void g2o::SparseOptimizer::discardTop ( )
virtual

same as above, but for the active vertices

Reimplemented from g2o::OptimizableGraph.

Definition at line 629 of file sparse_optimizer.cpp.

References _activeVertices, and discardTop().

Referenced by discardTop().

◆ discardTop() [2/3]

ignore the latest stored element on the stack, remove it from the stack but do not restore the estimate

Reimplemented from g2o::OptimizableGraph.

Definition at line 688 of file optimizable_graph.cpp.

◆ discardTop() [3/3]

void g2o::SparseOptimizer::discardTop ( SparseOptimizer::VertexContainer & vlist)

ignore the latest stored element on the stack, remove it from the stack but do not restore the estimate

Definition at line 557 of file sparse_optimizer.cpp.

◆ findActiveEdge()

SparseOptimizer::EdgeContainer::const_iterator g2o::SparseOptimizer::findActiveEdge ( const OptimizableGraph::Edge * e) const

search for an edge in _activeEdges and return the iterator pointing to it getActiveEdges().end() if not found

Definition at line 530 of file sparse_optimizer.cpp.

References _activeEdges.

Referenced by g2o::activeVertexChi().

◆ findActiveVertex()

SparseOptimizer::VertexContainer::const_iterator g2o::SparseOptimizer::findActiveVertex ( const OptimizableGraph::Vertex * v) const

search for an edge in _activeVertices and return the iterator pointing to it getActiveVertices().end() if not found

Definition at line 522 of file sparse_optimizer.cpp.

References _activeVertices.

◆ findGauge()

OptimizableGraph::Vertex * g2o::SparseOptimizer::findGauge ( )
virtual

finds a gauge in the graph to remove the undefined dof.

Definition at line 119 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::Vertex::dimension(), g2o::OptimizableGraph::maxDimension(), and g2o::HyperGraph::vertices().

Referenced by ActivePathCostFunction, and main().

◆ forceStopFlag()

bool * g2o::SparseOptimizer::forceStopFlag ( ) const
inline

◆ G2O_ATTRIBUTE_DEPRECATED()

g2o::SparseOptimizer::G2O_ATTRIBUTE_DEPRECATED ( void linearizeSystem())
inline

Linearizes the system by computing the Jacobians for the nodes and edges in the graph

Definition at line 254 of file sparse_optimizer.h.

◆ gaugeFreedom()

◆ indexMapping()

const VertexContainer & g2o::SparseOptimizer::indexMapping ( ) const
inline

the index mapping of the vertices

Definition at line 186 of file sparse_optimizer.h.

References _ivMap.

Referenced by g2o::SparseOptimizerIncremental::optimize(), and g2o::SparseOptimizerOnline::optimize().

◆ initializeOptimization() [1/3]

bool g2o::SparseOptimizer::initializeOptimization ( HyperGraph::EdgeSet & eset)
virtual

Initializes the structures for optimizing a portion of the graph specified by a subset of edges. Before calling it be sure to invoke marginalized() and fixed() to the vertices you want to include in the schur complement or to set as fixed during the optimization.

Parameters
esetthe subgraph to be optimized.
Returns
false if somethings goes wrong

Definition at line 277 of file sparse_optimizer.cpp.

References _activeEdges, _activeVertices, g2o::OptimizableGraph::_jacobianWorkspace, buildIndexMapping(), clearIndexMapping(), g2o::HyperGraph::Edge::numUndefinedVertices(), g2o::OptimizableGraph::postIteration(), g2o::OptimizableGraph::preIteration(), sortVectorContainers(), and g2o::HyperGraph::Edge::vertices().

Referenced by ActivePathCostFunction, g2o::computeSimpleStars(), initializeOptimization(), g2o::Star::labelStarEdges(), main(), main(), main(), and MainWindow::prepare().

◆ initializeOptimization() [2/3]

bool g2o::SparseOptimizer::initializeOptimization ( HyperGraph::VertexSet & vset,
int level = 0 )
virtual

Initializes the structures for optimizing a portion of the graph specified by a subset of vertices. Before calling it be sure to invoke marginalized() and fixed() to the vertices you want to include in the schur complement or to set as fixed during the optimization.

Parameters
vsetthe subgraph to be optimized.
levelis the level (in multilevel optimization)
Returns
false if somethings goes wrong

Definition at line 204 of file sparse_optimizer.cpp.

References __PRETTY_FUNCTION__, _activeEdges, _activeVertices, g2o::OptimizableGraph::_jacobianWorkspace, g2o::OptimizableGraph::Edge::allVerticesFixed(), g2o::arrayHasNaN(), buildIndexMapping(), clearIndexMapping(), g2o::HyperGraph::edges(), g2o::HyperGraph::Vertex::edges(), g2o::OptimizableGraph::Vertex::estimateDimension(), G2O_WARN, g2o::OptimizableGraph::Vertex::getEstimateData(), g2o::HyperGraph::Vertex::id(), g2o::OptimizableGraph::postIteration(), g2o::OptimizableGraph::preIteration(), sortVectorContainers(), and g2o::HyperGraph::Edge::vertices().

◆ initializeOptimization() [3/3]

bool g2o::SparseOptimizer::initializeOptimization ( int level = 0)
virtual

Initializes the structures for optimizing the whole graph. Before calling it be sure to invoke marginalized() and fixed() to the vertices you want to include in the schur complement or to set as fixed during the optimization.

Parameters
levelis the level (in multilevel optimization)
Returns
false if somethings goes wrong

Definition at line 196 of file sparse_optimizer.cpp.

References initializeOptimization(), and g2o::HyperGraph::vertices().

◆ optimize()

int g2o::SparseOptimizer::optimize ( int iterations,
bool online = false )
virtual

◆ pop() [1/3]

void g2o::SparseOptimizer::pop ( )
virtual

pop (restore) the estimate of the active vertices from the stack

Reimplemented from g2o::OptimizableGraph.

Definition at line 627 of file sparse_optimizer.cpp.

References _activeVertices, and pop().

Referenced by pop().

◆ pop() [2/3]

void g2o::SparseOptimizer::pop ( HyperGraph::VertexSet & vlist)
virtual

pop (restore) the estimate a subset of the variables from the stack

Reimplemented from g2o::OptimizableGraph.

Definition at line 553 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::pop().

◆ pop() [3/3]

void g2o::SparseOptimizer::pop ( SparseOptimizer::VertexContainer & vlist)

pop (restore) the estimate a subset of the variables from the stack

Definition at line 544 of file sparse_optimizer.cpp.

Referenced by g2o::computeSimpleStars().

◆ push() [1/3]

void g2o::SparseOptimizer::push ( )
virtual

push all the active vertices onto a stack

Reimplemented from g2o::OptimizableGraph.

Definition at line 625 of file sparse_optimizer.cpp.

References _activeVertices, and push().

Referenced by push().

◆ push() [2/3]

void g2o::SparseOptimizer::push ( HyperGraph::VertexSet & vlist)
virtual

push the estimate of a subset of the variables onto a stack

Reimplemented from g2o::OptimizableGraph.

Definition at line 549 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::push().

◆ push() [3/3]

void g2o::SparseOptimizer::push ( SparseOptimizer::VertexContainer & vlist)

push the estimate of a subset of the variables onto a stack

Definition at line 539 of file sparse_optimizer.cpp.

Referenced by g2o::computeSimpleStars().

◆ removeComputeErrorAction()

bool g2o::SparseOptimizer::removeComputeErrorAction ( HyperGraphAction * action)

remove an action that should no longer be executed before computing the error vectors

Definition at line 621 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::_graphActions, and AT_COMPUTEACTIVERROR.

◆ removeVertex()

bool g2o::SparseOptimizer::removeVertex ( HyperGraph::Vertex * v,
bool detach = false )
virtual

Remove a vertex. If the vertex is contained in the currently active set of vertices, then the internal temporary structures are cleaned, e.g., the index mapping is erased. In case you need the index mapping for manipulating the graph, you have to store it in your own copy.

Reimplemented from g2o::HyperGraph.

Definition at line 606 of file sparse_optimizer.cpp.

References _ivMap, clearIndexMapping(), g2o::OptimizableGraph::Vertex::hessianIndex(), and g2o::HyperGraph::removeVertex().

◆ setAlgorithm()

◆ setComputeBatchStatistics()

void g2o::SparseOptimizer::setComputeBatchStatistics ( bool computeBatchStatistics)

◆ setForceStopFlag()

void g2o::SparseOptimizer::setForceStopFlag ( bool * flag)

sets a variable checked at every iteration to force a user stop. The iteration exits when the variable is true;

Definition at line 604 of file sparse_optimizer.cpp.

References _forceStopFlag.

Referenced by main().

◆ setToOrigin()

void g2o::SparseOptimizer::setToOrigin ( )
virtual

sets all vertices to their origin.

Definition at line 311 of file sparse_optimizer.cpp.

References g2o::OptimizableGraph::Vertex::setToOrigin(), and g2o::HyperGraph::vertices().

Referenced by ActivePathCostFunction.

◆ setVerbose()

void g2o::SparseOptimizer::setVerbose ( bool verbose)

Definition at line 562 of file sparse_optimizer.cpp.

References _verbose, and verbose().

Referenced by main(), main(), and main().

◆ solver()

◆ sortVectorContainers()

void g2o::SparseOptimizer::sortVectorContainers ( )
protected

Definition at line 508 of file sparse_optimizer.cpp.

References _activeEdges, and _activeVertices.

Referenced by initializeOptimization(), and initializeOptimization().

◆ terminate()

bool g2o::SparseOptimizer::terminate ( )
inline

if external stop flag is given, return its state. False otherwise

Definition at line 183 of file sparse_optimizer.h.

References _forceStopFlag.

Referenced by optimize().

◆ update()

void g2o::SparseOptimizer::update ( const double * update)

update the estimate of the active vertices

Parameters
updatethe double vector containing the stacked elements of the increments on the vertices.

Definition at line 446 of file sparse_optimizer.cpp.

References __PRETTY_FUNCTION__, _ivMap, g2o::arrayHasNaN(), g2o::OptimizableGraph::Vertex::dimension(), G2O_WARN, g2o::HyperGraph::Vertex::id(), g2o::OptimizableGraph::Vertex::oplus(), and update().

Referenced by update().

◆ updateInitialization()

◆ verbose()

bool g2o::SparseOptimizer::verbose ( ) const
inline

verbose information during optimization

Definition at line 172 of file sparse_optimizer.h.

References _verbose.

Referenced by computeInitialGuess(), main(), optimize(), g2o::SparseOptimizerIncremental::optimize(), g2o::SparseOptimizerOnline::optimize(), and setVerbose().

◆ ActivePathCostFunction

Member Data Documentation

◆ _activeEdges

◆ _activeVertices

◆ _algorithm

◆ _batchStatistics

BatchStatisticsContainer g2o::SparseOptimizer::_batchStatistics
protected

global statistics of the optimizer, e.g., timing, num-non-zeros

Definition at line 307 of file sparse_optimizer.h.

Referenced by batchStatistics(), batchStatistics(), optimize(), and setComputeBatchStatistics().

◆ _computeBatchStatistics

bool g2o::SparseOptimizer::_computeBatchStatistics
protected

◆ _forceStopFlag

bool* g2o::SparseOptimizer::_forceStopFlag
protected

Definition at line 288 of file sparse_optimizer.h.

Referenced by forceStopFlag(), setForceStopFlag(), SparseOptimizer(), and terminate().

◆ _ivMap

◆ _verbose

bool g2o::SparseOptimizer::_verbose
protected

Definition at line 289 of file sparse_optimizer.h.

Referenced by setVerbose(), SparseOptimizer(), and verbose().


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