SymbolicFactorGraph.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 
24 #include <gtsam/base/types.h>
25 
26 namespace gtsam {
27 
28  class SymbolicFactorGraph;
29  class SymbolicConditional;
30  class SymbolicBayesNet;
31  class SymbolicEliminationTree;
32  class SymbolicBayesTree;
33  class SymbolicJunctionTree;
34 
35  /* ************************************************************************* */
37  {
45  static std::pair<boost::shared_ptr<ConditionalType>, boost::shared_ptr<FactorType> >
47  DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
48  return EliminateSymbolic(factors, keys); }
49  };
50 
51  /* ************************************************************************* */
55  class GTSAM_EXPORT SymbolicFactorGraph :
56  public FactorGraph<SymbolicFactor>,
57  public EliminateableFactorGraph<SymbolicFactorGraph>
58  {
59  public:
60 
64  typedef boost::shared_ptr<This> shared_ptr;
65 
68 
71 
73  template<typename ITERATOR>
74  SymbolicFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor) : Base(firstFactor, lastFactor) {}
75 
77  template<class CONTAINER>
78  explicit SymbolicFactorGraph(const CONTAINER& factors) : Base(factors) {}
79 
81  template<class DERIVEDFACTOR>
83 
85  virtual ~SymbolicFactorGraph() {}
86 
88 
91 
92  bool equals(const This& fg, double tol = 1e-9) const;
93 
95  void print(
96  const std::string& s = "SymbolicFactorGraph",
97  const KeyFormatter& formatter = DefaultKeyFormatter) const override {
99  }
100 
102 
105 
107  void push_factor(Key key);
108 
110  void push_factor(Key key1, Key key2);
111 
113  void push_factor(Key key1, Key key2, Key key3);
114 
116  void push_factor(Key key1, Key key2, Key key3, Key key4);
117 
119 
120  private:
122  friend class boost::serialization::access;
123  template<class ARCHIVE>
124  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
125  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
126  }
127  };
128 
130 template<>
131 struct traits<SymbolicFactorGraph> : public Testable<SymbolicFactorGraph> {
132 };
133 
134 } //\ namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
Typedefs for easier changing of types.
virtual ~SymbolicFactorGraph()
Destructor.
SymbolicFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Variable elimination algorithms for factor graphs.
SymbolicBayesNet BayesNetType
Type of Bayes net from sequential elimination.
SymbolicFactorGraph FactorGraphType
Type of the factor graph (e.g. GaussianFactorGraph)
SymbolicFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor)
GaussianFactorGraph factors(list_of(factor1)(factor2)(factor3))
NonlinearFactorGraph graph
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
FactorGraph< SymbolicFactor > Base
Typedef to base factor graph type.
const KeyFormatter & formatter
const Symbol key1('v', 1)
SymbolicFactor FactorType
Type of factors in factor graph.
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
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
void serialize(ARCHIVE &ar, const unsigned int)
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
traits
Definition: chartTesting.h:28
SymbolicConditional ConditionalType
Type of conditionals from elimination.
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
const Symbol key3('v', 3)
const Symbol key2('v', 2)
Factor Graph Base Class.
const Symbol key4('v', 4)
EliminateableFactorGraph< This > BaseEliminateable
Typedef to base elimination class.
const G double tol
Definition: Group.h:83
SymbolicFactorGraph This
Typedef to this class.
const KeyVector keys
void print(const std::string &s="SymbolicFactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
SymbolicFactorGraph(const CONTAINER &factors)
SymbolicBayesTree BayesTreeType
Type of Bayes tree.
std::pair< boost::shared_ptr< SymbolicConditional >, boost::shared_ptr< SymbolicFactor > > EliminateSymbolic(const SymbolicFactorGraph &factors, const Ordering &keys)
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
SymbolicEliminationTree EliminationTreeType
Type of elimination tree.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:45:07