NDEVR
API Documentation
OptimizableGraph

This is an abstract class that represents one optimization problem. More...

Inheritance diagram for OptimizableGraph:
[legend]
Collaboration diagram for OptimizableGraph:
[legend]

Classes

class  Data
 data packet for a vertex. More...
struct  EdgeIDCompare
 order edges based on the internal ID, which is assigned to the edge in addEdge() More...
class  OGEdge
 Base edge class for the optimizable graph, adding error computation and robust kernels. More...
class  OGVertex
 A general case Vertex for optimization. More...
struct  VertexIDCompare
 order vertices based on their ID More...

Public Types

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

 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< sint04dimensions () const
 iterates over all vertices and returns a set of all the vertex dimensions in the graph
virtual void discardTop ()
 discard the last backup of the estimate for all variables by removing it from the stack
bool isSolverSuitable (const OptimizationAlgorithmProperty &solverProperty, const Set< sint04 > &vertDims_=Set< int >()) const
 test whether a solver is suitable for optimizing this graph.
JacobianWorkspacejacobianWorkspace ()
 verify that all the information of the edges are semi positive definite, i.e., all Eigenvalues are >= 0.
const JacobianWorkspacejacobianWorkspace () const
 Returns a const reference to the Jacobian workspace.
sint04 maxDimension () const
 return the maximum dimension of all vertices in the graph
virtual void pop ()
 pop (restore) the estimate of all variables from the stack
virtual void pop (Set< HyperGraph::HGVertex * > &vset)
 pop (restore) the estimate a subset of the variables from the stack
virtual void push ()
 push the estimate of all variables onto a stack
virtual void push (Set< HyperGraph::HGVertex * > &vset)
 push the estimate of a subset of the variables onto a stack
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
virtual void clear ()
 removes a vertex from the graph. Returns true on success (vertex was present)
Buffer< HGEdge * > & edges ()
const Buffer< HGEdge * > & edges () const
HGVertexvertex (int id)
 returns a vertex id in the hyper-graph, or 0 if the vertex id is not present
const HGVertexvertex (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 Attributes

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.

Detailed Description

This is an abstract class that represents one optimization problem.

It specializes the general graph to contain special vertices and edges. The vertices represent parameters that can be optimized, while the edges represent constraints. This class also provides basic functionalities to handle the backup/restore of portions of the vertices.

Definition at line 36 of file optimizable_graph.h.

Member Enumeration Documentation

◆ ActionType

Types of actions that can be registered for optimization callbacks.

Enumerator
AT_PREITERATION 

Action invoked before each iteration.

AT_POSTITERATION 

Action invoked after each iteration.

AT_NUM_ELEMENTS 

Sentinel value; keep as last element.

Definition at line 40 of file optimizable_graph.h.

Member Function Documentation

◆ addEdge()

virtual bool OptimizableGraph::addEdge ( HyperGraph::HGEdge * e_)
inlinefinaloverridevirtual

adds a new edge.

The edge should point to the vertices that it is connecting (setFrom/setTo).

Returns
false if the insertion does not work (incompatible types of the vertices/missing vertex). true otherwise.

Reimplemented from HyperGraph.

Definition at line 428 of file optimizable_graph.h.

References OptimizableGraph::OGEdge::_internalId, _jacobianWorkspace, _nextEdgeId, and HyperGraph::addEdge().

◆ addVertex()

virtual bool OptimizableGraph::addVertex ( HyperGraph::HGVertex & v)
inlinefinaloverridevirtual

adds a new vertex.

The new vertex is then "taken".

Returns
false if a vertex with the same id as v is already in the graph, true otherwise.

Reimplemented from HyperGraph.

Definition at line 416 of file optimizable_graph.h.

References HyperGraph::addVertex(), and HyperGraph::vertex().

◆ isSolverSuitable()

bool OptimizableGraph::isSolverSuitable ( const OptimizationAlgorithmProperty & solverProperty,
const Set< sint04 > & vertDims_ = Set<int>() ) const
inline

test whether a solver is suitable for optimizing this graph.

Parameters
solverPropertythe solver property to evaluate.
vertDimsshould equal to the set returned by dimensions() to avoid re-evaluating.

Definition at line 540 of file optimizable_graph.h.

References dimensions(), OptimizationAlgorithmProperty::landmarkDim, OptimizationAlgorithmProperty::poseDim, OptimizationAlgorithmProperty::requiresMarginalize, and Set< t_value >::size().

◆ jacobianWorkspace()

JacobianWorkspace & OptimizableGraph::jacobianWorkspace ( )
inline

verify that all the information of the edges are semi positive definite, i.e., all Eigenvalues are >= 0.

Parameters
verboseoutput edges with not PSD information matrix on cerr
Returns
true if all edges have PSD information matrix

Returns a mutable reference to the Jacobian workspace.

Definition at line 606 of file optimizable_graph.h.

References _jacobianWorkspace.

Referenced by OptimizableGraph::OGEdge::linearizeOplusAndConstructQuadraticForm().


The documentation for this struct was generated from the following file: