Loading...
Searching...
No Matches
SymbolicBayesNet.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/symbolic/SymbolicConditional.h>
#include <gtsam/inference/BayesNet.h>
#include <gtsam/inference/FactorGraph.h>
#include <gtsam/base/types.h>
namespace gtsam {
class SymbolicBayesNet : public BayesNet<SymbolicConditional> {
public:
typedef BayesNet<SymbolicConditional> Base;
typedef SymbolicBayesNet This;
typedef SymbolicConditional ConditionalType;
typedef boost::shared_ptr<This> shared_ptr;
typedef boost::shared_ptr<ConditionalType> sharedConditional;
SymbolicBayesNet() {}
template <typename ITERATOR>
SymbolicBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
: Base(firstConditional, lastConditional) {}
template <class CONTAINER>
explicit SymbolicBayesNet(const CONTAINER& conditionals) {
push_back(conditionals);
}
template <class DERIVEDCONDITIONAL>
explicit SymbolicBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph)
: Base(graph) {}
SymbolicBayesNet(std::initializer_list<boost::shared_ptr<SymbolicConditional>> conditionals)
: Base(conditionals) {}
SymbolicBayesNet(SymbolicConditional&& c) {
push_back(boost::make_shared<SymbolicConditional>(c));
}
SymbolicBayesNet& operator()(SymbolicConditional&& c) {
push_back(boost::make_shared<SymbolicConditional>(c));
return *this;
}
virtual ~SymbolicBayesNet() {}
GTSAM_EXPORT bool equals(const This& bn, double tol = 1e-9) const;
GTSAM_EXPORT void print(
const std::string& s = "SymbolicBayesNet",
const KeyFormatter& formatter = DefaultKeyFormatter) const override {
Base::print(s, formatter);
}
private:
friend class boost::serialization::access;
template<class ARCHIVE>
void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
}
};
template<>
struct traits<SymbolicBayesNet> : public Testable<SymbolicBayesNet> {
};
} //\ namespace gtsam
types.h
Typedefs for easier changing of types.
FactorGraph.h
Factor Graph Base Class.
BayesNet.h
Bayes network.
SymbolicConditional.h
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::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::Testable
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
gtsam::BayesNet< SymbolicConditional >::print
void print(const std::string &s="BayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
gtsam::BayesNet< SymbolicConditional >::BayesNet
BayesNet()
Definition BayesNet.h:48
gtsam::FactorGraph
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition FactorGraph.h:97
gtsam::FactorGraph::push_back
IsDerived< DERIVEDFACTOR > push_back(boost::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
Definition FactorGraph.h:186
gtsam::SymbolicBayesNet
A SymbolicBayesNet is a Bayes Net of purely symbolic conditionals.
Definition SymbolicBayesNet.h:32
gtsam::SymbolicBayesNet::~SymbolicBayesNet
virtual ~SymbolicBayesNet()
Destructor.
Definition SymbolicBayesNet.h:87
gtsam::SymbolicBayesNet::equals
GTSAM_EXPORT bool equals(const This &bn, double tol=1e-9) const
Check equality.
Definition SymbolicBayesNet.cpp:28
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(SymbolicConditional &&c)
Construct from a single conditional.
Definition SymbolicBayesNet.h:71
gtsam::SymbolicBayesNet::print
GTSAM_EXPORT void print(const std::string &s="SymbolicBayesNet", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
Definition SymbolicBayesNet.h:98
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(ITERATOR firstConditional, ITERATOR lastConditional)
Construct from iterator over conditionals.
Definition SymbolicBayesNet.h:48
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(std::initializer_list< boost::shared_ptr< SymbolicConditional > > conditionals)
Constructor that takes an initializer list of shared pointers.
Definition SymbolicBayesNet.h:67
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(const CONTAINER &conditionals)
Construct from container of factors (shared_ptr or plain objects).
Definition SymbolicBayesNet.h:53
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet()
Construct empty factor graph.
Definition SymbolicBayesNet.h:44
gtsam::SymbolicBayesNet::access
friend class boost::serialization::access
Serialization function.
Definition SymbolicBayesNet.h:108
gtsam::SymbolicBayesNet::operator()
SymbolicBayesNet & operator()(SymbolicConditional &&c)
Add a single conditional and return a reference.
Definition SymbolicBayesNet.h:81
gtsam::SymbolicBayesNet::SymbolicBayesNet
SymbolicBayesNet(const FactorGraph< DERIVEDCONDITIONAL > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition SymbolicBayesNet.h:60
gtsam::SymbolicConditional
SymbolicConditional is a conditional with keys but no probability data, produced by symbolic eliminat...
Definition SymbolicConditional.h:38