Build etree and jtree
parent
d8ed60aead
commit
9800e110aa
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
#include <gtsam/base/Testable.h>
|
||||
#include <gtsam/discrete/DiscreteEliminationTree.h>
|
||||
#include <gtsam/discrete/DiscreteJunctionTree.h>
|
||||
#include <gtsam/discrete/DiscreteSearch.h>
|
||||
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue