Public Types | Protected Types | Protected Member Functions | Protected Attributes | List of all members
gtsam::BayesTree< CLIQUE > Class Template Reference

#include <BayesTree.h>

Public Types

typedef CLIQUE::BayesNetType BayesNetType
 
typedef CLIQUE Clique
 The clique type, normally BayesTreeClique. More...
 
typedef FastList< sharedCliqueCliques
 
typedef CLIQUE::ConditionalType ConditionalType
 
typedef FactorGraphType::Eliminate Eliminate
 
typedef CLIQUE::EliminationTraitsType EliminationTraitsType
 
typedef CLIQUE::FactorGraphType FactorGraphType
 
typedef CLIQUE::FactorType FactorType
 
typedef Clique Node
 Synonym for Clique (TODO: remove) More...
 
typedef ConcurrentMap< Key, sharedCliqueNodes
 
typedef FastVector< sharedCliqueRoots
 
typedef boost::shared_ptr< BayesNetTypesharedBayesNet
 
typedef boost::shared_ptr< CliquesharedClique
 Shared pointer to a clique. More...
 
typedef boost::shared_ptr< ConditionalTypesharedConditional
 
typedef boost::shared_ptr< FactorTypesharedFactor
 
typedef boost::shared_ptr< FactorGraphTypesharedFactorGraph
 
typedef sharedClique sharedNode
 Synonym for sharedClique (TODO: remove) More...
 

Public Member Functions

Standard Interface
size_t size () const
 
bool empty () const
 
const Nodesnodes () const
 
const sharedNode operator[] (Key j) const
 
const Rootsroots () const
 
const sharedCliqueclique (Key j) const
 
BayesTreeCliqueData getCliqueData () const
 
size_t numCachedSeparatorMarginals () const
 
