diff --git a/.cproject b/.cproject
index 6af662ee8..635dd1458 100644
--- a/.cproject
+++ b/.cproject
@@ -469,6 +469,7 @@
make
+
testBayesTree.run
true
false
@@ -476,7 +477,6 @@
make
-
testSymbolicBayesNet.run
true
false
@@ -484,6 +484,7 @@
make
+
testSymbolicFactorGraph.run
true
false
@@ -673,14 +674,6 @@
true
true
-
-make
--j2
-install
-true
-true
-true
-
make
-j2
@@ -715,6 +708,7 @@
make
+
testGraph.run
true
false
@@ -770,7 +764,6 @@
make
-
testSimulated2D.run
true
false
@@ -784,6 +777,14 @@
true
true
+
+make
+-j2
+testKey.run
+true
+true
+true
+
make
-j2
diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h
index 5e82695eb..0d32d3a64 100644
--- a/cpp/BayesTree-inl.h
+++ b/cpp/BayesTree-inl.h
@@ -228,9 +228,10 @@ namespace gtsam {
/* ************************************************************************* */
template
BayesTree::BayesTree(const BayesNet& bayesNet) {
+ IndexTable index(bayesNet.ordering());
typename BayesNet::const_reverse_iterator rit;
for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit )
- insert(*rit);
+ insert(*rit, index);
}
/* ************************************************************************* */
@@ -265,21 +266,26 @@ namespace gtsam {
/* ************************************************************************* */
template
- Symbol BayesTree::findParentClique(const list& parents, const list& ordering) const {
- Symbol parent;
- for (list::const_iterator it = ordering.begin(); it!=ordering.end(); it++) {
- list::const_iterator pit = find(parents.begin(), parents.end(), *it);
- if (pit!=parents.end()) {
- parent = *pit;
- break;
+ Symbol BayesTree::findParentClique(const list& parents,
+ const IndexTable& index) const {
+ boost::optional parentCliqueRepresentative;
+ boost::optional lowest;
+ BOOST_FOREACH(const Symbol& p, parents) {
+ size_t i = index(p);
+ if (!lowest || i<*lowest) {
+ lowest.reset(i);
+ parentCliqueRepresentative.reset(p);
}
}
- return parent;
+ if (!lowest) throw
+ invalid_argument("BayesTree::findParentClique: no parents given or key not present in index");
+ return *parentCliqueRepresentative;
}
/* ************************************************************************* */
template
- void BayesTree::insert(const sharedConditional& conditional, const list* ordering)
+ void BayesTree::insert(const sharedConditional& conditional,
+ const IndexTable& index)
{
// get key and parents
const Symbol& key = conditional->key();
@@ -291,14 +297,10 @@ namespace gtsam {
return;
}
- // otherwise, find the parent clique
- Symbol parent;
- if (!ordering) {
- parent = parents.front(); // assumes parents are in current variable order, which is not the case (after COLAMD was activated)
- } else {
- parent = findParentClique(parents, *ordering);
- }
- sharedClique parent_clique = (*this)[parent];
+ // otherwise, find the parent clique by using the index data structure
+ // to find the lowest-ordered parent
+ Symbol parentRepresentative = findParentClique(parents, index);
+ sharedClique parent_clique = (*this)[parentRepresentative];
// if the parents and parent clique have the same size, add to parent clique
if (parent_clique->size() == parents.size()) {
diff --git a/cpp/BayesTree.h b/cpp/BayesTree.h
index 4a1855ad6..4326969ef 100644
--- a/cpp/BayesTree.h
+++ b/cpp/BayesTree.h
@@ -19,6 +19,7 @@
#include "FactorGraph.h"
#include "BayesNet.h"
#include "Key.h"
+#include "IndexTable.h"
namespace gtsam {
@@ -128,11 +129,14 @@ namespace gtsam {
/** check equality */
bool equals(const BayesTree& other, double tol = 1e-9) const;
- /** find parent clique of a conditional, given an ordering */
- Symbol findParentClique(const std::list& parents, const std::list& ordering) const;
+ /**
+ * Find parent clique of a conditional, given an IndexTable constructed from an ordering.
+ * It will look at all parents and return the one with the lowest index in the ordering.
+ */
+ Symbol findParentClique(const std::list& parents, const IndexTable& index) const;
/** insert a new conditional */
- void insert(const sharedConditional& conditional, const std::list* ordering = NULL);
+ void insert(const sharedConditional& conditional, const IndexTable& index);
/** number of cliques */
inline size_t size() const {
diff --git a/cpp/ISAM-inl.h b/cpp/ISAM-inl.h
index 4e83aa2d3..1bffa20cc 100644
--- a/cpp/ISAM-inl.h
+++ b/cpp/ISAM-inl.h
@@ -48,20 +48,23 @@ namespace gtsam {
ordering = keys;
}
+ // Create Index from ordering
+ IndexTable index(ordering);
+
// eliminate into a Bayes net
BayesNet bayesNet = eliminate(factors,ordering);
// insert conditionals back in, straight into the topless bayesTree
typename BayesNet::const_reverse_iterator rit;
for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit )
- this->insert(*rit, &ordering);
+ this->insert(*rit, index);
int count = 0;
// add orphans to the bottom of the new tree
BOOST_FOREACH(sharedClique orphan, orphans) {
- Symbol key = findParentClique(orphan->separator_, ordering);
- sharedClique parent = (*this)[key];
+ Symbol parentRepresentative = findParentClique(orphan->separator_, index);
+ sharedClique parent = (*this)[parentRepresentative];
parent->children_ += orphan;
orphan->parent_ = parent; // set new parent!
diff --git a/cpp/ISAM2-inl.h b/cpp/ISAM2-inl.h
index f09e54e47..f76b88a59 100644
--- a/cpp/ISAM2-inl.h
+++ b/cpp/ISAM2-inl.h
@@ -195,16 +195,18 @@ namespace gtsam {
// eliminate into a Bayes net
BayesNet bayesNet = _eliminate(factors, cached_, ordering);
+ // Create Index from ordering
+ IndexTable index(ordering);
+
// insert conditionals back in, straight into the topless bayesTree
typename BayesNet::const_reverse_iterator rit;
- for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit ) {
- this->insert(*rit, &ordering);
- }
+ for ( rit=bayesNet.rbegin(); rit != bayesNet.rend(); ++rit )
+ this->insert(*rit, index);
// add orphans to the bottom of the new tree
BOOST_FOREACH(sharedClique orphan, orphans) {
- Symbol key = findParentClique(orphan->separator_, ordering);
- sharedClique parent = (*this)[key];
+ Symbol parentRepresentative = findParentClique(orphan->separator_, index);
+ sharedClique parent = (*this)[parentRepresentative];
parent->children_ += orphan;
orphan->parent_ = parent; // set new parent!
}
diff --git a/cpp/IndexTable.h b/cpp/IndexTable.h
new file mode 100644
index 000000000..d58e4523a
--- /dev/null
+++ b/cpp/IndexTable.h
@@ -0,0 +1,58 @@
+/*
+ * IndexTable.h
+ *
+ * Created on: Jan 21, 2010
+ * @Author: Frank Dellaert
+ */
+
+#pragma once
+
+#include // TODO should not be in header
+#include "Testable.h"
+
+namespace gtsam {
+
+ /**
+ * An IndexTable maps from key to size_t index and back
+ * most commonly used templated on Symbol with orderings
+ */
+ template
+ class IndexTable: public std::vector, public Testable > {
+ private:
+
+ /* map back from key to size_t */
+ typedef typename std::map Map;
+ Map key2index_;
+
+ public:
+
+ /* bake ordering into IndexTable */
+ IndexTable(const std::list& ordering) {
+ size_t i = 0;
+ BOOST_FOREACH(const Key& key,ordering){
+ this->push_back(key);
+ key2index_.insert(make_pair(key,i++));
+ }
+ }
+
+ // Testable
+ virtual void print(const std::string& s="") const {
+ std::cout << "IndexTable " << s << ":";
+ BOOST_FOREACH(Key key,*this) std::cout << (std::string)key << " ";
+ }
+ virtual bool equals(const IndexTable& expected, double tol) const {
+ return key2index_==expected.key2index_; // TODO, sanity check
+ }
+
+ /** Key to index by parentheses ! */
+ size_t operator()(const Key& key) const {
+ typename Map::const_iterator it = key2index_.find(key);
+ if (it==key2index_.end())
+ throw(std::invalid_argument("IndexTable::[] invalid key"));
+ return it->second;
+ }
+
+ /* Index to Key is provided by base class operator[] */
+ };
+
+}
diff --git a/cpp/Key.h b/cpp/Key.h
index 368d8f2aa..760778fb6 100644
--- a/cpp/Key.h
+++ b/cpp/Key.h
@@ -54,7 +54,9 @@ namespace gtsam {
int compare(const TypedSymbol& compare) const {return j_-compare.j_;}
// Testable Requirements
- void print(const std::string& name) const {} //FIXME
+ virtual void print(const std::string& s) const {
+ std::cout << s << ": " << (std::string)(*this) << std::endl;
+ }
bool equals(const TypedSymbol& expected, double tol) const { return (*this)==expected; }
private:
@@ -118,7 +120,6 @@ namespace gtsam {
}
// Testable Requirements
- void print(const std::string& name) const {} // FIXME
bool equals(const TypedLabeledSymbol& expected, double tol) const
{ return (*this)==expected; }
@@ -139,10 +140,8 @@ namespace gtsam {
* GaussianFactor, etc. These keys are generated at runtime from TypedSymbol
* keys when linearizing a nonlinear factor graph. This key is not type
* safe, so cannot be used with any Nonlinear* classes.
- *
- * richard: temporarily named 'Symbol' to make refactoring easier
*/
- class Symbol {
+ class Symbol : Testable {
private:
unsigned char c_;
size_t j_;
@@ -190,6 +189,12 @@ namespace gtsam {
}
#endif
+ // Testable Requirements
+ void print(const std::string& s) const {
+ std::cout << s << ": " << (std::string)(*this) << std::endl;
+ }
+ bool equals(const Symbol& expected, double tol) const { return (*this)==expected; }
+
/** Retrieve key character */
unsigned char chr() const { return c_; }
diff --git a/cpp/Makefile.am b/cpp/Makefile.am
index 6be36983e..bff083238 100644
--- a/cpp/Makefile.am
+++ b/cpp/Makefile.am
@@ -39,7 +39,7 @@ testMatrix_LDADD = libgtsam.la
# GTSAM basics
# The header files will be installed in ~/include/gtsam
headers = gtsam.h Value.h Testable.h Factor.h Conditional.h
-headers += Ordering.h numericalDerivative.h
+headers += Ordering.h IndexTable.h numericalDerivative.h
sources += Ordering.cpp smallExample.cpp
# Symbolic Inference
diff --git a/cpp/testBayesTree.cpp b/cpp/testBayesTree.cpp
index ae094aa2a..073c86e2e 100644
--- a/cpp/testBayesTree.cpp
+++ b/cpp/testBayesTree.cpp
@@ -11,13 +11,12 @@ using namespace boost::assign;
#include
-#define GTSAM_MAGIC_KEY
-
#include "SymbolicBayesNet.h"
#include "SymbolicFactorGraph.h"
#include "Ordering.h"
#include "BayesTree-inl.h"
#include "smallExample.h"
+#include "IndexTable.h"
using namespace gtsam;
@@ -25,45 +24,48 @@ typedef BayesTree SymbolicBayesTree;
/* ************************************************************************* */
// SLAM example from RSS sqrtSAM paper
-SymbolicConditional::shared_ptr x3(new SymbolicConditional("x3")),
- x2(new SymbolicConditional("x2","x3")),
- x1(new SymbolicConditional("x1","x2","x3")),
- l1(new SymbolicConditional("l1","x1","x2")),
- l2(new SymbolicConditional("l2","x1","x3"));
+Symbol _x1_('x', 1), _x2_('x', 2), _x3_('x', 3), _l1_('l', 1), _l2_('l', 2);
+SymbolicConditional::shared_ptr
+ x3(new SymbolicConditional(_x3_)),
+ x2(new SymbolicConditional(_x2_,_x3_)),
+ x1(new SymbolicConditional(_x1_,_x2_,_x3_)),
+ l1(new SymbolicConditional(_l1_,_x1_,_x2_)),
+ l2(new SymbolicConditional(_l2_,_x1_,_x3_));
// Bayes Tree for sqrtSAM example
SymbolicBayesTree createSlamSymbolicBayesTree(){
// Create using insert
+ Ordering slamOrdering; slamOrdering += _x3_, _x2_, _x1_, _l2_, _l1_;
SymbolicBayesTree bayesTree_slam;
- bayesTree_slam.insert(x3);
- bayesTree_slam.insert(x2);
- bayesTree_slam.insert(x1);
- bayesTree_slam.insert(l2);
- bayesTree_slam.insert(l1);
+ bayesTree_slam.insert(x3,slamOrdering);
+ bayesTree_slam.insert(x2,slamOrdering);
+ bayesTree_slam.insert(x1,slamOrdering);
+ bayesTree_slam.insert(l2,slamOrdering);
+ bayesTree_slam.insert(l1,slamOrdering);
return bayesTree_slam;
}
/* ************************************************************************* */
-
-
// Conditionals for ASIA example from the tutorial with A and D evidence
+Symbol _B_('B', 0), _L_('L', 0), _E_('E', 0), _S_('S', 0), _T_('T', 0), _X_('X',0);
SymbolicConditional::shared_ptr
- B(new SymbolicConditional("B")),
- L(new SymbolicConditional("L", "B")),
- E(new SymbolicConditional("E", "B", "L")),
- S(new SymbolicConditional("S", "L", "B")),
- T(new SymbolicConditional("T", "E", "L")),
- X(new SymbolicConditional("X", "E"));
+ B(new SymbolicConditional(_B_)),
+ L(new SymbolicConditional(_L_, _B_)),
+ E(new SymbolicConditional(_E_, _B_, _L_)),
+ S(new SymbolicConditional(_S_, _L_, _B_)),
+ T(new SymbolicConditional(_T_, _E_, _L_)),
+ X(new SymbolicConditional(_X_, _E_));
// Bayes Tree for Asia example
SymbolicBayesTree createAsiaSymbolicBayesTree() {
SymbolicBayesTree bayesTree;
- bayesTree.insert(B);
- bayesTree.insert(L);
- bayesTree.insert(E);
- bayesTree.insert(S);
- bayesTree.insert(T);
- bayesTree.insert(X);
+ Ordering asiaOrdering; asiaOrdering += _X_, _T_, _S_, _E_, _L_, _B_;
+ bayesTree.insert(B,asiaOrdering);
+ bayesTree.insert(L,asiaOrdering);
+ bayesTree.insert(E,asiaOrdering);
+ bayesTree.insert(S,asiaOrdering);
+ bayesTree.insert(T,asiaOrdering);
+ bayesTree.insert(X,asiaOrdering);
return bayesTree;
}
@@ -109,6 +111,16 @@ TEST( BayesTree, constructor )
// Check whether the same
CHECK(assert_equal(bayesTree,bayesTree2));
+
+ // CHECK findParentClique, should *not depend on order of parents*
+ Ordering ordering; ordering += _X_, _T_, _S_, _E_, _L_, _B_;
+ IndexTable index(ordering);
+
+ list parents1; parents1 += _E_, _L_;
+ CHECK(assert_equal(_E_,bayesTree.findParentClique(parents1, index)));
+
+ list parents2; parents2 += _L_, _E_;
+ CHECK(assert_equal(_E_,bayesTree.findParentClique(parents2, index)));
}
/* ************************************************************************* */
@@ -131,46 +143,48 @@ Bayes Tree for testing conversion to a forest of orphans needed for incremental.
/* ************************************************************************* */
TEST( BayesTree, removePath )
{
+ Symbol _A_('A', 0), _B_('B', 0), _C_('C', 0), _D_('D', 0), _E_('E', 0), _F_('F',0);
SymbolicConditional::shared_ptr
- A(new SymbolicConditional("A")),
- B(new SymbolicConditional("B", "A")),
- C(new SymbolicConditional("C", "A")),
- D(new SymbolicConditional("D", "C")),
- E(new SymbolicConditional("E", "B")),
- F(new SymbolicConditional("F", "E"));
+ A(new SymbolicConditional(_A_)),
+ B(new SymbolicConditional(_B_, _A_)),
+ C(new SymbolicConditional(_C_, _A_)),
+ D(new SymbolicConditional(_D_, _C_)),
+ E(new SymbolicConditional(_E_, _B_)),
+ F(new SymbolicConditional(_F_, _E_));
SymbolicBayesTree bayesTree;
- bayesTree.insert(A);
- bayesTree.insert(B);
- bayesTree.insert(C);
- bayesTree.insert(D);
- bayesTree.insert(E);
- bayesTree.insert(F);
+ Ordering ord; ord += _A_,_B_,_C_,_D_,_E_,_F_;
+ bayesTree.insert(A,ord);
+ bayesTree.insert(B,ord);
+ bayesTree.insert(C,ord);
+ bayesTree.insert(D,ord);
+ bayesTree.insert(E,ord);
+ bayesTree.insert(F,ord);
// remove C, expected outcome: factor graph with ABC,
// Bayes Tree now contains two orphan trees: D|C and E|B,F|E
SymbolicFactorGraph expected;
- expected.push_factor("A","B");
- expected.push_factor("A");
- expected.push_factor("A","C");
+ expected.push_factor(_A_,_B_);
+ expected.push_factor(_A_);
+ expected.push_factor(_A_,_C_);
SymbolicBayesTree::Cliques expectedOrphans;
- expectedOrphans += bayesTree["D"], bayesTree["E"];
+ expectedOrphans += bayesTree[_D_], bayesTree[_E_];
BayesNet bn;
SymbolicBayesTree::Cliques orphans;
- bayesTree.removePath(bayesTree["C"], bn, orphans);
+ bayesTree.removePath(bayesTree[_C_], bn, orphans);
FactorGraph factors(bn);
CHECK(assert_equal((FactorGraph)expected, factors));
CHECK(assert_equal(expectedOrphans, orphans));
// remove E: factor graph with EB; E|B removed from second orphan tree
SymbolicFactorGraph expected2;
- expected2.push_factor("B","E");
+ expected2.push_factor(_B_,_E_);
SymbolicBayesTree::Cliques expectedOrphans2;
- expectedOrphans2 += bayesTree["F"];
+ expectedOrphans2 += bayesTree[_F_];
BayesNet bn2;
SymbolicBayesTree::Cliques orphans2;
- bayesTree.removePath(bayesTree["E"], bn2, orphans2);
+ bayesTree.removePath(bayesTree[_E_], bn2, orphans2);
FactorGraph factors2(bn2);
CHECK(assert_equal((FactorGraph)expected2, factors2));
CHECK(assert_equal(expectedOrphans2, orphans2));
@@ -184,17 +198,17 @@ TEST( BayesTree, removePath2 )
// Call remove-path with clique B
BayesNet bn;
SymbolicBayesTree::Cliques orphans;
- bayesTree.removePath(bayesTree["B"], bn, orphans);
+ bayesTree.removePath(bayesTree[_B_], bn, orphans);
FactorGraph factors(bn);
// Check expected outcome
SymbolicFactorGraph expected;
- expected.push_factor("B","L","E");
- expected.push_factor("B","L");
- expected.push_factor("B");
+ expected.push_factor(_B_,_L_,_E_);
+ expected.push_factor(_B_,_L_);
+ expected.push_factor(_B_);
CHECK(assert_equal((FactorGraph)expected, factors));
SymbolicBayesTree::Cliques expectedOrphans;
- expectedOrphans += bayesTree["S"], bayesTree["T"], bayesTree["X"];
+ expectedOrphans += bayesTree[_S_], bayesTree[_T_], bayesTree[_X_];
CHECK(assert_equal(expectedOrphans, orphans));
}
@@ -206,18 +220,18 @@ TEST( BayesTree, removePath3 )
// Call remove-path with clique S
BayesNet bn;
SymbolicBayesTree::Cliques orphans;
- bayesTree.removePath(bayesTree["S"], bn, orphans);
+ bayesTree.removePath(bayesTree[_S_], bn, orphans);
FactorGraph factors(bn);
// Check expected outcome
SymbolicFactorGraph expected;
- expected.push_factor("B","L","E");
- expected.push_factor("B","L");
- expected.push_factor("B");
- expected.push_factor("L","B","S");
+ expected.push_factor(_B_,_L_,_E_);
+ expected.push_factor(_B_,_L_);
+ expected.push_factor(_B_);
+ expected.push_factor(_L_,_B_,_S_);
CHECK(assert_equal((FactorGraph)expected, factors));
SymbolicBayesTree::Cliques expectedOrphans;
- expectedOrphans += bayesTree["T"], bayesTree["X"];
+ expectedOrphans += bayesTree[_T_], bayesTree[_X_];
CHECK(assert_equal(expectedOrphans, orphans));
}
@@ -227,7 +241,7 @@ TEST( BayesTree, removeTop )
SymbolicBayesTree bayesTree = createAsiaSymbolicBayesTree();
// create a new factor to be inserted
- boost::shared_ptr newFactor(new SymbolicFactor("B","S"));
+ boost::shared_ptr newFactor(new SymbolicFactor(_B_,_S_));
// Remove the contaminated part of the Bayes tree
BayesNet bn;
@@ -237,17 +251,17 @@ TEST( BayesTree, removeTop )
// Check expected outcome
SymbolicFactorGraph expected;
- expected.push_factor("B","L","E");
- expected.push_factor("B","L");
- expected.push_factor("B");
- expected.push_factor("L","B","S");
+ expected.push_factor(_B_,_L_,_E_);
+ expected.push_factor(_B_,_L_);
+ expected.push_factor(_B_);
+ expected.push_factor(_L_,_B_,_S_);
CHECK(assert_equal((FactorGraph)expected, factors));
SymbolicBayesTree::Cliques expectedOrphans;
- expectedOrphans += bayesTree["T"], bayesTree["X"];
+ expectedOrphans += bayesTree[_T_], bayesTree[_X_];
CHECK(assert_equal(expectedOrphans, orphans));
// Try removeTop again with a factor that should not change a thing
- boost::shared_ptr newFactor2(new SymbolicFactor("B"));
+ boost::shared_ptr newFactor2(new SymbolicFactor(_B_));
BayesNet bn2;
SymbolicBayesTree::Cliques orphans2;
bayesTree.removeTop(newFactor2->keys(), bn2, orphans2);
@@ -265,8 +279,8 @@ TEST( BayesTree, removeTop2 )
// create two factors to be inserted
SymbolicFactorGraph newFactors;
- newFactors.push_factor("B");
- newFactors.push_factor("S");
+ newFactors.push_factor(_B_);
+ newFactors.push_factor(_S_);
// Remove the contaminated part of the Bayes tree
BayesNet bn;
@@ -276,35 +290,38 @@ TEST( BayesTree, removeTop2 )
// Check expected outcome
SymbolicFactorGraph expected;
- expected.push_factor("B","L","E");
- expected.push_factor("B","L");
- expected.push_factor("B");
- expected.push_factor("L","B","S");
+ expected.push_factor(_B_,_L_,_E_);
+ expected.push_factor(_B_,_L_);
+ expected.push_factor(_B_);
+ expected.push_factor(_L_,_B_,_S_);
CHECK(assert_equal((FactorGraph)expected, factors));
SymbolicBayesTree::Cliques expectedOrphans;
- expectedOrphans += bayesTree["T"], bayesTree["X"];
+ expectedOrphans += bayesTree[_T_], bayesTree[_X_];
CHECK(assert_equal(expectedOrphans, orphans));
}
/* ************************************************************************* */
TEST( BayesTree, removeTop3 )
{
+ Symbol _l5_('l', 5), _x4_('x', 4);
// simple test case that failed after COLAMD was fixed/activated
SymbolicConditional::shared_ptr
- X(new SymbolicConditional("l5")),
- A(new SymbolicConditional("x4", "l5")),
- B(new SymbolicConditional("x3", "x4")),
- C(new SymbolicConditional("x2", "x3"));
+ X(new SymbolicConditional(_l5_)),
+ A(new SymbolicConditional(_x4_, _l5_)),
+ B(new SymbolicConditional(_x3_, _x4_)),
+ C(new SymbolicConditional(_x2_, _x3_));
+ Ordering newOrdering;
+ newOrdering += _x3_, _x2_, _x1_, _l2_, _l1_, _x4_, _l5_;
SymbolicBayesTree bayesTree;
- bayesTree.insert(X);
- bayesTree.insert(A);
- bayesTree.insert(B);
- bayesTree.insert(C);
+ bayesTree.insert(X,newOrdering);
+ bayesTree.insert(A,newOrdering);
+ bayesTree.insert(B,newOrdering);
+ bayesTree.insert(C,newOrdering);
// remove all
list keys;
- keys += "l5", "x2", "x3", "x4";
+ keys += _l5_, _x2_, _x3_, _x4_;
BayesNet bn;
SymbolicBayesTree::Cliques orphans;
bayesTree.removeTop(keys, bn, orphans);
diff --git a/cpp/testISAM.cpp b/cpp/testISAM.cpp
index 3d9dfd74b..e2e13253b 100644
--- a/cpp/testISAM.cpp
+++ b/cpp/testISAM.cpp
@@ -30,7 +30,7 @@ typedef ISAM SymbolicISAM;
double sigmax1 = 0.786153, sigmax2 = 0.687131, sigmax3 = 0.671512, sigmax4 =
0.669534, sigmax5 = sigmax3, sigmax6 = sigmax2, sigmax7 = sigmax1;
-/* ************************************************************************* */
+/* ************************************************************************* *
// SLAM example from RSS sqrtSAM paper
SymbolicConditional::shared_ptr x3(new SymbolicConditional("x3")),
@@ -51,7 +51,7 @@ SymbolicISAM createSlamSymbolicISAM(){
return bayesTree_slam;
}
-/* ************************************************************************* */
+/* ************************************************************************* *
// Conditionals for ASIA example from the tutorial with A and D evidence
SymbolicConditional::shared_ptr
@@ -74,7 +74,7 @@ SymbolicISAM createAsiaSymbolicISAM() {
return bayesTree;
}
-/* ************************************************************************* */
+/* ************************************************************************* *
TEST( ISAM, iSAM )
{
SymbolicISAM bayesTree = createAsiaSymbolicISAM();
@@ -108,7 +108,7 @@ TEST( ISAM, iSAM )
CHECK(assert_equal(expected,bayesTree));
}
-/* ************************************************************************* */
+/* ************************************************************************* *
TEST( ISAM, iSAM_slam )
{
// Create using insert
diff --git a/cpp/testKey.cpp b/cpp/testKey.cpp
index 9669eabd8..238793c9f 100644
--- a/cpp/testKey.cpp
+++ b/cpp/testKey.cpp
@@ -31,7 +31,7 @@ TEST ( TypedSymbol, basic_operations ) {
CHECK(key3 < key4);
}
-/* ************************************************************************* */
+/* ************************************************************************* *
TEST ( TypedLabledSymbol, basic_operations ) {
typedef TypedLabeledSymbol RobotKey;