BayesNet.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 
22 
23 #include <memory>
24 #include <string>
25 
26 namespace gtsam {
27 
28 class HybridValues;
29 
34 template <class CONDITIONAL>
35 class BayesNet : public FactorGraph<CONDITIONAL> {
36  private:
38 
39  public:
40  typedef typename std::shared_ptr<CONDITIONAL>
42 
43  protected:
46 
48  BayesNet() {}
49 
51  template <typename ITERATOR>
52  BayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
53  : Base(firstConditional, lastConditional) {}
54 
60  BayesNet(std::initializer_list<sharedConditional> conditionals)
61  : Base(conditionals) {}
62 
64 
65  public:
68 
70  void print(
71  const std::string& s = "BayesNet",
72  const KeyFormatter& formatter = DefaultKeyFormatter) const override;
73 
77 
79  void dot(std::ostream& os,
80  const KeyFormatter& keyFormatter = DefaultKeyFormatter,
81  const DotWriter& writer = DotWriter()) const;
82 
84  std::string dot(const KeyFormatter& keyFormatter = DefaultKeyFormatter,
85  const DotWriter& writer = DotWriter()) const;
86 
88  void saveGraph(const std::string& filename,
89  const KeyFormatter& keyFormatter = DefaultKeyFormatter,
90  const DotWriter& writer = DotWriter()) const;
91 
95 
96  // Expose HybridValues version of logProbability.
97  double logProbability(const HybridValues& x) const;
98 
99  // Expose HybridValues version of evaluate.
100  double evaluate(const HybridValues& c) const;
101 
103 };
104 
105 } // namespace gtsam
106 
gtsam::HybridValues
Definition: HybridValues.h:37
gtsam::BayesNet
Definition: BayesNet.h:35
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::BayesNet::print
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
Definition: BayesNet-inst.h:31
gtsam::BayesNet::evaluate
double evaluate(const HybridValues &c) const
Definition: BayesNet-inst.h:104
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
gtsam::BayesNet::dot
void dot(std::ostream &os, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
Output to graphviz format, stream version.
Definition: BayesNet-inst.h:45
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
formatter
const KeyFormatter & formatter
Definition: treeTraversal-inst.h:204
HybridValues
os
ofstream os("timeSchurFactors.csv")
gtsam::BayesNet::BayesNet
BayesNet(std::initializer_list< sharedConditional > conditionals)
Definition: BayesNet.h:60
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::BayesNet::BayesNet
BayesNet()
Definition: BayesNet.h:48
gtsam::BayesNet::Base
FactorGraph< CONDITIONAL > Base
Definition: BayesNet.h:37
relicense.filename
filename
Definition: relicense.py:57
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::BayesNet::BayesNet
BayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Definition: BayesNet.h:52
gtsam::BayesNet::saveGraph
void saveGraph(const std::string &filename, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
output to file with graphviz format.
Definition: BayesNet-inst.h:84
gtsam
traits
Definition: SFMdata.h:40
gtsam::BayesNet::logProbability
double logProbability(const HybridValues &x) const
Definition: BayesNet-inst.h:94
FactorGraph.h
Factor Graph Base Class.
BayesNet-inst.h
gtsam::BayesNet::sharedConditional
std::shared_ptr< CONDITIONAL > sharedConditional
A shared pointer to a conditional.
Definition: BayesNet.h:41
gtsam::DotWriter
DotWriter is a helper class for writing graphviz .dot files.
Definition: DotWriter.h:36


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:54