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 
30 #include <functional>
31 #include <optional>
32 
33 namespace gtsam {
34 
35 // Forward declarations
36 class HybridGaussianFactorGraph;
37 class HybridConditional;
38 class HybridBayesNet;
39 class HybridEliminationTree;
40 class HybridBayesTree;
41 class HybridJunctionTree;
42 class DecisionTreeFactor;
43 class JacobianFactor;
44 class HybridValues;
45 
54 GTSAM_EXPORT
55 std::pair<std::shared_ptr<HybridConditional>, std::shared_ptr<Factor>>
56 EliminateHybrid(const HybridGaussianFactorGraph& factors, const Ordering& keys);
57 
64 GTSAM_EXPORT const Ordering
65 HybridOrdering(const HybridGaussianFactorGraph& graph);
66 
67 /* ************************************************************************* */
68 template <>
70  typedef Factor FactorType;
73  typedef HybridConditional
76  typedef HybridBayesNet
78  typedef HybridEliminationTree
82  static std::pair<std::shared_ptr<ConditionalType>,
84  std::shared_ptr<FactorType>>
86  return EliminateHybrid(factors, keys);
87  }
90  const FactorGraphType& graph,
91  std::optional<std::reference_wrapper<const VariableIndex>>) {
92  return HybridOrdering(graph);
93  }
94 };
95 
103 class GTSAM_EXPORT HybridGaussianFactorGraph
104  : public HybridFactorGraph,
105  public EliminateableFactorGraph<HybridGaussianFactorGraph> {
106  protected:
108  template <typename FACTOR>
109  using IsGaussian = typename std::enable_if<
111 
112  public:
115  using BaseEliminateable =
117  using shared_ptr = std::shared_ptr<This>;
118 
120  using Indices = KeyVector;
121 
124 
126  HybridGaussianFactorGraph() = default;
127 
133  template <class DERIVEDFACTOR>
135  : Base(graph) {}
136 
140 
141  // TODO(dellaert): customize print and equals.
142  // void print(const std::string& s = "HybridGaussianFactorGraph",
143  // const KeyFormatter& keyFormatter = DefaultKeyFormatter) const
144  // override;
145  // bool equals(const This& fg, double tol = 1e-9) const override;
146 
150 
151  using Base::error; // Expose error(const HybridValues&) method..
152 
162  AlgebraicDecisionTree<Key> error(const VectorValues& continuousValues) const;
163 
172  AlgebraicDecisionTree<Key> probPrime(
173  const VectorValues& continuousValues) const;
174 
181  double probPrime(const HybridValues& values) const;
182 
192  GaussianFactorGraphTree assembleGraphTree() const;
193 
195 };
196 
197 } // namespace gtsam
A set of GaussianFactors, indexed by a set of discrete keys.
typename std::enable_if< std::is_base_of< GaussianFactor, FACTOR >::value >::type IsGaussian
Check if FACTOR type is derived from GaussianFactor.
static std::pair< std::shared_ptr< ConditionalType >, std::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Variable elimination algorithms for factor graphs.
A factor with a quadratic error function - a Gaussian.
leaf::MyValues values
const Ordering HybridOrdering(const HybridGaussianFactorGraph &graph)
Return a Colamd constrained ordering where the discrete keys are eliminated after the continuous keys...
const GaussianFactorGraph factors
HybridEliminationTree EliminationTreeType
Type of elimination tree.
NonlinearFactorGraph graph
Factor Graph Values.
std::shared_ptr< This > shared_ptr
shared_ptr to This
traits
Definition: chartTesting.h:28
std::pair< HybridConditional::shared_ptr, std::shared_ptr< Factor > > EliminateHybrid(const HybridGaussianFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for HybridGaussianFactorGraph.
std::vector< float > Values
Factor Graph Base Class.
static Ordering DefaultOrderingFunc(const FactorGraphType &graph, std::optional< std::reference_wrapper< const VariableIndex >>)
The default ordering generation function.
static double error
Definition: testRot3.cpp:37
Factor graph with utilities for hybrid factors.
const KeyVector keys
HybridGaussianFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
HybridBayesNet BayesNetType
Type of Bayes net from sequential elimination.
HybridConditional ConditionalType
Type of conditionals from elimination.


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:20