gtsam  4.1.0
gtsam
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 
88 
89  bool equals(const This& fg, double tol = 1e-9) const;
90 
92 
95 
97  void push_factor(Key key);
98 
100  void push_factor(Key key1, Key key2);
101 
103  void push_factor(Key key1, Key key2, Key key3);
104 
106  void push_factor(Key key1, Key key2, Key key3, Key key4);
107 
109 
110  private:
112  friend class boost::serialization::access;
113  template<class ARCHIVE>
114  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
115  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
116  }
117  };
118 
120 template<>
121 struct traits<SymbolicFactorGraph> : public Testable<SymbolicFactorGraph> {
122 };
123 
124 } //\ namespace gtsam
gtsam::SymbolicBayesNet
Symbolic Bayes Net.
Definition: SymbolicBayesNet.h:30
gtsam::SymbolicFactorGraph::Base
FactorGraph< SymbolicFactor > Base
Typedef to base factor graph type.
Definition: SymbolicFactorGraph.h:62
gtsam::equals
Template to create a binary predicate.
Definition: Testable.h:110
gtsam::Ordering
Definition: Ordering.h:34
gtsam::EliminateableFactorGraph
EliminateableFactorGraph is a base class for factor graphs that contains elimination algorithms.
Definition: EliminateableFactorGraph.h:57
EliminateableFactorGraph.h
Variable elimination algorithms for factor graphs.
gtsam::SymbolicFactorGraph::shared_ptr
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: SymbolicFactorGraph.h:64
gtsam::EliminationTraits< SymbolicFactorGraph >::BayesTreeType
SymbolicBayesTree BayesTreeType
Type of Bayes tree.
Definition: SymbolicFactorGraph.h:43
gtsam::traits
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
gtsam::SymbolicConditional
SymbolicConditional is a conditional with keys but no probability data, produced by symbolic eliminat...
Definition: SymbolicConditional.h:38
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
gtsam::SymbolicFactorGraph::BaseEliminateable
EliminateableFactorGraph< This > BaseEliminateable
Typedef to base elimination class.
Definition: SymbolicFactorGraph.h:63
gtsam::EliminateSymbolic
std::pair< boost::shared_ptr< SymbolicConditional >, boost::shared_ptr< SymbolicFactor > > EliminateSymbolic(const SymbolicFactorGraph &factors, const Ordering &keys)
Dense elimination function for symbolic factors.
Definition: SymbolicFactor.cpp:31
gtsam::EliminationTraits< SymbolicFactorGraph >::JunctionTreeType
SymbolicJunctionTree JunctionTreeType
Type of Junction tree.
Definition: SymbolicFactorGraph.h:44
SymbolicFactor.h
gtsam::serialize
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:100
gtsam::SymbolicEliminationTree
Definition: SymbolicEliminationTree.h:29
types.h
Typedefs for easier changing of types.
FactorGraph.h
Factor Graph Base Class.
gtsam::SymbolicFactorGraph::This
SymbolicFactorGraph This
Typedef to this class.
Definition: SymbolicFactorGraph.h:61
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::EliminationTraits< SymbolicFactorGraph >::DefaultEliminate
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Definition: SymbolicFactorGraph.h:47
gtsam::SymbolicBayesTree
A Bayes tree that represents the connectivity between variables but is not associated with any probab...
Definition: SymbolicBayesTree.h:51
gtsam::SymbolicFactorGraph::SymbolicFactorGraph
SymbolicFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition: SymbolicFactorGraph.h:82
gtsam::Testable
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
gtsam::FactorGraph
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition: FactorGraph.h:94
gtsam::SymbolicFactor
SymbolicFactor represents a symbolic factor that specifies graph topology but is not associated with ...
Definition: SymbolicFactor.h:39
gtsam::SymbolicFactorGraph::SymbolicFactorGraph
SymbolicFactorGraph()
Construct empty factor graph.
Definition: SymbolicFactorGraph.h:70
gtsam::SymbolicJunctionTree
Definition: SymbolicJunctionTree.h:49
gtsam::SymbolicFactorGraph::SymbolicFactorGraph
SymbolicFactorGraph(ITERATOR firstFactor, ITERATOR lastFactor)
Construct from iterator over factors.
Definition: SymbolicFactorGraph.h:74
gtsam::EliminationTraits< SymbolicFactorGraph >::BayesNetType
SymbolicBayesNet BayesNetType
Type of Bayes net from sequential elimination.
Definition: SymbolicFactorGraph.h:41
gtsam::EliminationTraits< SymbolicFactorGraph >::EliminationTreeType
SymbolicEliminationTree EliminationTreeType
Type of elimination tree.
Definition: SymbolicFactorGraph.h:42
gtsam::EliminationTraits< SymbolicFactorGraph >::ConditionalType
SymbolicConditional ConditionalType
Type of conditionals from elimination.
Definition: SymbolicFactorGraph.h:40
gtsam::SymbolicFactorGraph::SymbolicFactorGraph
SymbolicFactorGraph(const CONTAINER &factors)
Construct from container of factors (shared_ptr or plain objects)
Definition: SymbolicFactorGraph.h:78
gtsam::EliminationTraits
Traits class for eliminateable factor graphs, specifies the types that result from elimination,...
Definition: EliminateableFactorGraph.h:36
gtsam::EliminationTraits< SymbolicFactorGraph >::FactorType
SymbolicFactor FactorType
Type of factors in factor graph.
Definition: SymbolicFactorGraph.h:38
gtsam::SymbolicFactorGraph
Symbolic Factor Graph.
Definition: SymbolicFactorGraph.h:58
gtsam::EliminationTraits< SymbolicFactorGraph >::FactorGraphType
SymbolicFactorGraph FactorGraphType
Type of the factor graph (e.g. GaussianFactorGraph)
Definition: SymbolicFactorGraph.h:39