SymbolicBayesNet.cpp
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 
22 
23 #include <boost/range/adaptor/reversed.hpp>
24 #include <fstream>
25 
26 namespace gtsam {
27 
28  // Instantiate base class
29  template class FactorGraph<SymbolicConditional>;
30 
31  /* ************************************************************************* */
32  bool SymbolicBayesNet::equals(const This& bn, double tol) const
33  {
34  return Base::equals(bn, tol);
35  }
36 
37  /* ************************************************************************* */
38  void SymbolicBayesNet::saveGraph(const std::string &s, const KeyFormatter& keyFormatter) const
39  {
40  std::ofstream of(s.c_str());
41  of << "digraph G{\n";
42 
43  for (auto conditional: boost::adaptors::reverse(*this)) {
44  SymbolicConditional::Frontals frontals = conditional->frontals();
45  Key me = frontals.front();
46  SymbolicConditional::Parents parents = conditional->parents();
47  for(Key p: parents)
48  of << p << "->" << me << std::endl;
49  }
50 
51  of << "}";
52  of.close();
53  }
54 
55 
56 }
GTSAM_EXPORT void saveGraph(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
bool equals(const This &fg, double tol=1e-9) const
GTSAM_EXPORT bool equals(const This &bn, double tol=1e-9) const
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
RealScalar s
traits
Definition: chartTesting.h:28
void reverse(const MatrixType &m)
float * p
const G double tol
Definition: Group.h:83
boost::iterator_range< typename SymbolicFactor::const_iterator > Parents
Definition: Conditional.h:55
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
boost::iterator_range< typename SymbolicFactor::const_iterator > Frontals
Definition: Conditional.h:52


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:45:07