test for incremental update
parent
bef2efacb7
commit
21974f95e1
|
@ -10,6 +10,7 @@ using namespace boost::assign;
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
|
||||||
#include "SymbolicBayesNet.h"
|
#include "SymbolicBayesNet.h"
|
||||||
|
#include "SymbolicFactor.h"
|
||||||
#include "GaussianBayesNet.h"
|
#include "GaussianBayesNet.h"
|
||||||
#include "Ordering.h"
|
#include "Ordering.h"
|
||||||
#include "BayesTree-inl.h"
|
#include "BayesTree-inl.h"
|
||||||
|
@ -21,10 +22,6 @@ typedef BayesTree<SymbolicConditional> SymbolicBayesTree;
|
||||||
typedef BayesTree<GaussianConditional> GaussianBayesTree;
|
typedef BayesTree<GaussianConditional> GaussianBayesTree;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// todo: copied from testBayesTree
|
|
||||||
|
|
||||||
|
|
||||||
// Conditionals for ASIA example from the tutorial with A and D evidence
|
// Conditionals for ASIA example from the tutorial with A and D evidence
|
||||||
SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
||||||
new SymbolicConditional("L", "B")), E(
|
new SymbolicConditional("L", "B")), E(
|
||||||
|
@ -32,6 +29,12 @@ SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
||||||
"L", "B")), T(new SymbolicConditional("T", "E", "L")), X(
|
"L", "B")), T(new SymbolicConditional("T", "E", "L")), X(
|
||||||
new SymbolicConditional("X", "E"));
|
new SymbolicConditional("X", "E"));
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
SymbolicBayesTree update(const SymbolicBayesTree& initial, const SymbolicFactor& newFactor) {
|
||||||
|
return initial;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( BayesTree, iSAM )
|
TEST( BayesTree, iSAM )
|
||||||
{
|
{
|
||||||
|
@ -43,8 +46,28 @@ TEST( BayesTree, iSAM )
|
||||||
bayesTree.insert(S);
|
bayesTree.insert(S);
|
||||||
bayesTree.insert(T);
|
bayesTree.insert(T);
|
||||||
bayesTree.insert(X);
|
bayesTree.insert(X);
|
||||||
|
|
||||||
bayesTree.print("bayesTree");
|
bayesTree.print("bayesTree");
|
||||||
|
|
||||||
|
// Create expected Bayes tree
|
||||||
|
SymbolicBayesTree expected;
|
||||||
|
expected.insert(B);
|
||||||
|
expected.insert(L);
|
||||||
|
expected.insert(S);
|
||||||
|
expected.insert(E);
|
||||||
|
expected.insert(T);
|
||||||
|
expected.insert(X);
|
||||||
|
expected.print("expected");
|
||||||
|
|
||||||
|
// create a new factor to be inserted
|
||||||
|
list<string> keys;
|
||||||
|
keys += "B","S";
|
||||||
|
SymbolicFactor newFactor(keys);
|
||||||
|
|
||||||
|
// do incremental inference
|
||||||
|
SymbolicBayesTree actual = update(bayesTree, newFactor);
|
||||||
|
|
||||||
|
// Check whether the same
|
||||||
|
//CHECK(assert_equal(expected,actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue