Loading...
Searching...
No Matches
gtsam::BayesTree< CLIQUE > Class Template Reference
Solving by multifrontal variable elimination (QR and Cholesky)

## Detailed Description

template<class CLIQUE>
class gtsam::BayesTree< CLIQUE >

Bayes tree.

Template Parameters

  CONDITIONAL | The type of the conditional densities, i.e. the type of node in the underlying Bayes chain, which could be a ConditionalProbabilityTable, a GaussianConditional, or a SymbolicConditional.
  CLIQUE | The type of the clique data structure, defaults to BayesTreeClique, normally do not change this as it is only used when developing special versions of BayesTree, e.g. for ISAM2.

## Advanced Interface

template<class BAYESTREE, class GRAPH>
class | EliminatableClusterTree
class | boost::serialization::access
| Serialization function.
void | dot (std::ostream &s, sharedClique clique, const KeyFormatter &keyFormatter, int parentnum=0) const
| private helper method for saving the Tree to a text file in GraphViz format
void | getCliqueData (sharedClique clique, BayesTreeCliqueData *stats) const
| Gather data on a single clique.
void | removeClique (sharedClique clique)
| remove a clique: warning, can result in a forest
void | fillNodesIndex (const sharedClique &subtree)
| Fill the nodes index for a subtree.
template<class CONTAINER>
Key | findParentClique (const CONTAINER &parents) const
| Find parent clique of a conditional.
void | clear ()
| Remove all nodes.
void | deleteCachedShortcuts ()
| Clear all shortcut caches - use before timing on marginal calculation to avoid residual cache data.
void | removePath (sharedClique clique, BayesNetType *bn, Cliques *orphans)
| Remove path from clique to root and return that path as factors plus a list of orphaned subtree roots.
void | removeTop (const KeyVector &keys, BayesNetType *bn, Cliques *orphans)
| Given a list of indices, turn "contaminated" part of the tree back into a factor graph.
Cliques | removeSubtree (const sharedClique &subtree)
| Remove the requested subtree.
void | insertRoot (const sharedClique &subtree)
| Insert a new subtree with known parent clique.
void | addClique (const sharedClique &clique, const sharedClique &parent_clique=sharedClique())
| add a clique (top down)
void | addFactorsToGraph (FactorGraph< FactorType > *graph) const
| Add all cliques in this BayesTree to the specified factor graph.

## Standard Constructors

| BayesTree ()
| Create an empty Bayes Tree.
| BayesTree (const This &other)
| Copy constructor.

## Testable

bool | equals (const This &other, double tol=1e-9) const
| check equality
void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
| print

## Standard Interface

size_t | size () const
| number of cliques
bool | empty () const
| Check if there are any cliques in the tree.
const Nodes & | nodes () const
| Return nodes.
sharedClique | operator[] (Key j) const
| Access node by variable.
const Roots & | roots () const
| return root cliques
const sharedClique & | clique (Key j) const
| alternate syntax for matlab: find the clique that contains the variable with Key j
BayesTreeCliqueData | getCliqueData () const
| Gather data on all cliques.
size_t | numCachedSeparatorMarginals () const
| Collect number of cliques with cached separator marginals.
sharedConditional | marginalFactor (Key j, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
| Return marginal on any variable.
sharedFactorGraph | joint (Key j1, Key j2, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
| return joint on two variables Limitation: can only calculate joint if cliques are disjoint or one of them is root
sharedBayesNet | jointBayesNet (Key j1, Key j2, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
| return joint on two variables as a BayesNet Limitation: can only calculate joint if cliques are disjoint or one of them is root

## Graph Display

void | dot (std::ostream &os, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
| Output to graphviz format, stream version.
std::string | dot (const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
| Output to graphviz format string.
void | saveGraph (const std::string &filename, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
| output to file with graphviz format.

## Public Types

typedef CLIQUE | Clique
| The clique type, normally BayesTreeClique.
typedef boost::shared_ptr< Clique > | sharedClique
| Shared pointer to a clique.
typedef Clique | Node
| Synonym for Clique (TODO: remove).
typedef sharedClique | sharedNode
| Synonym for sharedClique (TODO: remove).
typedef CLIQUE::ConditionalType | ConditionalType
typedef boost::shared_ptr< ConditionalType > | sharedConditional
typedef CLIQUE::BayesNetType | BayesNetType
typedef boost::shared_ptr< BayesNetType > | sharedBayesNet
typedef CLIQUE::FactorType | FactorType
typedef boost::shared_ptr< FactorType > | sharedFactor
typedef CLIQUE::FactorGraphType | FactorGraphType
typedef boost::shared_ptr< FactorGraphType > | sharedFactorGraph
typedef FactorGraphType::Eliminate | Eliminate
typedef CLIQUE::EliminationTraitsType | EliminationTraitsType
typedef FastList< sharedClique > | Cliques
| A convenience class for a list of shared cliques.
typedef ConcurrentMap< Key, sharedClique > | Nodes
| Map from keys to Clique.
typedef FastVector< sharedClique > | Roots
| Root cliques.

## Protected Types

typedef BayesTree< CLIQUE > | This
typedef boost::shared_ptr< This > | shared_ptr

## Protected Member Functions

This & | operator= (const This &other)
| Assignment operator.

## Protected Attributes

Nodes | nodes_
| Map from indices to Clique.
Roots | roots_
| Root cliques.

## Member Function Documentation

## findParentClique()

template<class CLIQUE>
template<class CONTAINER>

Key gtsam::BayesTree< CLIQUE >::findParentClique | ( | const CONTAINER & | parents | ) | const

Find parent clique of a conditional.

It will look at all parents and return the one with the lowest index in the ordering.

## insertRoot()

template<class CLIQUE>

void gtsam::BayesTree< CLIQUE >::insertRoot | ( | const sharedClique & | subtree | ) |

Insert a new subtree with known parent clique.

This function does not check that the specified parent is the correct parent. This function updates all of the internal data structures associated with adding a subtree, such as populating the nodes index.

## marginalFactor()

template<class CLIQUE>

BayesTree< CLIQUE >::sharedConditional gtsam::BayesTree< CLIQUE >::marginalFactor | ( | Key | j,
|  | const Eliminate & | function = EliminationTraitsType::DefaultEliminate ) const

Return marginal on any variable.

Note that this actually returns a conditional, for which a solution may be directly obtained by calling .solve() on the returned object. Alternatively, it may be directly used as its factor base class. For example, for Gaussian systems, this returns a GaussianConditional, which inherits from JacobianFactor and GaussianFactor.

## nodes()

template<class CLIQUE>

const Nodes & gtsam::BayesTree< CLIQUE >::nodes | ( |  | ) | const

inline

Return nodes.

Each node is a clique of variables obtained after elimination.

## removePath()

template<class CLIQUE>

void gtsam::BayesTree< CLIQUE >::removePath | ( | sharedClique | clique,
|  | BayesNetType * | bn,
|  | Cliques * | orphans )

Remove path from clique to root and return that path as factors plus a list of orphaned subtree roots.

Used in removeTop below.

## removeTop()

template<class CLIQUE>

void gtsam::BayesTree< CLIQUE >::removeTop | ( | const KeyVector & | keys,
|  | BayesNetType * | bn,
|  | Cliques * | orphans )

Given a list of indices, turn "contaminated" part of the tree back into a factor graph.

Factors and orphans are added to the in/out arguments.

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

- /build/gtsam-RkN8wG/gtsam-4.2.2+dfsg/gtsam/inference/BayesTree.h
- /build/gtsam-RkN8wG/gtsam-4.2.2+dfsg/gtsam/inference/BayesTree-inst.h