gtsam  4.0.0
gtsam
gtsam::EliminationTree< BAYESNET, GRAPH > Class Template Reference

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.

Standard Constructors

 EliminationTree (const FactorGraphType &factorGraph, const VariableIndex &structure, const Ordering &order)
 Build the elimination tree of a factor graph using pre-computed column structure. More...
 
 EliminationTree (const FactorGraphType &factorGraph, const Ordering &order)
 Build the elimination tree of a factor graph. More...
 
 EliminationTree (const This &other)
 Copy constructor - makes a deep copy of the tree structure, but only pointers to factors are copied, factors are not cloned. More...
 
Thisoperator= (const This &other)
 Assignment operator - makes a deep copy of the tree structure, but only pointers to factors are copied, factors are not cloned. More...
 

Standard Interface

std::pair< boost::shared_ptr< BayesNetType >, boost::shared_ptr< FactorGraphType > > eliminate (Eliminate function) const
 Eliminate the factors to a Bayes net and remaining factor graph. More...
 

Testable

bool equals (const This &other, double tol=1e-9) const
 Test whether the tree is equal to another.
 
void print (const std::string &name="EliminationTree: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
 Print the tree to cout.
 

Advanced Interface

class ::EliminationTreeTester
 Allow access to constructor and add methods for testing purposes.
 
 EliminationTree ()
 Protected default constructor.
 
const FastVector< sharedNode > & roots () const
 Return the set of roots (one for a tree, multiple for a forest)
 
const FastVector< sharedFactor > & remainingFactors () const
 Return the remaining factors that are not pulled into elimination.
 
void swap (This &other)
 Swap the data of this tree with another one, this operation is very fast. More...
 

Public Types

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

Classes

struct  Node
 

Protected Types

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

Protected Member Functions

 GTSAM_CONCEPT_TESTABLE_TYPE (FactorType)
 concept check
 

Protected Attributes

FastVector< sharedNoderoots_
 
FastVector< sharedFactorremainingFactors_
 

Constructor & Destructor Documentation

◆ EliminationTree() [1/3]

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

◆ EliminationTree() [2/3]

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

◆ EliminationTree() [3/3]

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.

Member Function Documentation

◆ eliminate()

template<class BAYESNET , class GRAPH >
std::pair< boost::shared_ptr< BAYESNET >, boost::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

◆ 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.

◆ 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.


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