test for incremental update

release/4.3a0
Frank Dellaert 2009-11-18 16:31:19 +00:00
parent bef2efacb7
commit 21974f95e1
1 changed files with 28 additions and 5 deletions

View File

@ -10,6 +10,7 @@ using namespace boost::assign;
#include <CppUnitLite/TestHarness.h>
#include "SymbolicBayesNet.h"
#include "SymbolicFactor.h"
#include "GaussianBayesNet.h"
#include "Ordering.h"
#include "BayesTree-inl.h"
@ -21,10 +22,6 @@ typedef BayesTree<SymbolicConditional> SymbolicBayesTree;
typedef BayesTree<GaussianConditional> GaussianBayesTree;
// todo: copied from testBayesTree
// Conditionals for ASIA example from the tutorial with A and D evidence
SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
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(
new SymbolicConditional("X", "E"));
/* ************************************************************************* */
SymbolicBayesTree update(const SymbolicBayesTree& initial, const SymbolicFactor& newFactor) {
return initial;
}
/* ************************************************************************* */
TEST( BayesTree, iSAM )
{
@ -43,8 +46,28 @@ TEST( BayesTree, iSAM )
bayesTree.insert(S);
bayesTree.insert(T);
bayesTree.insert(X);
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));
}
/* ************************************************************************* */