Loading...
Searching...
No Matches
BayesNet.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/inference/FactorGraph.h>
#include <boost/shared_ptr.hpp>
#include <string>
namespace gtsam {
class HybridValues;
template <class CONDITIONAL>
class BayesNet : public FactorGraph<CONDITIONAL> {
private:
typedef FactorGraph<CONDITIONAL> Base;
public:
typedef typename boost::shared_ptr<CONDITIONAL>
sharedConditional;
protected:
BayesNet() {}
template <typename ITERATOR>
BayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
: Base(firstConditional, lastConditional) {}
BayesNet(std::initializer_list<sharedConditional> conditionals)
: Base(conditionals) {}
public:
void print(
const std::string& s = "BayesNet",
const KeyFormatter& formatter = DefaultKeyFormatter) const override;
void dot(std::ostream& os,
const KeyFormatter& keyFormatter = DefaultKeyFormatter,
const DotWriter& writer = DotWriter()) const;
std::string dot(const KeyFormatter& keyFormatter = DefaultKeyFormatter,
const DotWriter& writer = DotWriter()) const;
void saveGraph(const std::string& filename,
const KeyFormatter& keyFormatter = DefaultKeyFormatter,
const DotWriter& writer = DotWriter()) const;
// Expose HybridValues version of logProbability.
double logProbability(const HybridValues& x) const;
// Expose HybridValues version of evaluate.
double evaluate(const HybridValues& c) const;
};
} // namespace gtsam
#include <gtsam/inference/BayesNet-inst.h>
FactorGraph.h
Factor Graph Base Class.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
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::HybridValues
HybridValues represents a collection of DiscreteValues and VectorValues.
Definition HybridValues.h:38
gtsam::BayesNet::BayesNet
BayesNet(std::initializer_list< sharedConditional > conditionals)
Constructor that takes an initializer list of shared pointers.
Definition BayesNet.h:60
gtsam::BayesNet::print
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print out graph
Definition BayesNet-inst.h:32
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:46
gtsam::BayesNet< DiscreteConditional >::sharedConditional
boost::shared_ptr< DiscreteConditional > sharedConditional
Definition BayesNet.h:41
gtsam::BayesNet::BayesNet
BayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition BayesNet.h:52
gtsam::BayesNet::dot
std::string dot(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
Output to graphviz format string.
Definition BayesNet-inst.h:74
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:83
gtsam::BayesNet::BayesNet
BayesNet()
Default constructor as an empty BayesNet.
Definition BayesNet.h:48
gtsam::FactorGraph< CONDITIONAL >::FactorGraph
FactorGraph()
Definition FactorGraph.h:142
gtsam::DotWriter
DotWriter is a helper class for writing graphviz .dot files.
Definition DotWriter.h:35