new test to drive elimination tree development
parent
bc0e855453
commit
fbdf9647f8
|
@ -115,7 +115,7 @@ TEST( SymbolicFactorGraph, eliminateOne )
|
|||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST( GaussianFactorGraph, eliminate )
|
||||
TEST( SymbolicFactorGraph, eliminate )
|
||||
{
|
||||
Ordering o; o += "x2","l1","x1";
|
||||
|
||||
|
@ -139,6 +139,41 @@ TEST( GaussianFactorGraph, eliminate )
|
|||
CHECK(assert_equal(expected,actual));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Test to drive elimination tree development
|
||||
// Uses example originally created in testEliminationTree
|
||||
// graph: f(0,1) f(0,2) f(1,4) f(2,4) f(3,4)
|
||||
/* ************************************************************************* */
|
||||
TEST( SymbolicFactorGraph, eliminate2 )
|
||||
{
|
||||
// create expected Chordal bayes Net
|
||||
Conditional::shared_ptr c0(new Conditional(0, 1, 2));
|
||||
Conditional::shared_ptr c1(new Conditional(1, 2, 4));
|
||||
Conditional::shared_ptr c2(new Conditional(2, 4));
|
||||
Conditional::shared_ptr c3(new Conditional(3, 4));
|
||||
Conditional::shared_ptr c4(new Conditional(4));
|
||||
|
||||
SymbolicBayesNet expected;
|
||||
expected.push_back(c0);
|
||||
expected.push_back(c1);
|
||||
expected.push_back(c2);
|
||||
expected.push_back(c3);
|
||||
expected.push_back(c4);
|
||||
|
||||
// Create factor graph
|
||||
SymbolicFactorGraph fg;
|
||||
fg.push_factor(0, 1);
|
||||
fg.push_factor(0, 2);
|
||||
fg.push_factor(1, 4);
|
||||
fg.push_factor(2, 4);
|
||||
fg.push_factor(3, 4);
|
||||
|
||||
// eliminate it
|
||||
SymbolicBayesNet actual = *Inference::Eliminate(fg);
|
||||
|
||||
CHECK(assert_equal(expected,actual));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
int main() {
|
||||
TestResult tr;
|
||||
|
|
Loading…
Reference in New Issue