sharedConditional marginalFactor (Key j, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
 
sharedFactorGraph joint (Key j1, Key j2, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
 
sharedBayesNet jointBayesNet (Key j1, Key j2, const Eliminate &function=EliminationTraitsType::DefaultEliminate) const
 
void saveGraph (const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
 

Protected Types

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

Protected Member Functions

Thisoperator= (const This &other)
 
Standard Constructors
 BayesTree ()
 
 BayesTree (const This &other)
 

Protected Attributes

Nodes nodes_
 
Roots roots_
 

Testable

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

Advanced Interface

template<class BAYESRTEE , class GRAPH >
class EliminatableClusterTree
 
class boost::serialization::access
 
void saveGraph (std::ostream &s, sharedClique clique, const KeyFormatter &keyFormatter, int parentnum=0) const
 
void getCliqueData (sharedClique clique, BayesTreeCliqueData *stats) const
 
void removeClique (sharedClique clique)
 
void fillNodesIndex (const sharedClique &subtree)
 
template<class CONTAINER >
Key findParentClique (const CONTAINER &parents) const
 
void clear ()
 
void deleteCachedShortcuts ()
 
void removePath (sharedClique clique, BayesNetType *bn, Cliques *orphans)
 
void removeTop (const KeyVector &keys, BayesNetType *bn, Cliques *orphans)
 
Cliques removeSubtree (const sharedClique &subtree)
 
void insertRoot (const sharedClique &subtree)
 
void addClique (const sharedClique &clique, const sharedClique &parent_clique=sharedClique())
 
void addFactorsToGraph (FactorGraph< FactorType > *graph) const
 
template<class ARCHIVE >
void serialize (ARCHIVE &ar, const unsigned int)
 

Detailed Description

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

Definition at line 64 of file BayesTree.h.

Member Typedef Documentation

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

Definition at line 77 of file BayesTree.h.

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

The clique type, normally BayesTreeClique.

Definition at line 71 of file BayesTree.h.

template<class CLIQUE>
typedef FastList<sharedClique> gtsam::BayesTree< CLIQUE >::Cliques

A convenience class for a list of shared cliques

Definition at line 87 of file BayesTree.h.

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

Definition at line 75 of file BayesTree.h.

template<class CLIQUE>
typedef FactorGraphType::Eliminate gtsam::BayesTree< CLIQUE >::Eliminate

Definition at line 83 of file BayesTree.h.

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

Definition at line 84 of file BayesTree.h.

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

Definition at line 81 of file BayesTree.h.

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

Definition at line 79 of file BayesTree.h.

template<class CLIQUE>
typedef Clique gtsam::BayesTree< CLIQUE >::Node

Synonym for Clique (TODO: remove)

Definition at line 73 of file BayesTree.h.

template<class CLIQUE>
typedef ConcurrentMap<Key, sharedClique> gtsam::BayesTree< CLIQUE >::Nodes

Map from keys to Clique

Definition at line 90 of file BayesTree.h.

template<class CLIQUE>
typedef FastVector<sharedClique> gtsam::BayesTree< CLIQUE >::Roots

Root cliques

Definition at line 93 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<This> gtsam::BayesTree< CLIQUE >::shared_ptr
protected

Definition at line 68 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<BayesNetType> gtsam::BayesTree< CLIQUE >::sharedBayesNet

Definition at line 78 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<Clique> gtsam::BayesTree< CLIQUE >::sharedClique

Shared pointer to a clique.

Definition at line 72 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<ConditionalType> gtsam::BayesTree< CLIQUE >::sharedConditional

Definition at line 76 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<FactorType> gtsam::BayesTree< CLIQUE >::sharedFactor

Definition at line 80 of file BayesTree.h.

template<class CLIQUE>
typedef boost::shared_ptr<FactorGraphType> gtsam::BayesTree< CLIQUE >::sharedFactorGraph

Definition at line 82 of file BayesTree.h.

template<class CLIQUE>
typedef sharedClique gtsam::BayesTree< CLIQUE >::sharedNode

Synonym for sharedClique (TODO: remove)

Definition at line 74 of file BayesTree.h.

template<class CLIQUE>
typedef BayesTree<CLIQUE> gtsam::BayesTree< CLIQUE >::This
protected

Definition at line 67 of file BayesTree.h.

Constructor & Destructor Documentation

template<class CLIQUE>
gtsam::BayesTree< CLIQUE >::BayesTree ( )
inlineprotected

Create an empty Bayes Tree

Definition at line 107 of file BayesTree.h.

template<class CLIQUE >
gtsam::BayesTree< CLIQUE >::BayesTree ( const This other)
protected

Copy constructor

Definition at line 161 of file BayesTree-inst.h.

Member Function Documentation

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::addClique ( const sharedClique clique,
const sharedClique parent_clique = sharedClique() 
)

add a clique (top down)

Definition at line 125 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::addFactorsToGraph ( FactorGraph< FactorType > *  graph) const

Add all cliques in this BayesTree to the specified factor graph

Definition at line 151 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::clear ( void  )

Remove all nodes

Definition at line 391 of file BayesTree-inst.h.

template<class CLIQUE>
const sharedClique& gtsam::BayesTree< CLIQUE >::clique ( Key  j) const
inline

alternate syntax for matlab: find the clique that contains the variable with Key j

Definition at line 150 of file BayesTree.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::deleteCachedShortcuts ( )

Clear all shortcut caches - use before timing on marginal calculation to avoid residual cache data

Definition at line 399 of file BayesTree-inst.h.

template<class CLIQUE>
bool gtsam::BayesTree< CLIQUE >::empty ( ) const
inline

Check if there are any cliques in the tree

Definition at line 136 of file BayesTree.h.

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

check equality

Definition at line 213 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::fillNodesIndex ( const sharedClique subtree)
protected

Fill the nodes index for a subtree

Definition at line 229 of file BayesTree-inst.h.

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.

Definition at line 221 of file BayesTree-inst.h.

template<class CLIQUE >
BayesTreeCliqueData gtsam::BayesTree< CLIQUE >::getCliqueData ( ) const

Gather data on all cliques

Definition at line 38 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::getCliqueData ( sharedClique  clique,
BayesTreeCliqueData stats 
) const
protected

Gather data on a single clique

Definition at line 46 of file BayesTree-inst.h.

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.

Definition at line 243 of file BayesTree-inst.h.

template<class CLIQUE >
BayesTree< CLIQUE >::sharedFactorGraph gtsam::BayesTree< CLIQUE >::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

Definition at line 276 of file BayesTree-inst.h.

template<class CLIQUE >
BayesTree< CLIQUE >::sharedBayesNet gtsam::BayesTree< CLIQUE >::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

Definition at line 285 of file BayesTree-inst.h.

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.

Definition at line 253 of file BayesTree-inst.h.

template<class CLIQUE>
const Nodes& gtsam::BayesTree< CLIQUE >::nodes ( ) const
inline

return nodes

Definition at line 141 of file BayesTree.h.

template<class CLIQUE >
size_t gtsam::BayesTree< CLIQUE >::numCachedSeparatorMarginals ( ) const

Collect number of cliques with cached separator marginals

Definition at line 58 of file BayesTree-inst.h.

template<class CLIQUE >
BayesTree< CLIQUE > & gtsam::BayesTree< CLIQUE >::operator= ( const This other)
protected

Assignment operator

Definition at line 182 of file BayesTree-inst.h.

template<class CLIQUE>
const sharedNode gtsam::BayesTree< CLIQUE >::operator[] ( Key  j) const
inline

Access node by variable

Definition at line 144 of file BayesTree.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const

print

Definition at line 195 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::removeClique ( sharedClique  clique)
protected

remove a clique: warning, can result in a forest

Definition at line 407 of file BayesTree-inst.h.

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.

Definition at line 431 of file BayesTree-inst.h.

template<class CLIQUE >
BayesTree< CLIQUE >::Cliques gtsam::BayesTree< CLIQUE >::removeSubtree ( const sharedClique subtree)

Remove the requested subtree.

Definition at line 479 of file BayesTree-inst.h.

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.

Definition at line 458 of file BayesTree-inst.h.

template<class CLIQUE>
const Roots& gtsam::BayesTree< CLIQUE >::roots ( ) const
inline

return root cliques

Definition at line 147 of file BayesTree.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::saveGraph ( const std::string &  s,
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const

Read only with side effectssaves the Tree to a text file in GraphViz format

Definition at line 67 of file BayesTree-inst.h.

template<class CLIQUE >
void gtsam::BayesTree< CLIQUE >::saveGraph ( std::ostream &  s,
sharedClique  clique,
const KeyFormatter keyFormatter,
int  parentnum = 0 
) const
protected

private helper method for saving the Tree to a text file in GraphViz format

Definition at line 79 of file BayesTree-inst.h.

template<class CLIQUE>
template<class ARCHIVE >
void gtsam::BayesTree< CLIQUE >::serialize ( ARCHIVE &  ar,
const unsigned  int 
)
inlineprivate

Definition at line 256 of file BayesTree.h.

template<class CLIQUE >
size_t gtsam::BayesTree< CLIQUE >::size ( ) const

number of cliques

Definition at line 116 of file BayesTree-inst.h.

Friends And Related Function Documentation

template<class CLIQUE>
friend class boost::serialization::access
friend

Serialization function

Definition at line 254 of file BayesTree.h.

template<class CLIQUE>
template<class BAYESRTEE , class GRAPH >
friend class EliminatableClusterTree
friend

Definition at line 250 of file BayesTree.h.

Member Data Documentation

template<class CLIQUE>
Nodes gtsam::BayesTree< CLIQUE >::nodes_
protected

Map from indices to Clique

Definition at line 98 of file BayesTree.h.

template<class CLIQUE>
Roots gtsam::BayesTree< CLIQUE >::roots_
protected

Root cliques

Definition at line 101 of file BayesTree.h.


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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:58:03