28#include <boost/make_shared.hpp>
36class DiscreteFactorGraph;
37class DiscreteConditional;
38class DiscreteBayesNet;
39class DiscreteEliminationTree;
40class DiscreteBayesTree;
41class DiscreteJunctionTree;
51GTSAM_EXPORT std::pair<boost::shared_ptr<DiscreteConditional>, DecisionTreeFactor::shared_ptr>
65 static std::pair<boost::shared_ptr<ConditionalType>,
66 boost::shared_ptr<FactorType> >
73 boost::optional<const VariableIndex&> variableIndex) {
102 template <
typename ITERATOR>
104 :
Base(firstFactor, lastFactor) {}
107 template <
class CONTAINER>
112 template <
class DERIVEDFACTOR>
121 bool equals(
const This& fg,
double tol = 1e-9)
const;
126 template <
typename... Args>
127 void add(Args&&... args) {
128 emplace_shared<DecisionTreeFactor>(std::forward<Args>(args)...);
148 const std::string& s =
"DiscreteFactorGraph",
149 const KeyFormatter& formatter = DefaultKeyFormatter)
const override;
158 OptionalOrderingType orderingType = boost::none)
const;
175 OptionalOrderingType orderingType = boost::none)
const;
192 OptionalOrderingType orderingType = boost::none)
const;
234std::pair<DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr>
235EliminateForMPE(
const DiscreteFactorGraph& factors,
236 const Ordering& frontalKeys);
A thin wrapper around std::set that uses boost's fast_pool_allocator.
Variable ordering for the elimination algorithm.
Variable elimination algorithms for factor graphs.
std::pair< DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr > EliminateDiscrete(const DiscreteFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for DiscreteFactorGraph.
Definition: DiscreteFactorGraph.cpp:200
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
string html(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of html.
Definition: DiscreteValues.cpp:134
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown.
Definition: DiscreteValues.cpp:129
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:155
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:156
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Template to create a binary predicate.
Definition: Testable.h:111
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:151
A discrete probabilistic factor.
Definition: DecisionTreeFactor.h:45
A Bayes net made from discrete conditional distributions.
Definition: DiscreteBayesNet.h:38
A Bayes tree representing a Discrete density.
Definition: DiscreteBayesTree.h:70
Discrete Conditional Density Derives from DecisionTreeFactor.
Definition: DiscreteConditional.h:40
Elimination tree for discrete factors.
Definition: DiscreteEliminationTree.h:33
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:38
DiscreteValues::Names Names
Translation table from values to strings.
Definition: DiscreteFactor.h:106
DiscreteFactorGraph FactorGraphType
Type of the factor graph (e.g. DiscreteFactorGraph)
Definition: DiscreteFactorGraph.h:58
DiscreteJunctionTree JunctionTreeType
Type of Junction tree.
Definition: DiscreteFactorGraph.h:63
DiscreteFactor FactorType
Type of factors in factor graph.
Definition: DiscreteFactorGraph.h:57
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Definition: DiscreteFactorGraph.h:67
DiscreteBayesTree BayesTreeType
Type of Bayes tree.
Definition: DiscreteFactorGraph.h:62
DiscreteBayesNet BayesNetType
Type of Bayes net from sequential elimination.
Definition: DiscreteFactorGraph.h:60
DiscreteConditional ConditionalType
Type of conditionals from elimination.
Definition: DiscreteFactorGraph.h:59
static Ordering DefaultOrderingFunc(const FactorGraphType &graph, boost::optional< const VariableIndex & > variableIndex)
The default ordering generation function.
Definition: DiscreteFactorGraph.h:71
DiscreteEliminationTree EliminationTreeType
Type of elimination tree.
Definition: DiscreteFactorGraph.h:61
A Discrete Factor Graph is a factor graph where all factors are Discrete, i.e.
Definition: DiscreteFactorGraph.h:86
DiscreteFactorGraph(const CONTAINER &factors)
Construct from container of factors (shared_ptr or plain objects)
Definition: DiscreteFactorGraph.h:108
boost::shared_ptr< This > shared_ptr
shared_ptr to This
Definition: DiscreteFactorGraph.h:92
DiscreteFactorGraph()
map from keys to values
Definition: DiscreteFactorGraph.h:99
DiscreteFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: DiscreteFactorGraph.h:113
DiscreteFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor)
Construct from iterator over factors.
Definition: DiscreteFactorGraph.h:103
virtual ~DiscreteFactorGraph()
Destructor.
Definition: DiscreteFactorGraph.h:116
void add(Args &&... args)
Add a decision-tree factor.
Definition: DiscreteFactorGraph.h:127
An EliminatableClusterTree, i.e., a set of variable clusters with factors, arranged in a tree,...
Definition: DiscreteJunctionTree.h:52
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:39
A DAG made from lookup tables, as defined above.
Definition: DiscreteLookupDAG.h:77
A map from keys to values.
Definition: DiscreteValues.h:34
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:97
Traits class for eliminateable factor graphs, specifies the types that result from elimination,...
Definition: EliminateableFactorGraph.h:36
EliminateableFactorGraph is a base class for factor graphs that contains elimination algorithms.
Definition: EliminateableFactorGraph.h:57
Definition: Ordering.h:34
static Ordering Colamd(const FACTOR_GRAPH &graph)
Compute a fill-reducing ordering using COLAMD from a factor graph (see details for note on performanc...
Definition: Ordering.h:95