diff --git a/gtsam/discrete/tests/testDiscreteSearch.cpp b/gtsam/discrete/tests/testDiscreteSearch.cpp index b537dd2f0..7e715ca62 100644 --- a/gtsam/discrete/tests/testDiscreteSearch.cpp +++ b/gtsam/discrete/tests/testDiscreteSearch.cpp @@ -18,6 +18,8 @@ #include #include +#include +#include #include #include "AsiaExample.h" @@ -28,13 +30,29 @@ using namespace gtsam; namespace asia { using namespace asia_example; static const DiscreteBayesNet bayesNet = createAsiaExample(); + +// Create factor graph and optimize with max-product for MPE static const DiscreteFactorGraph factorGraph(bayesNet); static const DiscreteValues mpe = factorGraph.optimize(); + +// Create junction tree static const Ordering ordering{D, X, B, E, L, T, S, A}; + +static const DiscreteEliminationTree etree(factorGraph, ordering); +static const DiscreteJunctionTree junctionTree(etree); + +// Create Bayes tree static const DiscreteBayesTree bayesTree = *factorGraph.eliminateMultifrontal(ordering); } // namespace asia +/* ************************************************************************* */ +TEST(DiscreteBayesNet, AsiaFactorGraphKBest) { + GTSAM_PRINT(asia::etree); + GTSAM_PRINT(asia::junctionTree); + DiscreteSearch search(asia::factorGraph); +} + /* ************************************************************************* */ TEST(DiscreteBayesNet, EmptyKBest) { DiscreteBayesNet net; // no factors