Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
gtsam::EliminationTree< BAYESNET, GRAPH > Class Template Reference

#include <EliminationTree.h>

Classes

struct  Node
 

Public Types

typedef BAYESNET BayesNetType
 The BayesNet corresponding to FACTOR. More...
 
typedef BayesNetType::ConditionalType ConditionalType
 The type of conditionals. More...
 
typedef GRAPH::Eliminate Eliminate
 
typedef GRAPH FactorGraphType
 The factor graph type. More...
 
typedef GRAPH::FactorType FactorType
 The type of factors. More...
 
typedef std::shared_ptr< ConditionalTypesharedConditional
 Shared pointer to a conditional. More...
 
typedef std::shared_ptr< FactorTypesharedFactor
 Shared pointer to a factor. More...
 
typedef std::shared_ptr< NodesharedNode
 Shared pointer to Node. More...
 

Public Member Functions

 ~EliminationTree ()
 

Protected Types

typedef std::shared_ptr< Thisshared_ptr
 Shared pointer to this class. More...
 
typedef EliminationTree< BAYESNET, GRAPH > This
 This class. More...
 

Protected Attributes

FastVector< sharedFactorremainingFactors_
 
FastVector< sharedNoderoots_
 

Standard Constructors

 EliminationTree (const FactorGraphType &factorGraph, const VariableIndex &structure, const Ordering &order)
 
 EliminationTree (const FactorGraphType &factorGraph, const Ordering &order)
 
 EliminationTree (const This &other)
 
Thisoperator= (const This &other)
 

Standard Interface

std::pair< std::shared_ptr< BayesNetType >, std::shared_ptr< FactorGraphType > > eliminate (Eliminate function) const
 

Testable

bool equals (const This &other, double tol=1e-9) const
 
