Fixed more compile warnings
parent
83f3e14261
commit
8bfd392b9f
|
|
@ -39,114 +39,114 @@ typedef ISAM<IndexConditional> SymbolicISAM;
|
||||||
double sigmax1 = 0.786153, sigmax2 = 0.687131, sigmax3 = 0.671512, sigmax4 =
|
double sigmax1 = 0.786153, sigmax2 = 0.687131, sigmax3 = 0.671512, sigmax4 =
|
||||||
0.669534, sigmax5 = sigmax3, sigmax6 = sigmax2, sigmax7 = sigmax1;
|
0.669534, sigmax5 = sigmax3, sigmax6 = sigmax2, sigmax7 = sigmax1;
|
||||||
|
|
||||||
/* ************************************************************************* *
|
/* ************************************************************************* */
|
||||||
|
|
||||||
// SLAM example from RSS sqrtSAM paper
|
//// SLAM example from RSS sqrtSAM paper
|
||||||
SymbolicConditional::shared_ptr x3(new SymbolicConditional("x3")),
|
//SymbolicConditional::shared_ptr x3(new SymbolicConditional("x3")),
|
||||||
x2(new SymbolicConditional("x2","x3")),
|
// x2(new SymbolicConditional("x2","x3")),
|
||||||
x1(new SymbolicConditional("x1","x2","x3")),
|
// x1(new SymbolicConditional("x1","x2","x3")),
|
||||||
l1(new SymbolicConditional("l1","x1","x2")),
|
// l1(new SymbolicConditional("l1","x1","x2")),
|
||||||
l2(new SymbolicConditional("l2","x1","x3"));
|
// l2(new SymbolicConditional("l2","x1","x3"));
|
||||||
|
//
|
||||||
|
//// ISAM for sqrtSAM example
|
||||||
|
//SymbolicISAM createSlamSymbolicISAM(){
|
||||||
|
// // Create using insert
|
||||||
|
// SymbolicISAM bayesTree_slam;
|
||||||
|
// bayesTree_slam.insert(x3);
|
||||||
|
// bayesTree_slam.insert(x2);
|
||||||
|
// bayesTree_slam.insert(x1);
|
||||||
|
// bayesTree_slam.insert(l2);
|
||||||
|
// bayesTree_slam.insert(l1);
|
||||||
|
// return bayesTree_slam;
|
||||||
|
//}
|
||||||
|
|
||||||
// ISAM for sqrtSAM example
|
/* ************************************************************************* */
|
||||||
SymbolicISAM createSlamSymbolicISAM(){
|
|
||||||
// Create using insert
|
|
||||||
SymbolicISAM bayesTree_slam;
|
|
||||||
bayesTree_slam.insert(x3);
|
|
||||||
bayesTree_slam.insert(x2);
|
|
||||||
bayesTree_slam.insert(x1);
|
|
||||||
bayesTree_slam.insert(l2);
|
|
||||||
bayesTree_slam.insert(l1);
|
|
||||||
return bayesTree_slam;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* *
|
//// Conditionals for ASIA example from the tutorial with A and D evidence
|
||||||
|
//SymbolicConditional::shared_ptr
|
||||||
// Conditionals for ASIA example from the tutorial with A and D evidence
|
// B(new SymbolicConditional("B")),
|
||||||
SymbolicConditional::shared_ptr
|
// L(new SymbolicConditional("L", "B")),
|
||||||
B(new SymbolicConditional("B")),
|
// E(new SymbolicConditional("E", "B", "L")),
|
||||||
L(new SymbolicConditional("L", "B")),
|
// S(new SymbolicConditional("S", "L", "B")),
|
||||||
E(new SymbolicConditional("E", "B", "L")),
|
// T(new SymbolicConditional("T", "E", "L")),
|
||||||
S(new SymbolicConditional("S", "L", "B")),
|
// X(new SymbolicConditional("X", "E"));
|
||||||
T(new SymbolicConditional("T", "E", "L")),
|
//
|
||||||
X(new SymbolicConditional("X", "E"));
|
//// ISAM for Asia example
|
||||||
|
//SymbolicISAM createAsiaSymbolicISAM() {
|
||||||
// ISAM for Asia example
|
// SymbolicISAM bayesTree;
|
||||||
SymbolicISAM createAsiaSymbolicISAM() {
|
// bayesTree.insert(B);
|
||||||
SymbolicISAM bayesTree;
|
// bayesTree.insert(L);
|
||||||
bayesTree.insert(B);
|
// bayesTree.insert(E);
|
||||||
bayesTree.insert(L);
|
// bayesTree.insert(S);
|
||||||
bayesTree.insert(E);
|
// bayesTree.insert(T);
|
||||||
bayesTree.insert(S);
|
// bayesTree.insert(X);
|
||||||
bayesTree.insert(T);
|
// return bayesTree;
|
||||||
bayesTree.insert(X);
|
//}
|
||||||
return bayesTree;
|
//
|
||||||
}
|
///* ************************************************************************* */
|
||||||
|
//TEST( ISAM, iSAM )
|
||||||
/* ************************************************************************* *
|
//{
|
||||||
TEST( ISAM, iSAM )
|
// SymbolicISAM bayesTree = createAsiaSymbolicISAM();
|
||||||
{
|
//
|
||||||
SymbolicISAM bayesTree = createAsiaSymbolicISAM();
|
// // Now we modify the Bayes tree by inserting a new factor over B and S
|
||||||
|
//
|
||||||
// Now we modify the Bayes tree by inserting a new factor over B and S
|
// // New conditionals in modified top of the tree
|
||||||
|
// SymbolicConditional::shared_ptr
|
||||||
// New conditionals in modified top of the tree
|
// S_(new SymbolicConditional("S")),
|
||||||
SymbolicConditional::shared_ptr
|
// B_(new SymbolicConditional("B", "S")),
|
||||||
S_(new SymbolicConditional("S")),
|
// L_(new SymbolicConditional("L", "B", "S"));
|
||||||
B_(new SymbolicConditional("B", "S")),
|
//
|
||||||
L_(new SymbolicConditional("L", "B", "S"));
|
// // Create expected Bayes tree
|
||||||
|
// SymbolicISAM expected;
|
||||||
// Create expected Bayes tree
|
// expected.insert(S_);
|
||||||
SymbolicISAM expected;
|
// expected.insert(B_);
|
||||||
expected.insert(S_);
|
// expected.insert(L_);
|
||||||
expected.insert(B_);
|
// expected.insert(E);
|
||||||
expected.insert(L_);
|
// expected.insert(T);
|
||||||
expected.insert(E);
|
// expected.insert(X);
|
||||||
expected.insert(T);
|
//
|
||||||
expected.insert(X);
|
// // create new factors to be inserted
|
||||||
|
// SymbolicFactorGraph factorGraph;
|
||||||
// create new factors to be inserted
|
// factorGraph.push_factor("B","S");
|
||||||
SymbolicFactorGraph factorGraph;
|
// factorGraph.push_factor("B");
|
||||||
factorGraph.push_factor("B","S");
|
//
|
||||||
factorGraph.push_factor("B");
|
// // do incremental inference
|
||||||
|
// bayesTree.update(factorGraph);
|
||||||
// do incremental inference
|
//
|
||||||
bayesTree.update(factorGraph);
|
// // Check whether the same
|
||||||
|
// CHECK(assert_equal(expected,bayesTree));
|
||||||
// Check whether the same
|
//}
|
||||||
CHECK(assert_equal(expected,bayesTree));
|
//
|
||||||
}
|
///* ************************************************************************* */
|
||||||
|
//TEST( ISAM, iSAM_slam )
|
||||||
/* ************************************************************************* *
|
//{
|
||||||
TEST( ISAM, iSAM_slam )
|
// // Create using insert
|
||||||
{
|
// SymbolicISAM bayesTree_slam = createSlamSymbolicISAM();
|
||||||
// Create using insert
|
//
|
||||||
SymbolicISAM bayesTree_slam = createSlamSymbolicISAM();
|
// //New conditionals for the expected Bayes tree
|
||||||
|
// SymbolicConditional::shared_ptr
|
||||||
//New conditionals for the expected Bayes tree
|
// l1_(new SymbolicConditional("l1","x1","x2","x3"));
|
||||||
SymbolicConditional::shared_ptr
|
//
|
||||||
l1_(new SymbolicConditional("l1","x1","x2","x3"));
|
// // Create expected Bayes tree
|
||||||
|
// SymbolicISAM expected_slam;
|
||||||
// Create expected Bayes tree
|
// expected_slam.insert(x3);
|
||||||
SymbolicISAM expected_slam;
|
// expected_slam.insert(x2);
|
||||||
expected_slam.insert(x3);
|
// expected_slam.insert(x1);
|
||||||
expected_slam.insert(x2);
|
// expected_slam.insert(l1_);
|
||||||
expected_slam.insert(x1);
|
// expected_slam.insert(l2);
|
||||||
expected_slam.insert(l1_);
|
//
|
||||||
expected_slam.insert(l2);
|
//
|
||||||
|
// // create new factors to be inserted
|
||||||
|
// SymbolicFactorGraph factorGraph_slam;
|
||||||
// create new factors to be inserted
|
// factorGraph_slam.push_factor("x3","l1");
|
||||||
SymbolicFactorGraph factorGraph_slam;
|
// factorGraph_slam.push_factor("x3");
|
||||||
factorGraph_slam.push_factor("x3","l1");
|
//
|
||||||
factorGraph_slam.push_factor("x3");
|
// // do incremental inference
|
||||||
|
// bayesTree_slam.update(factorGraph_slam);
|
||||||
// do incremental inference
|
//
|
||||||
bayesTree_slam.update(factorGraph_slam);
|
// // Check whether the same
|
||||||
|
// CHECK(assert_equal(expected_slam,bayesTree_slam));
|
||||||
// Check whether the same
|
//}
|
||||||
CHECK(assert_equal(expected_slam,bayesTree_slam));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
|
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue