gtsam 4.2.0
gtsam
Loading...
Searching...
No Matches
HybridGaussianFactorGraph.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
19#pragma once
20
29
30namespace gtsam {
31
32// Forward declarations
33class HybridGaussianFactorGraph;
34class HybridConditional;
35class HybridBayesNet;
36class HybridEliminationTree;
37class HybridBayesTree;
38class HybridJunctionTree;
39class DecisionTreeFactor;
40class JacobianFactor;
41class HybridValues;
42
51GTSAM_EXPORT
52std::pair<boost::shared_ptr<HybridConditional>, boost::shared_ptr<Factor>>
53EliminateHybrid(const HybridGaussianFactorGraph& factors, const Ordering& keys);
54
61GTSAM_EXPORT const Ordering
62HybridOrdering(const HybridGaussianFactorGraph& graph);
63
64/* ************************************************************************* */
65template <>
71 typedef HybridConditional
73 typedef HybridBayesNet
80 static std::pair<boost::shared_ptr<ConditionalType>,
81 boost::shared_ptr<FactorType>>
82 DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
83 return EliminateHybrid(factors, keys);
84 }
87 const FactorGraphType& graph,
88 boost::optional<const VariableIndex&> variableIndex) {
89 return HybridOrdering(graph);
90 }
91};
92
101 : public HybridFactorGraph,
102 public EliminateableFactorGraph<HybridGaussianFactorGraph> {
103 protected:
105 template <typename FACTOR>
106 using IsGaussian = typename std::enable_if<
107 std::is_base_of<GaussianFactor, FACTOR>::value>::type;
108
109 public:
110 using Base = HybridFactorGraph;
114 using shared_ptr = boost::shared_ptr<This>;
115
118
121
124
130 template <class DERIVEDFACTOR>
133
137
138 // TODO(dellaert): customize print and equals.
139 // void print(const std::string& s = "HybridGaussianFactorGraph",
140 // const KeyFormatter& keyFormatter = DefaultKeyFormatter) const
141 // override;
142 // bool equals(const This& fg, double tol = 1e-9) const override;
143
147
148 using Base::error; // Expose error(const HybridValues&) method..
149
159 AlgebraicDecisionTree<Key> error(const VectorValues& continuousValues) const;
160
170 const VectorValues& continuousValues) const;
171
178 double probPrime(const HybridValues& values) const;
179
189 GaussianFactorGraphTree assembleGraphTree() const;
190
192};
193
194} // namespace gtsam
A set of GaussianFactors, indexed by a set of discrete keys.
Factor graph with utilities for hybrid factors.
Variable elimination algorithms for factor graphs.
Factor Graph Base Class.
Variable ordering for the elimination algorithm.
A factor with a quadratic error function - a Gaussian.
Factor Graph Values.
std::pair< HybridConditional::shared_ptr, boost::shared_ptr< Factor > > EliminateHybrid(const HybridGaussianFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for HybridGaussianFactorGraph.
Definition HybridGaussianFactorGraph.cpp:320
Global functions in a separate testing namespace.
Definition chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:86
const Ordering HybridOrdering(const HybridGaussianFactorGraph &graph)
Return a Colamd constrained ordering where the discrete keys are eliminated after the continuous keys...
Definition HybridGaussianFactorGraph.cpp:72
An algebraic decision tree fixes the range of a DecisionTree to double.
Definition AlgebraicDecisionTree.h:38
a decision tree is a function from assignments to values.
Definition DecisionTree.h:61
A hybrid Bayes net is a collection of HybridConditionals, which can have discrete conditionals,...
Definition HybridBayesNet.h:35
A Bayes tree representing a Hybrid density.
Definition HybridBayesTree.h:64
Hybrid Conditional Density.
Definition HybridConditional.h:62
Elimination Tree type for Hybrid Factor Graphs.
Definition HybridEliminationTree.h:32
Hybrid Factor Graph Factor graph with utilities for hybrid factors.
Definition HybridFactorGraph.h:39
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Definition HybridGaussianFactorGraph.h:82
HybridConditional ConditionalType
Type of conditionals from elimination.
Definition HybridGaussianFactorGraph.h:72
HybridGaussianFactorGraph FactorGraphType
Type of the factor graph (e.g.
Definition HybridGaussianFactorGraph.h:69
HybridJunctionTree JunctionTreeType
Type of Junction tree.
Definition HybridGaussianFactorGraph.h:78
HybridEliminationTree EliminationTreeType
Type of elimination tree.
Definition HybridGaussianFactorGraph.h:76
static Ordering DefaultOrderingFunc(const FactorGraphType &graph, boost::optional< const VariableIndex & > variableIndex)
The default ordering generation function.
Definition HybridGaussianFactorGraph.h:86
Factor FactorType
Type of factors in factor graph.
Definition HybridGaussianFactorGraph.h:67
HybridBayesTree BayesTreeType
Type of Bayes tree.
Definition HybridGaussianFactorGraph.h:77
HybridBayesNet BayesNetType
Type of Bayes net from sequential elimination.
Definition HybridGaussianFactorGraph.h:74
Definition HybridGaussianFactorGraph.h:102
boost::shared_ptr< This > shared_ptr
shared_ptr to This
Definition HybridGaussianFactorGraph.h:114
typename std::enable_if< std::is_base_of< GaussianFactor, FACTOR >::value >::type IsGaussian
Check if FACTOR type is derived from GaussianFactor.
Definition HybridGaussianFactorGraph.h:107
KeyVector Indices
map from keys to values
Definition HybridGaussianFactorGraph.h:117
EliminateableFactorGraph< This > BaseEliminateable
for elimination
Definition HybridGaussianFactorGraph.h:113
HybridGaussianFactorGraph()=default
Default constructor.
HybridGaussianFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition HybridGaussianFactorGraph.h:131
An EliminatableClusterTree, i.e., a set of variable clusters with factors, arranged in a tree,...
Definition HybridJunctionTree.h:53
HybridValues represents a collection of DiscreteValues and VectorValues.
Definition HybridValues.h:38
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 Factor.h:68
Definition Ordering.h:34
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:74
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65
the error.
In Gaussian factors, the error function returns either the negative log-likelihood,...