From 952798e751b1e6738151ec4189195813ceef820a Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 22 Nov 2009 18:22:17 +0000 Subject: [PATCH] fixed orphans bug --- cpp/BayesTree-inl.h | 5 +++-- cpp/testBayesTree.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h index a7e377250..77238eb64 100644 --- a/cpp/BayesTree-inl.h +++ b/cpp/BayesTree-inl.h @@ -402,10 +402,11 @@ namespace gtsam { // only add if key is not yet in the factor graph if (!factors.involves(key)) { - // get the clique + // get the clique and remove it from orphans (if it exists) sharedClique clique = (*this)[key]; + orphans.remove(clique); - // remove path above this clique + // remove path from clique to root FactorGraph factors1; Cliques orphans1; boost::tie(factors1,orphans1) = removePath(clique); diff --git a/cpp/testBayesTree.cpp b/cpp/testBayesTree.cpp index 70b581664..3b38d68e3 100644 --- a/cpp/testBayesTree.cpp +++ b/cpp/testBayesTree.cpp @@ -364,7 +364,7 @@ TEST( BayesTree, removePath2 ) { SymbolicBayesTree bayesTree = createAsiaSymbolicBayesTree(); - // Call remove-path with clique S + // Call remove-path with clique B FactorGraph factors; SymbolicBayesTree::Cliques orphans; boost::tie(factors,orphans) = bayesTree.removePath(bayesTree["B"]); @@ -427,7 +427,7 @@ TEST( BayesTree, removeTop ) CHECK(assert_equal((FactorGraph)expected, factors)); SymbolicBayesTree::Cliques expectedOrphans; expectedOrphans += bayesTree["T"], bayesTree["X"]; - //CHECK(assert_equal(expectedOrphans, orphans)); + CHECK(assert_equal(expectedOrphans, orphans)); } /* ************************************************************************* */