void print (const std::string &name="EliminationTree: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
 

Advanced Interface

class ::EliminationTreeTester
 Allow access to constructor and add methods for testing purposes. More...
 
 EliminationTree ()
 Protected default constructor. More...
 
const FastVector< sharedNode > & roots () const
 
const FastVector< sharedFactor > & remainingFactors () const
 
void swap (This &other)
 

Detailed Description

template<class BAYESNET, class GRAPH>
class gtsam::EliminationTree< BAYESNET, GRAPH >

An elimination tree is a data structure used intermediately during elimination. In future versions it will be used to save work between multiple eliminations.

When a variable is eliminated, a new factor is created by combining that variable's neighboring factors. The new combined factor involves the combined factors' involved variables. When the lowest-ordered one of those variables is eliminated, it consumes that combined factor. In the elimination tree, that lowest-ordered variable is the parent of the variable that was eliminated to produce the combined factor. This yields a tree in general, and not a chain because of the implicit sparse structure of the resulting Bayes net.

This structure is examined even more closely in a JunctionTree, which additionally identifies cliques in the chordal Bayes net.

Definition at line 51 of file EliminationTree.h.

Member Typedef Documentation

◆ BayesNetType

template<class BAYESNET , class GRAPH >
typedef BAYESNET gtsam::EliminationTree< BAYESNET, GRAPH >::BayesNetType

The BayesNet corresponding to FACTOR.

Definition at line 61 of file EliminationTree.h.

◆ ConditionalType

template<class BAYESNET , class GRAPH >
typedef BayesNetType::ConditionalType gtsam::EliminationTree< BAYESNET, GRAPH >::ConditionalType

The type of conditionals.

Definition at line 62 of file EliminationTree.h.

◆ Eliminate

template<class BAYESNET , class GRAPH >
typedef GRAPH::Eliminate gtsam::EliminationTree< BAYESNET, GRAPH >::Eliminate

Definition at line 64 of file EliminationTree.h.

◆ FactorGraphType

template<class BAYESNET , class GRAPH >
typedef GRAPH gtsam::EliminationTree< BAYESNET, GRAPH >::FactorGraphType

The factor graph type.

Definition at line 58 of file EliminationTree.h.

◆ FactorType

template<class BAYESNET , class GRAPH >
typedef GRAPH::FactorType gtsam::EliminationTree< BAYESNET, GRAPH >::FactorType

The type of factors.

Definition at line 59 of file EliminationTree.h.

◆ shared_ptr

template<class BAYESNET , class GRAPH >
typedef std::shared_ptr<This> gtsam::EliminationTree< BAYESNET, GRAPH >::shared_ptr
protected

Shared pointer to this class.

Definition at line 55 of file EliminationTree.h.

◆ sharedConditional

template<class BAYESNET , class GRAPH >
typedef std::shared_ptr<ConditionalType> gtsam::EliminationTree< BAYESNET, GRAPH >::sharedConditional

Shared pointer to a conditional.

Definition at line 63 of file EliminationTree.h.

◆ sharedFactor

template<class BAYESNET , class GRAPH >
typedef std::shared_ptr<FactorType> gtsam::EliminationTree< BAYESNET, GRAPH >::sharedFactor

Shared pointer to a factor.

Definition at line 60 of file EliminationTree.h.

◆ sharedNode

template<class BAYESNET , class GRAPH >
typedef std::shared_ptr<Node> gtsam::EliminationTree< BAYESNET, GRAPH >::sharedNode

Shared pointer to Node.

Definition at line 80 of file EliminationTree.h.

◆ This

template<class BAYESNET , class GRAPH >
typedef EliminationTree<BAYESNET, GRAPH> gtsam::EliminationTree< BAYESNET, GRAPH >::This
protected

This class.

Definition at line 54 of file EliminationTree.h.

Constructor & Destructor Documentation

◆ EliminationTree() [1/4]

template<class BAYESNET , class GRAPH >
gtsam::EliminationTree< BAYESNET, GRAPH >::EliminationTree ( const FactorGraphType factorGraph,
const VariableIndex structure,
const Ordering order 
)
protected

Build the elimination tree of a factor graph using pre-computed column structure.

Parameters
factorGraphThe factor graph for which to build the elimination tree
structureThe set of factors involving each variable. If this is not precomputed, you can call the Create(const FactorGraph<DERIVEDFACTOR>&) named constructor instead.
Returns
The elimination tree

Definition at line 78 of file EliminationTree-inst.h.

◆ EliminationTree() [2/4]

template<class BAYESNET , class GRAPH >
gtsam::EliminationTree< BAYESNET, GRAPH >::EliminationTree ( const FactorGraphType factorGraph,
const Ordering order 
)
protected

Build the elimination tree of a factor graph. Note that this has to compute the column structure as a VariableIndex, so if you already have this precomputed, use the other constructor instead.

Parameters
factorGraphThe factor graph for which to build the elimination tree

Definition at line 160 of file EliminationTree-inst.h.

◆ EliminationTree() [3/4]

template<class BAYESNET , class GRAPH >
gtsam::EliminationTree< BAYESNET, GRAPH >::EliminationTree ( const This other)
inlineprotected

Copy constructor - makes a deep copy of the tree structure, but only pointers to factors are copied, factors are not cloned.

Definition at line 112 of file EliminationTree.h.

◆ ~EliminationTree()

template<class BAYESNET , class GRAPH >
gtsam::EliminationTree< BAYESNET, GRAPH >::~EliminationTree

Destructor Using default destructor causes stack overflow for large trees due to recursive destruction of nodes; so we manually decrease the reference count of each node in the tree through a BFS, and the nodes with reference count 0 will be deleted. Please see PR-1441 for more details.

Definition at line 193 of file EliminationTree-inst.h.

◆ EliminationTree() [4/4]

template<class BAYESNET , class GRAPH >
gtsam::EliminationTree< BAYESNET, GRAPH >::EliminationTree ( )
inlineprotected

Protected default constructor.

Definition at line 162 of file EliminationTree.h.

Member Function Documentation

◆ eliminate()

template<class BAYESNET , class GRAPH >
std::pair< std::shared_ptr< BAYESNET >, std::shared_ptr< GRAPH > > gtsam::EliminationTree< BAYESNET, GRAPH >::eliminate ( Eliminate  function) const

Eliminate the factors to a Bayes net and remaining factor graph

Parameters
functionThe function to use to eliminate, see the namespace functions in GaussianFactorGraph.h
Returns
The Bayes net and factor graph resulting from elimination

Definition at line 225 of file EliminationTree-inst.h.

◆ equals()

template<class BAYESNET , class GRAPH >
bool gtsam::EliminationTree< BAYESNET, GRAPH >::equals ( const This other,
double  tol = 1e-9 
) const
protected

Test whether the tree is equal to another

Definition at line 252 of file EliminationTree-inst.h.

◆ operator=()

template<class BAYESNET , class GRAPH >
EliminationTree< BAYESNET, GRAPH > & gtsam::EliminationTree< BAYESNET, GRAPH >::operator= ( const This other)
protected

Assignment operator - makes a deep copy of the tree structure, but only pointers to factors are copied, factors are not cloned.

Definition at line 173 of file EliminationTree-inst.h.

◆ print()

template<class BAYESNET , class GRAPH >
void gtsam::EliminationTree< BAYESNET, GRAPH >::print ( const std::string &  name = "EliminationTree< BAYESNET, GRAPH >: ",
const KeyFormatter formatter = DefaultKeyFormatter 
) const

Print the tree to cout

Definition at line 245 of file EliminationTree-inst.h.

◆ remainingFactors()

template<class BAYESNET , class GRAPH >
const FastVector<sharedFactor>& gtsam::EliminationTree< BAYESNET, GRAPH >::remainingFactors ( ) const
inline

Return the remaining factors that are not pulled into elimination

Definition at line 155 of file EliminationTree.h.

◆ roots()

template<class BAYESNET , class GRAPH >
const FastVector<sharedNode>& gtsam::EliminationTree< BAYESNET, GRAPH >::roots ( ) const
inline

Return the set of roots (one for a tree, multiple for a forest)

Definition at line 152 of file EliminationTree.h.

◆ swap()

template<class BAYESNET , class GRAPH >
void gtsam::EliminationTree< BAYESNET, GRAPH >::swap ( This other)

Swap the data of this tree with another one, this operation is very fast.

Definition at line 321 of file EliminationTree-inst.h.

Friends And Related Function Documentation

◆ ::EliminationTreeTester

template<class BAYESNET , class GRAPH >
friend class ::EliminationTreeTester
friend

Allow access to constructor and add methods for testing purposes.

Definition at line 166 of file EliminationTree.h.

Member Data Documentation

◆ remainingFactors_

template<class BAYESNET , class GRAPH >
FastVector<sharedFactor> gtsam::EliminationTree< BAYESNET, GRAPH >::remainingFactors_
protected

Definition at line 87 of file EliminationTree.h.

◆ roots_

template<class BAYESNET , class GRAPH >
FastVector<sharedNode> gtsam::EliminationTree< BAYESNET, GRAPH >::roots_
protected

concept check

Definition at line 86 of file EliminationTree.h.


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


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:23:43