Updated unit tests for clique finding fix
parent
dfeea9bb16
commit
6c2077ccc5
|
@ -105,7 +105,11 @@ namespace gtsam {
|
||||||
SymbolicBayesTree result;
|
SymbolicBayesTree result;
|
||||||
result.insertRoot(boost::make_shared<SymbolicBayesTreeClique>(
|
result.insertRoot(boost::make_shared<SymbolicBayesTreeClique>(
|
||||||
boost::make_shared<SymbolicConditional>(
|
boost::make_shared<SymbolicConditional>(
|
||||||
SymbolicConditional::FromKeys(boost::assign::list_of(_S_)(_E_)(_L_)(_B_), 4))));
|
SymbolicConditional::FromKeys(boost::assign::list_of(_E_)(_L_)(_B_), 3))));
|
||||||
|
result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
|
||||||
|
boost::make_shared<SymbolicConditional>(
|
||||||
|
SymbolicConditional::FromKeys(boost::assign::list_of(_S_)(_B_) (_L_), 1))),
|
||||||
|
result.roots().front());
|
||||||
result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
|
result.addClique(boost::make_shared<SymbolicBayesTreeClique>(
|
||||||
boost::make_shared<SymbolicConditional>(
|
boost::make_shared<SymbolicConditional>(
|
||||||
SymbolicConditional::FromKeys(boost::assign::list_of(_T_)(_E_)(_L_), 1))),
|
SymbolicConditional::FromKeys(boost::assign::list_of(_T_)(_E_)(_L_), 1))),
|
||||||
|
|
|
@ -145,10 +145,10 @@ TEST( BayesTree, removePath2 )
|
||||||
|
|
||||||
// Check expected outcome
|
// Check expected outcome
|
||||||
SymbolicFactorGraph expected;
|
SymbolicFactorGraph expected;
|
||||||
expected += SymbolicFactor(_S_,_E_,_L_,_B_);
|
expected += SymbolicFactor(_E_,_L_,_B_);
|
||||||
CHECK(assert_equal(expected, factors));
|
CHECK(assert_equal(expected, factors));
|
||||||
SymbolicBayesTree::Cliques expectedOrphans;
|
SymbolicBayesTree::Cliques expectedOrphans;
|
||||||
expectedOrphans += bayesTree[_T_], bayesTree[_X_];
|
expectedOrphans += bayesTree[_S_], bayesTree[_T_], bayesTree[_X_];
|
||||||
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ TEST( BayesTree, removePath3 )
|
||||||
{
|
{
|
||||||
SymbolicBayesTree bayesTree = asiaBayesTree;
|
SymbolicBayesTree bayesTree = asiaBayesTree;
|
||||||
|
|
||||||
// Call remove-path with clique S
|
// Call remove-path with clique T
|
||||||
SymbolicBayesNet bn;
|
SymbolicBayesNet bn;
|
||||||
SymbolicBayesTree::Cliques orphans;
|
SymbolicBayesTree::Cliques orphans;
|
||||||
bayesTree.removePath(bayesTree[_T_], bn, orphans);
|
bayesTree.removePath(bayesTree[_T_], bn, orphans);
|
||||||
|
@ -165,11 +165,11 @@ TEST( BayesTree, removePath3 )
|
||||||
|
|
||||||
// Check expected outcome
|
// Check expected outcome
|
||||||
SymbolicFactorGraph expected;
|
SymbolicFactorGraph expected;
|
||||||
expected += SymbolicFactor(_S_,_E_,_L_,_B_);
|
expected += SymbolicFactor(_E_, _L_, _B_);
|
||||||
expected += SymbolicFactor(_T_, _E_, _L_);
|
expected += SymbolicFactor(_T_, _E_, _L_);
|
||||||
CHECK(assert_equal(expected, factors));
|
CHECK(assert_equal(expected, factors));
|
||||||
SymbolicBayesTree::Cliques expectedOrphans;
|
SymbolicBayesTree::Cliques expectedOrphans;
|
||||||
expectedOrphans += bayesTree[_X_];
|
expectedOrphans += bayesTree[_S_], bayesTree[_X_];
|
||||||
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,8 @@ TEST( BayesTree, removeTop )
|
||||||
|
|
||||||
// Check expected outcome
|
// Check expected outcome
|
||||||
SymbolicBayesNet expected;
|
SymbolicBayesNet expected;
|
||||||
expected += SymbolicConditional::FromKeys(list_of(_S_)(_E_)(_L_)(_B_), 4);
|
expected += SymbolicConditional::FromKeys(list_of(_E_)(_L_)(_B_), 3);
|
||||||
|
expected += SymbolicConditional::FromKeys(list_of(_S_)(_B_)(_L_), 1);
|
||||||
CHECK(assert_equal(expected, bn));
|
CHECK(assert_equal(expected, bn));
|
||||||
|
|
||||||
SymbolicBayesTree::Cliques expectedOrphans;
|
SymbolicBayesTree::Cliques expectedOrphans;
|
||||||
|
@ -284,12 +285,12 @@ TEST( BayesTree, removeTop2 )
|
||||||
|
|
||||||
// Check expected outcome
|
// Check expected outcome
|
||||||
SymbolicBayesNet expected = list_of
|
SymbolicBayesNet expected = list_of
|
||||||
(SymbolicConditional::FromKeys(list_of(_S_)(_E_)(_L_)(_B_), 4))
|
(SymbolicConditional::FromKeys(list_of(_E_)(_L_)(_B_), 3))
|
||||||
(SymbolicConditional::FromKeys(list_of(_T_)(_E_)(_L_), 1));
|
(SymbolicConditional::FromKeys(list_of(_T_)(_E_)(_L_), 1));
|
||||||
CHECK(assert_equal(expected, bn));
|
CHECK(assert_equal(expected, bn));
|
||||||
|
|
||||||
SymbolicBayesTree::Cliques expectedOrphans;
|
SymbolicBayesTree::Cliques expectedOrphans;
|
||||||
expectedOrphans += bayesTree[_X_];
|
expectedOrphans += bayesTree[_S_], bayesTree[_X_];
|
||||||
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
CHECK(assert_container_equal(expectedOrphans|indirected, orphans|indirected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +415,9 @@ TEST( SymbolicBayesTree, thinTree ) {
|
||||||
// check shortcut P(S8||R) to root
|
// check shortcut P(S8||R) to root
|
||||||
SymbolicBayesTree::Clique::shared_ptr c = bayesTree[8];
|
SymbolicBayesTree::Clique::shared_ptr c = bayesTree[8];
|
||||||
SymbolicBayesNet shortcut = c->shortcut(R);
|
SymbolicBayesNet shortcut = c->shortcut(R);
|
||||||
SymbolicBayesNet expected = list_of(SymbolicConditional(14, 11, 13));
|
SymbolicBayesNet expected = list_of
|
||||||
|
(SymbolicConditional(12, 14))
|
||||||
|
(SymbolicConditional(14, 11, 13));
|
||||||
EXPECT(assert_equal(expected, shortcut));
|
EXPECT(assert_equal(expected, shortcut));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,8 @@ TEST( SymbolicFactorGraph, constructFromBayesTree )
|
||||||
{
|
{
|
||||||
// create expected factor graph
|
// create expected factor graph
|
||||||
SymbolicFactorGraph expected;
|
SymbolicFactorGraph expected;
|
||||||
expected.push_factor(_S_, _E_, _L_, _B_);
|
expected.push_factor(_E_, _L_, _B_);
|
||||||
|
expected.push_factor(_S_, _B_, _L_);
|
||||||
expected.push_factor(_T_, _E_, _L_);
|
expected.push_factor(_T_, _E_, _L_);
|
||||||
expected.push_factor(_X_, _E_);
|
expected.push_factor(_X_, _E_);
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ TEST( GaussianBayesTree, balanced_smoother_marginals )
|
||||||
VectorValues expectedSolution = VectorValues::Zero(actualSolution);
|
VectorValues expectedSolution = VectorValues::Zero(actualSolution);
|
||||||
EXPECT(assert_equal(expectedSolution,actualSolution,tol));
|
EXPECT(assert_equal(expectedSolution,actualSolution,tol));
|
||||||
|
|
||||||
LONGS_EQUAL(3, (long)bayesTree.size());
|
LONGS_EQUAL(4, (long)bayesTree.size());
|
||||||
|
|
||||||
double tol=1e-5;
|
double tol=1e-5;
|
||||||
|
|
||||||
|
|
|
@ -847,7 +847,7 @@ TEST(ISAM2, marginalCovariance)
|
||||||
TEST(ISAM2, calculate_nnz)
|
TEST(ISAM2, calculate_nnz)
|
||||||
{
|
{
|
||||||
ISAM2 isam = createSlamlikeISAM2();
|
ISAM2 isam = createSlamlikeISAM2();
|
||||||
int expected = 262;
|
int expected = 241;
|
||||||
int actual = calculate_nnz(isam.roots().front());
|
int actual = calculate_nnz(isam.roots().front());
|
||||||
|
|
||||||
EXPECT_LONGS_EQUAL(expected, actual);
|
EXPECT_LONGS_EQUAL(expected, actual);
|
||||||
|
|
Loading…
Reference in New Issue