diff --git a/.cproject b/.cproject index b77415840..7086ce250 100644 --- a/.cproject +++ b/.cproject @@ -1277,7 +1277,6 @@ make - testSimulated2DOriented.run true false @@ -1317,7 +1316,6 @@ make - testSimulated2D.run true false @@ -1325,7 +1323,6 @@ make - testSimulated3D.run true false @@ -1429,6 +1426,7 @@ make + testErrors.run true false @@ -1723,6 +1721,7 @@ cpack + -G DEB true false @@ -1730,6 +1729,7 @@ cpack + -G RPM true false @@ -1737,6 +1737,7 @@ cpack + -G TGZ true false @@ -1744,6 +1745,7 @@ cpack + --config CPackSourceConfig.cmake true false @@ -1935,7 +1937,6 @@ make - tests/testGaussianISAM2 true false @@ -2087,6 +2088,7 @@ make + tests/testBayesTree.run true false @@ -2094,6 +2096,7 @@ make + testBinaryBayesNet.run true false @@ -2141,6 +2144,7 @@ make + testSymbolicBayesNet.run true false @@ -2148,6 +2152,7 @@ make + tests/testSymbolicFactor.run true false @@ -2155,6 +2160,7 @@ make + testSymbolicFactorGraph.run true false @@ -2170,6 +2176,7 @@ make + tests/testBayesTree true false @@ -2671,6 +2678,14 @@ true true + + make + -j4 + testSymbolicBayesTree.run + true + true + true + make -j5 @@ -3289,6 +3304,7 @@ make + testGraph.run true false @@ -3296,6 +3312,7 @@ make + testJunctionTree.run true false @@ -3303,6 +3320,7 @@ make + testSymbolicBayesNetB.run true false diff --git a/gtsam/inference/tests/testOrdering.cpp b/gtsam/inference/tests/testOrdering.cpp index 26efb65b2..6320ca748 100644 --- a/gtsam/inference/tests/testOrdering.cpp +++ b/gtsam/inference/tests/testOrdering.cpp @@ -241,11 +241,10 @@ TEST(Ordering, MetisLoop) { // METIS { Ordering actual = Ordering::Create(Ordering::METIS, sfg); - // 0,3 - // 1,3 - // 2 - // 4,0 - // 5 + // - P( 1 0 3) + // | - P( 4 | 0 3) + // | | - P( 5 | 0 4) + // | - P( 2 | 1 3) Ordering expected = Ordering(list_of(5)(4)(2)(1)(0)(3)); EXPECT(assert_equal(expected, actual)); } @@ -259,6 +258,11 @@ TEST(Ordering, Create) { // COLAMD { + //- P( 4 5) + //| - P( 3 | 4) + //| | - P( 2 | 3) + //| | | - P( 1 | 2) + //| | | | - P( 0 | 1) Ordering actual = Ordering::Create(Ordering::COLAMD, sfg); Ordering expected = Ordering(list_of(0)(1)(2)(3)(4)(5)); EXPECT(assert_equal(expected, actual)); @@ -267,12 +271,9 @@ TEST(Ordering, Create) { // METIS { Ordering actual = Ordering::Create(Ordering::METIS, sfg); - // 2 - // 0 - // 1 - // 4 - // 3 - // 5 + //- P( 1 0 2) + //| - P( 3 4 | 2) + //| | - P( 5 | 4) Ordering expected = Ordering(list_of(5)(3)(4)(1)(0)(2)); EXPECT(assert_equal(expected, actual)); } diff --git a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp index 3c02f6dbd..979786515 100644 --- a/gtsam/symbolic/tests/testSymbolicBayesTree.cpp +++ b/gtsam/symbolic/tests/testSymbolicBayesTree.cpp @@ -691,6 +691,63 @@ TEST(SymbolicBayesTree, complicatedMarginal) } } + +/* ************************************************************************* */ +TEST(SymbolicBayesTree, COLAMDvsMETIS) { + + // create circular graph + SymbolicFactorGraph sfg; + sfg.push_factor(0, 1); + sfg.push_factor(1, 2); + sfg.push_factor(2, 3); + sfg.push_factor(3, 4); + sfg.push_factor(4, 5); + sfg.push_factor(0, 5); + + // COLAMD + { + Ordering ordering = Ordering::Create(Ordering::COLAMD, sfg); + EXPECT(assert_equal(Ordering(list_of(0)(5)(1)(4)(2)(3)), ordering)); + + // - P( 4 2 3) + // | - P( 1 | 2 4) + // | | - P( 5 | 1 4) + // | | | - P( 0 | 1 5) + SymbolicBayesTree expected; + expected.insertRoot( + MakeClique(list_of(4)(2)(3), 3, + list_of( + MakeClique(list_of(1)(2)(4), 1, + list_of( + MakeClique(list_of(5)(1)(4), 1, + list_of(MakeClique(list_of(0)(1)(5), 1)))))))); + + SymbolicBayesTree actual = *sfg.eliminateMultifrontal(ordering); + EXPECT(assert_equal(expected, actual)); + } + + // METIS + { + Ordering ordering = Ordering::Create(Ordering::METIS, sfg); + EXPECT(assert_equal(Ordering(list_of(5)(4)(2)(1)(0)(3)), ordering)); + + // - P( 1 0 3) + // | - P( 4 | 0 3) + // | | - P( 5 | 0 4) + // | - P( 2 | 1 3) + SymbolicBayesTree expected; + expected.insertRoot( + MakeClique(list_of(1)(0)(3), 3, + list_of( + MakeClique(list_of(4)(0)(3), 1, + list_of(MakeClique(list_of(5)(0)(4), 1))))( + MakeClique(list_of(2)(1)(3), 1)))); + + SymbolicBayesTree actual = *sfg.eliminateMultifrontal(ordering); + EXPECT(assert_equal(expected, actual)); + } +} + /* ************************************************************************* */ int main() { TestResult tr;