29 using namespace gtsam;
34 KeySet actual = simpleTestGraph1.keys();
41 KeySet actual = simpleTestGraph2.keys();
68 const auto [actualBayesNet, actualSfg] =
74 const auto [actualBayesNet2, actualSfg2] =
75 simpleTestGraph2.eliminatePartialSequential(
Ordering{0, 1});
95 std::make_shared<SymbolicConditional>(
96 SymbolicConditional::FromKeys(
KeyVector{4, 5, 1}, 2));
98 std::make_shared<SymbolicBayesTreeClique>(root));
100 const auto expectedFactorGraph =
104 const auto [actualBayesTree, actualFactorGraph] =
112 std::make_shared<SymbolicBayesTreeClique>(
113 std::make_shared<SymbolicConditional>(4, 1));
114 root2->children.push_back(std::make_shared<SymbolicBayesTreeClique>(
115 std::make_shared<SymbolicConditional>(5, 4)));
118 const auto [actualBayesTree2, actualFactorGraph2] =
119 simpleTestGraph2.eliminatePartialMultifrontal(
KeyVector{4, 5});
128 *simpleTestGraph2.marginalMultifrontalBayesNet(
Ordering{0, 1, 2, 3});
129 auto expectedBayesNet =
SymbolicBayesNet({0, 1, 2})({1, 2, 3})({2, 3})({3});
135 *simpleTestGraph2.marginalMultifrontalBayesNet(
KeyVector{0, 1, 2, 3});
137 auto expectedBayesNet =
SymbolicBayesNet({0, 1, 2})({2, 1, 3})({1, 3})({3});
142 const Ordering orderedVariables{0, 3},
143 marginalizedVariableOrdering{1, 2, 4, 5};
145 orderedVariables, marginalizedVariableOrdering);
152 const Ordering marginalizedVariableOrdering{2, 4, 5};
154 variables, marginalizedVariableOrdering);
162 auto expectedBayesTree =
163 *simpleTestGraph2.eliminatePartialMultifrontal(
Ordering{4, 5})
164 .second->eliminateMultifrontal(
Ordering{0, 1, 2, 3});
167 *simpleTestGraph2.marginalMultifrontalBayesTree(
Ordering{0, 1, 2, 3});
173 auto expectedBayesTree =
174 *simpleTestGraph2.eliminatePartialMultifrontal(
Ordering{4, 5})
175 .second->eliminateMultifrontal(Ordering::OrderingType::COLAMD);
178 *simpleTestGraph2.marginalMultifrontalBayesTree(
KeyVector{0, 1, 2, 3});
183 const Ordering orderedVariables{0, 3},
184 marginalizedVariableOrdering{1, 2, 4, 5};
185 auto expectedBayesTree =
187 .eliminatePartialMultifrontal(marginalizedVariableOrdering)
188 .second->eliminateMultifrontal(orderedVariables);
191 orderedVariables, marginalizedVariableOrdering);
197 const Ordering marginalizedVariableOrdering{2, 4, 5};
198 auto expectedBayesTree =
200 .eliminatePartialMultifrontal(marginalizedVariableOrdering)
201 .second->eliminateMultifrontal(Ordering::OrderingType::COLAMD);
205 variables, marginalizedVariableOrdering);
225 const Ordering order{0, 1, 2, 3, 4};