SymbolicBayesNet.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 
32  class SymbolicBayesNet : public BayesNet<SymbolicConditional> {
33  public:
37  typedef std::shared_ptr<This> shared_ptr;
38  typedef std::shared_ptr<ConditionalType> sharedConditional;
39 
42 
45 
47  template <typename ITERATOR>
48  SymbolicBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
49  : Base(firstConditional, lastConditional) {}
50 
52  template <class CONTAINER>
53  explicit SymbolicBayesNet(const CONTAINER& conditionals) {
55  }
56 
59  template <class DERIVEDCONDITIONAL>
61  : Base(graph) {}
62 
67  SymbolicBayesNet(std::initializer_list<std::shared_ptr<SymbolicConditional>> conditionals)
68  : Base(conditionals) {}
69 
72  emplace_shared<SymbolicConditional>(c);
73  }
74 
82  emplace_shared<SymbolicConditional>(c);
83  return *this;
84  }
85 
87 
90 
92  GTSAM_EXPORT bool equals(const This& bn, double tol = 1e-9) const;
93 
95  GTSAM_EXPORT void print(
96  const std::string& s = "SymbolicBayesNet",
97  const KeyFormatter& formatter = DefaultKeyFormatter) const override {
99  }
100 
102 
103  private:
104 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
105 
106  friend class boost::serialization::access;
107  template<class ARCHIVE>
108  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
109  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
110  }
111 #endif
112 };
113 
115  template<>
116  struct traits<SymbolicBayesNet> : public Testable<SymbolicBayesNet> {
117  };
118 
119 } //\ namespace gtsam
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(const CONTAINER &conditionals)
Definition: SymbolicBayesNet.h:53
gtsam::BayesNet
Definition: BayesNet.h:35
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::BayesNet< SymbolicConditional >::print
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
Definition: BayesNet-inst.h:31
types.h
Typedefs for easier changing of types.
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(std::initializer_list< std::shared_ptr< SymbolicConditional >> conditionals)
Definition: SymbolicBayesNet.h:67
gtsam::SymbolicBayesNet::equals
GTSAM_EXPORT bool equals(const This &bn, double tol=1e-9) const
Definition: SymbolicBayesNet.cpp:28
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Definition: SymbolicBayesNet.h:60
SymbolicConditional.h
equal_constants::conditionals
const std::vector< GaussianConditional::shared_ptr > conditionals
Definition: testHybridGaussianConditional.cpp:53
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
gtsam::FactorGraph
Definition: BayesTree.h:34
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet()
Definition: SymbolicBayesNet.h:44
gtsam::SymbolicBayesNet::sharedConditional
std::shared_ptr< ConditionalType > sharedConditional
Definition: SymbolicBayesNet.h:38
gtsam::KeyFormatter
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
gtsam::SymbolicBayesNet::ConditionalType
SymbolicConditional ConditionalType
Definition: SymbolicBayesNet.h:36
gtsam::SymbolicBayesNet::print
GTSAM_EXPORT void print(const std::string &s="SymbolicBayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
Definition: SymbolicBayesNet.h:95
gtsam::SymbolicBayesNet::Base
BayesNet< SymbolicConditional > Base
Definition: SymbolicBayesNet.h:34
BayesNet.h
Bayes network.
gtsam::SymbolicConditional
Definition: SymbolicConditional.h:36
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(SymbolicConditional &&c)
Construct from a single conditional.
Definition: SymbolicBayesNet.h:71
gtsam
traits
Definition: SFMdata.h:40
gtsam::Testable
Definition: Testable.h:152
gtsam::SymbolicBayesNet::shared_ptr
std::shared_ptr< This > shared_ptr
Definition: SymbolicBayesNet.h:37
gtsam::traits
Definition: Group.h:36
FactorGraph.h
Factor Graph Base Class.
gtsam::FactorGraph< SymbolicConditional >::push_back
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition: FactorGraph.h:147
gtsam::SymbolicBayesNet::operator()
SymbolicBayesNet & operator()(SymbolicConditional &&c)
Add a single conditional and return a reference. This allows for chaining, e.g., SymbolicBayesNet bn ...
Definition: SymbolicBayesNet.h:81
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Definition: SymbolicBayesNet.h:48
Base
Definition: test_virtual_functions.cpp:156
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
gtsam::SymbolicBayesNet
Definition: SymbolicBayesNet.h:32
gtsam::SymbolicBayesNet::This
SymbolicBayesNet This
Definition: SymbolicBayesNet.h:35


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:05:21