![]() |
NDEVR
API Documentation
|
Sparse optimizer that manages active vertices and edges for graph-based optimization. More...
Public Types | |
| enum | |
| Action types for optimization callbacks. | |
| Public Types inherited from OptimizableGraph | |
| enum | ActionType { AT_PREITERATION , AT_POSTITERATION , AT_NUM_ELEMENTS } |
| Types of actions that can be registered for optimization callbacks. More... | |
| typedef Buffer< OptimizableGraph::OGEdge * > | EdgeContainer |
| vector container for edges | |
| typedef Buffer< OptimizableGraph::OGVertex * > | VertexContainer |
| vector container for vertices | |
Public Member Functions | |
| g_type | activeChi2 () const |
| Returns the total chi-squared error of all active edges. | |
| const EdgeContainer & | activeEdges () const |
| the edges active in the current optimization | |
| g_type | activeRobustChi2 () const |
| Returns the total robustified chi-squared error of all active edges. | |
| const VertexContainer & | activeVertices () const |
| the vertices active in the current optimization | |
| bool | buildIndexMapping (SparseOptimizer::VertexContainer &vlist) |
| Builds the index mapping from active vertices to Hessian positions. | |
| void | clear () final override |
| Clears all internal structures and the base graph. | |
| void | clearIndexMapping () |
| Clears the index mapping, resetting all vertex Hessian indices to -1. | |
| void | computeActiveErrors () |
| computes the error vectors of all edges in the activeSet, and caches them | |
| void | discardTop () final override |
| discard the last backup of the estimate for all variables by removing it from the stack | |
| OptimizableGraph::OGEdge *const * | findActiveEdge (const OptimizableGraph::OGEdge *e) const |
| Finds an active edge by pointer using binary search. | |
| OGVertex *const * | findActiveVertex (const OGVertex *v) const |
| Finds an active vertex by pointer using binary search. | |
| OGVertex * | findGauge () |
| Finds a gauge vertex (first vertex with maximum dimension) for fixing. | |
| bool * | forceStopFlag () const |
| Returns the external force-stop flag pointer. | |
| bool | gaugeFreedom () |
| Returns true if the graph has gauge freedom (no fixed vertex of maximum dimension). | |
| const VertexContainer & | indexMapping () const |
| the index mapping of the vertices | |
| bool | initializeOptimization (int level=0) |
| Initializes the structures for optimizing a portion of the graph specified by a subset of vertices. | |
| bool | initializeOptimization (Set< HyperGraph::HGVertex * > &eset) |
| Initializes optimization from a specific edge set. | |
| bool | isReadyToUpdate () const |
| Returns true if the index mapping has been built and the optimizer is ready. | |
| void | linearizeSystem () |
| Linearizes the system by computing the Jacobians for the nodes and edges in the graph. | |
| void | pop () final override |
| pop (restore) the estimate of all variables from the stack | |
| void | pop (Set< HyperGraph::HGVertex * > &vlist) final override |
| pop (restore) the estimate a subset of the variables from the stack | |
| void | push () final override |
| Remove a vertex. | |
| void | push (Set< HyperGraph::HGVertex * > &vlist) final override |
| push the estimate of a subset of the variables onto a stack | |
| void | setForceStopFlag (bool *flag) |
| sets a variable checked at every iteration to force a user stop. | |
| bool | terminate () |
| if external stop flag is given, return its state. False otherwise | |
| void | update (const g_type *update) |
| update the estimate of the active vertices | |
| Public Member Functions inherited from OptimizableGraph | |
| OptimizableGraph () | |
| empty constructor | |
| virtual bool | addEdge (HyperGraph::HGEdge *e_) final override |
| adds a new edge. | |
| virtual bool | addVertex (HyperGraph::HGVertex &v) final override |
| adds a new vertex. | |
| g_type | chi2 () const |
| returns the chi2 of the current configuration | |
| Set< sint04 > | dimensions () const |
| iterates over all vertices and returns a set of all the vertex dimensions in the graph | |
| bool | isSolverSuitable (const OptimizationAlgorithmProperty &solverProperty, const Set< sint04 > &vertDims_=Set< int >()) const |
| test whether a solver is suitable for optimizing this graph. | |
| JacobianWorkspace & | jacobianWorkspace () |
| verify that all the information of the edges are semi positive definite, i.e., all Eigenvalues are >= 0. | |
| const JacobianWorkspace & | jacobianWorkspace () const |
| Returns a const reference to the Jacobian workspace. | |
| sint04 | maxDimension () const |
| return the maximum dimension of all vertices in the graph | |
| virtual void | setFixed (Set< HyperGraph::HGVertex * > &vset, bool fixed) |
| fixes/releases a set of vertices | |
| Public Member Functions inherited from HyperGraph | |
| HyperGraph () | |
| constructs an empty hyper graph | |
| virtual | ~HyperGraph () |
| destroys the hyper-graph and all the vertices of the graph | |
| Buffer< HGEdge * > & | edges () |
| const Buffer< HGEdge * > & | edges () const |
| HGVertex * | vertex (int id) |
| returns a vertex id in the hyper-graph, or 0 if the vertex id is not present | |
| const HGVertex * | vertex (int id) const |
| returns a vertex id in the hyper-graph, or 0 if the vertex id is not present | |
| Dictionary< int, HGVertex * > & | vertices () |
| const Dictionary< int, HGVertex * > & | vertices () const |
Protected Member Functions | |
| void | sortVectorContainers () |
| Sorts active vertices and edges by their ID comparators for deterministic ordering. | |
Protected Attributes | |
| EdgeContainer | _activeEdges |
| Active edges, sorted by EdgeIDCompare. | |
| VertexContainer | _activeVertices |
| Active vertices, sorted by VertexIDCompare. | |
| bool * | _forceStopFlag |
| External flag to force stopping the optimization. | |
| VertexContainer | _ivMap |
| Index-to-vertex mapping for the Hessian. | |
| Protected Attributes inherited from OptimizableGraph | |
| JacobianWorkspace | _jacobianWorkspace |
| Workspace for computing Jacobians. | |
| int | _nextEdgeId = 0 |
| Counter for assigning internal edge IDs. | |
| Protected Attributes inherited from HyperGraph | |
| Buffer< HGEdge * > | _edges |
| Collection of all edges in the graph. | |
| Dictionary< int, HGVertex * > | _vertices |
| Map from vertex id to vertex pointer. | |
Sparse optimizer that manages active vertices and edges for graph-based optimization.
Definition at line 13 of file sparse_optimizer.h.
|
inline |
Builds the index mapping from active vertices to Hessian positions.
| [in] | vlist | The vertex container to build the mapping from. |
Definition at line 176 of file sparse_optimizer.h.
References _ivMap, OptimizableGraph::OGVertex::fixed(), OptimizableGraph::OGVertex::marginalized(), and OptimizableGraph::OGVertex::setHessianIndex().
Referenced by initializeOptimization(), and initializeOptimization().
|
inline |
Finds an active edge by pointer using binary search.
| [in] | e | The edge to find. |
Definition at line 336 of file sparse_optimizer.h.
References _activeEdges.
Finds an active vertex by pointer using binary search.
| [in] | v | The vertex to find. |
Definition at line 323 of file sparse_optimizer.h.
References _activeVertices.
|
inline |
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.
| vset | the subgraph to be optimized. |
| level | is the level (in multilevel optimization) |
Initializes optimization structures from all graph vertices at the given level.
| [in] | level | The multi-level optimization level (-1 for all levels). |
Definition at line 221 of file sparse_optimizer.h.
References _activeEdges, _activeVertices, OptimizableGraph::_jacobianWorkspace, OptimizableGraph::OGEdge::allVerticesFixed(), buildIndexMapping(), cast(), clearIndexMapping(), HyperGraph::edges(), HyperGraph::HGVertex::edges(), HyperGraph::HGVertex::id(), Set< t_value >::size(), sortVectorContainers(), HyperGraph::HGEdge::vertex(), HyperGraph::HGEdge::vertexCount(), and HyperGraph::vertices().
|
inline |
Initializes optimization from a specific edge set.
| [in] | eset | The set of edges to optimize. |
Definition at line 280 of file sparse_optimizer.h.
References _activeEdges, _activeVertices, OptimizableGraph::_jacobianWorkspace, buildIndexMapping(), cast(), clearIndexMapping(), Set< t_value >::size(), sortVectorContainers(), HyperGraph::HGEdge::vertex(), and HyperGraph::HGEdge::vertexCount().
|
inlinefinaloverridevirtual |
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 OptimizableGraph.
Definition at line 413 of file sparse_optimizer.h.
References _activeVertices, and push().
Referenced by push().
|
inline |
sets a variable checked at every iteration to force a user stop.
The iteration exits when the variable is true;
Definition at line 390 of file sparse_optimizer.h.
References _forceStopFlag.
|
inline |
update the estimate of the active vertices
| update | the g_type vector containing the stacked elements of the increments on the vertices. |
Definition at line 61 of file sparse_optimizer.h.
References _ivMap, OptimizableGraph::OGVertex::dimension(), OptimizableGraph::OGVertex::oplus(), and update().
Referenced by OptimizationAlgorithmGaussNewton< t_type >::solve(), OptimizationAlgorithmLevenberg< t_type >::solve(), and update().