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) {
54  push_back(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
Typedefs for easier changing of types.
GTSAM_EXPORT void print(const std::string &s="SymbolicBayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
GTSAM_EXPORT bool equals(const This &bn, double tol=1e-9) const
std::string serialize(const T &input)
serializes to a string
SymbolicBayesNet(SymbolicConditional &&c)
Construct from a single conditional.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition: FactorGraph.h:190
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
NonlinearFactorGraph graph
Bayes network.
static const KeyFormatter DefaultKeyFormatter
Definition: Key.h:43
const KeyFormatter & formatter
std::shared_ptr< ConditionalType > sharedConditional
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
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
traits
Definition: chartTesting.h:28
SymbolicConditional ConditionalType
std::shared_ptr< This > shared_ptr
Factor Graph Base Class.
SymbolicBayesNet(std::initializer_list< std::shared_ptr< SymbolicConditional >> conditionals)
const std::vector< GaussianConditional::shared_ptr > conditionals
const G double tol
Definition: Group.h:86
BayesNet< SymbolicConditional > Base
SymbolicBayesNet(const CONTAINER &conditionals)
SymbolicBayesNet & operator()(SymbolicConditional &&c)
Add a single conditional and return a reference. This allows for chaining, e.g., SymbolicBayesNet bn ...
SymbolicBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
SymbolicBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
Definition: BayesNet-inst.h:31


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