27 template<
class FACTORGRAPH>
28 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
38 return eliminateSequential(orderingType,
function, std::cref(computedVariableIndex));
45 return eliminateSequential(computedOrdering,
function, variableIndex);
48 return eliminateSequential(computedOrdering,
function, variableIndex);
51 return eliminateSequential(computedOrdering,
function, variableIndex);
53 Ordering computedOrdering = EliminationTraitsType::DefaultOrderingFunc(
54 asDerived(), *variableIndex);
55 return eliminateSequential(computedOrdering,
function, variableIndex);
61 template<
class FACTORGRAPH>
62 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
70 return eliminateSequential(
ordering,
function, std::cref(computedVariableIndex));
72 gttic(eliminateSequential);
75 const auto [
bayesNet, factorGraph] = etree.eliminate(
function);
77 if(!factorGraph->empty()) {
86 template <
class FACTORGRAPH>
99 return eliminateMultifrontal(orderingType,
function,
100 std::cref(computedVariableIndex));
107 return eliminateMultifrontal(computedOrdering,
function, variableIndex);
110 return eliminateMultifrontal(computedOrdering,
function, variableIndex);
113 return eliminateMultifrontal(computedOrdering,
function, variableIndex);
115 Ordering computedOrdering = EliminationTraitsType::DefaultOrderingFunc(
116 asDerived(), *variableIndex);
117 return eliminateMultifrontal(computedOrdering,
function, variableIndex);
123 template<
class FACTORGRAPH>
124 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>
132 return eliminateMultifrontal(
ordering,
function, std::cref(computedVariableIndex));
134 gttic(eliminateMultifrontal);
138 const auto [bayesTree, factorGraph] = junctionTree.eliminate(
function);
140 if(!factorGraph->empty()) {
149 template<
class FACTORGRAPH>
150 std::pair<std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>, std::shared_ptr<FACTORGRAPH> >
155 gttic(eliminatePartialSequential);
158 return etree.eliminate(
function);
162 return eliminatePartialSequential(
ordering,
function, std::cref(computedVariableIndex));
167 template<
class FACTORGRAPH>
168 std::pair<std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>, std::shared_ptr<FACTORGRAPH> >
173 gttic(eliminatePartialSequential);
178 Ordering ordering(fullOrdering.begin(), fullOrdering.begin() + variables.size());
179 return eliminatePartialSequential(
ordering,
function, variableIndex);
183 return eliminatePartialSequential(variables,
function, std::cref(computedVariableIndex));
188 template<
class FACTORGRAPH>
189 std::pair<std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>, std::shared_ptr<FACTORGRAPH> >
194 gttic(eliminatePartialMultifrontal);
198 return junctionTree.eliminate(
function);
202 return eliminatePartialMultifrontal(
ordering,
function, std::cref(computedVariableIndex));
207 template<
class FACTORGRAPH>
208 std::pair<std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>, std::shared_ptr<FACTORGRAPH> >
213 gttic(eliminatePartialMultifrontal);
218 Ordering ordering(fullOrdering.begin(), fullOrdering.begin() + variables.size());
219 return eliminatePartialMultifrontal(
ordering,
function, variableIndex);
223 return eliminatePartialMultifrontal(variables,
function, std::cref(computedVariableIndex));
228 template<
class FACTORGRAPH>
229 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
237 return marginalMultifrontalBayesNet(variables,
function, std::cref(index));
241 constexpr
bool forceOrder =
true;
246 const size_t nVars = variables.size();
247 Ordering marginalizationOrdering(totalOrdering.begin(), totalOrdering.end() - nVars);
248 Ordering marginalVarsOrdering(totalOrdering.end() - nVars, totalOrdering.end());
251 return marginalMultifrontalBayesNet(marginalVarsOrdering, marginalizationOrdering,
function, variableIndex);
256 template<
class FACTORGRAPH>
257 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
265 return marginalMultifrontalBayesNet(variables,
function, std::cref(index));
269 const constexpr
bool forceOrder =
false;
274 const size_t nVars = variables.size();
275 Ordering marginalizationOrdering(totalOrdering.begin(), totalOrdering.end() - nVars);
276 Ordering marginalVarsOrdering(totalOrdering.end() - nVars, totalOrdering.end());
279 return marginalMultifrontalBayesNet(marginalVarsOrdering, marginalizationOrdering,
function, variableIndex);
284 template<
class FACTORGRAPH>
285 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
288 const Ordering& marginalizedVariableOrdering,
294 return marginalMultifrontalBayesNet(variables, marginalizedVariableOrdering,
function, index);
296 gttic(marginalMultifrontalBayesNet);
299 const auto [bayesTree, factorGraph] =
300 eliminatePartialMultifrontal(marginalizedVariableOrdering,
function, variableIndex);
304 return factorGraph->eliminateSequential(variables,
function);
309 template<
class FACTORGRAPH>
310 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesNetType>
313 const Ordering& marginalizedVariableOrdering,
319 return marginalMultifrontalBayesNet(variables, marginalizedVariableOrdering,
function, index);
321 gttic(marginalMultifrontalBayesNet);
324 const auto [bayesTree, factorGraph] =
325 eliminatePartialMultifrontal(marginalizedVariableOrdering,
function, variableIndex);
333 template<
class FACTORGRAPH>
334 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>
342 return marginalMultifrontalBayesTree(variables,
function, std::cref(computedVariableIndex));
346 constexpr
bool forceOrder =
true;
351 const size_t nVars = variables.size();
352 Ordering marginalizationOrdering(totalOrdering.begin(), totalOrdering.end() - nVars);
353 Ordering marginalVarsOrdering(totalOrdering.end() - nVars, totalOrdering.end());
356 return marginalMultifrontalBayesTree(marginalVarsOrdering, marginalizationOrdering,
function, variableIndex);
361 template<
class FACTORGRAPH>
362 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>
370 return marginalMultifrontalBayesTree(variables,
function, std::cref(computedVariableIndex));
374 constexpr
bool forceOrder =
false;
379 const size_t nVars = variables.size();
380 Ordering marginalizationOrdering(totalOrdering.begin(), totalOrdering.end() - nVars);
381 Ordering marginalVarsOrdering(totalOrdering.end() - nVars, totalOrdering.end());
384 return marginalMultifrontalBayesTree(marginalVarsOrdering, marginalizationOrdering,
function, variableIndex);
389 template<
class FACTORGRAPH>
390 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>
393 const Ordering& marginalizedVariableOrdering,
399 return marginalMultifrontalBayesTree(variables, marginalizedVariableOrdering,
function, std::cref(computedVariableIndex));
401 gttic(marginalMultifrontalBayesTree);
404 const auto [bayesTree, factorGraph] =
405 eliminatePartialMultifrontal(marginalizedVariableOrdering,
function, variableIndex);
409 return factorGraph->eliminateMultifrontal(variables,
function);
414 template<
class FACTORGRAPH>
415 std::shared_ptr<typename EliminateableFactorGraph<FACTORGRAPH>::BayesTreeType>
418 const Ordering& marginalizedVariableOrdering,
424 return marginalMultifrontalBayesTree(variables, marginalizedVariableOrdering,
function, std::cref(computedVariableIndex));
426 gttic(marginalMultifrontalBayesTree);
429 const auto [bayesTree, factorGraph] =
430 eliminatePartialMultifrontal(marginalizedVariableOrdering,
function, variableIndex);
438 template<
class FACTORGRAPH>
439 std::shared_ptr<FACTORGRAPH>
450 Ordering marginalizationOrdering(totalOrdering.begin(), totalOrdering.end() - variables.size());
453 return eliminatePartialMultifrontal(marginalizationOrdering,
function, variableIndex).second;
459 return marginal(variables,
function, std::cref(computedVariableIndex));