symbolicExampleGraphs.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 
12 /*
13  * @file symbolicExampleGraphs.cpp
14  * @date sept 15, 2012
15  * @author Frank Dellaert
16  * @author Michael Kaess
17  * @author Viorela Ila
18  * @author Richard Roberts
19  */
20 
21 #pragma once
22 
28 #include <gtsam/inference/Symbol.h>
29 #include <boost/assign/list_of.hpp>
30 
31 namespace gtsam {
32  namespace {
33 
34  const SymbolicFactorGraph simpleTestGraph1 = boost::assign::list_of
35  (boost::make_shared<SymbolicFactor>(0,1))
36  (boost::make_shared<SymbolicFactor>(0,2))
37  (boost::make_shared<SymbolicFactor>(1,4))
38  (boost::make_shared<SymbolicFactor>(2,4))
39  (boost::make_shared<SymbolicFactor>(3,4));
40 
41  const SymbolicBayesNet simpleTestGraph1BayesNet = boost::assign::list_of
42  (boost::make_shared<SymbolicConditional>(0,1,2))
43  (boost::make_shared<SymbolicConditional>(1,2,4))
44  (boost::make_shared<SymbolicConditional>(2,4))
45  (boost::make_shared<SymbolicConditional>(3,4))
46  (boost::make_shared<SymbolicConditional>(4));
47 
48  const SymbolicFactorGraph simpleTestGraph2 = boost::assign::list_of
49  (boost::make_shared<SymbolicFactor>(0,1))
50  (boost::make_shared<SymbolicFactor>(0,2))
51  (boost::make_shared<SymbolicFactor>(1,3))
52  (boost::make_shared<SymbolicFactor>(1,4))
53  (boost::make_shared<SymbolicFactor>(2,3))
54  (boost::make_shared<SymbolicFactor>(4,5));
55 
57  const SymbolicFactorGraph simpleChain = boost::assign::list_of
58  (boost::make_shared<SymbolicFactor>(1,0))
59  (boost::make_shared<SymbolicFactor>(0,2))
60  (boost::make_shared<SymbolicFactor>(2,3));
61 
62  /* ************************************************************************* *
63  * 2 3
64  * 0 1 : 2
65  ****************************************************************************/
66  SymbolicBayesTree __simpleChainBayesTree() {
67  SymbolicBayesTree result;
68  result.insertRoot(boost::make_shared<SymbolicBayesTreeClique>(
69  boost::make_shared<SymbolicConditional>(
70  SymbolicConditional::FromKeys(boost::assign::list_of(2)(3), 2))));
71  result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
72  boost::make_shared<SymbolicConditional>(
73  SymbolicConditional::FromKeys(boost::assign::list_of(0)(1)(2), 2))),
74  result.roots().front());
75  return result;
76  }
77 
78  const SymbolicBayesTree simpleChainBayesTree = __simpleChainBayesTree();
79 
80  /* ************************************************************************* */
81  // Keys for ASIA example from the tutorial with A and D evidence
85 
86  // Factor graph for Asia example
87  const SymbolicFactorGraph asiaGraph = boost::assign::list_of
88  (boost::make_shared<SymbolicFactor>(_T_))
89  (boost::make_shared<SymbolicFactor>(_S_))
90  (boost::make_shared<SymbolicFactor>(_T_, _E_, _L_))
91  (boost::make_shared<SymbolicFactor>(_L_, _S_))
92  (boost::make_shared<SymbolicFactor>(_S_, _B_))
93  (boost::make_shared<SymbolicFactor>(_E_, _B_))
94  (boost::make_shared<SymbolicFactor>(_E_, _X_));
95 
96  const SymbolicBayesNet asiaBayesNet = boost::assign::list_of
97  (boost::make_shared<SymbolicConditional>(_T_, _E_, _L_))
98  (boost::make_shared<SymbolicConditional>(_X_, _E_))
99  (boost::make_shared<SymbolicConditional>(_E_, _B_, _L_))
100  (boost::make_shared<SymbolicConditional>(_S_, _B_, _L_))
101  (boost::make_shared<SymbolicConditional>(_L_, _B_))
102  (boost::make_shared<SymbolicConditional>(_B_));
103 
104  SymbolicBayesTree __asiaBayesTree() {
105  SymbolicBayesTree result;
106  result.insertRoot(boost::make_shared<SymbolicBayesTreeClique>(
107  boost::make_shared<SymbolicConditional>(
108  SymbolicConditional::FromKeys(boost::assign::list_of(_E_)(_L_)(_B_), 3))));
109  result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
110  boost::make_shared<SymbolicConditional>(
111  SymbolicConditional::FromKeys(boost::assign::list_of(_S_)(_B_) (_L_), 1))),
112  result.roots().front());
113  result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
114  boost::make_shared<SymbolicConditional>(
115  SymbolicConditional::FromKeys(boost::assign::list_of(_T_)(_E_)(_L_), 1))),
116  result.roots().front());
117  result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
118  boost::make_shared<SymbolicConditional>(
119  SymbolicConditional::FromKeys(boost::assign::list_of(_X_)(_E_), 1))),
120  result.roots().front());
121  return result;
122  }
123 
124  const SymbolicBayesTree asiaBayesTree = __asiaBayesTree();
125 
126  /* ************************************************************************* */
127  const Ordering asiaOrdering = boost::assign::list_of(_X_)(_T_)(_S_)(_E_)(_L_)(_B_);
128 
129  }
130 }
Key E(std::uint64_t j)
Key X(std::uint64_t j)
static const Key _L_
static SymbolicConditional FromKeys(const CONTAINER &keys, size_t nrFrontals)
Values result
Key S(std::uint64_t j)
static const Key _B_
traits
Definition: chartTesting.h:28
Key B(std::uint64_t j)
Key T(std::uint64_t j)
Key L(std::uint64_t j)
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61


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