commented out all print statements
parent
f40182518a
commit
76d0a60b88
|
@ -34,7 +34,7 @@ namespace gtsam {
|
||||||
template<class Conditional>
|
template<class Conditional>
|
||||||
void BayesTree<Conditional>::Clique::print(const string& s) const {
|
void BayesTree<Conditional>::Clique::print(const string& s) const {
|
||||||
cout << s;
|
cout << s;
|
||||||
BOOST_REVERSE_FOREACH(const sharedConditional& conditional, this->conditionals_)
|
BOOST_FOREACH(const sharedConditional& conditional, this->conditionals_)
|
||||||
cout << " " << conditional->key();
|
cout << " " << conditional->key();
|
||||||
if (!separator_.empty()) {
|
if (!separator_.empty()) {
|
||||||
cout << " :";
|
cout << " :";
|
||||||
|
@ -199,6 +199,11 @@ namespace gtsam {
|
||||||
const pair<string,typename BayesTree<Conditional>::sharedClique >& v1,
|
const pair<string,typename BayesTree<Conditional>::sharedClique >& v1,
|
||||||
const pair<string,typename BayesTree<Conditional>::sharedClique >& v2
|
const pair<string,typename BayesTree<Conditional>::sharedClique >& v2
|
||||||
) {
|
) {
|
||||||
|
// cout << v1.first << " =? " << v2.first << endl;
|
||||||
|
// cout << (v1.first == v2.first) << endl;
|
||||||
|
// cout << v1.second->equals(*(v2.second)) << endl;
|
||||||
|
// v1.second->print("v1");
|
||||||
|
// v2.second->print("v2");
|
||||||
return v1.first == v2.first && v1.second->equals(*(v2.second));
|
return v1.first == v2.first && v1.second->equals(*(v2.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ typedef BayesTree<GaussianConditional> GaussianBayesTree;
|
||||||
// Conditionals for ASIA example from the tutorial with A and D evidence
|
// Conditionals for ASIA example from the tutorial with A and D evidence
|
||||||
SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
||||||
new SymbolicConditional("L", "B")), E(
|
new SymbolicConditional("L", "B")), E(
|
||||||
new SymbolicConditional("E", "L", "B")), S(new SymbolicConditional("S",
|
new SymbolicConditional("E", "B", "L")), S(new SymbolicConditional("S",
|
||||||
"L", "B")), T(new SymbolicConditional("T", "E", "L")), X(
|
"L", "B")), T(new SymbolicConditional("T", "E", "L")), X(
|
||||||
new SymbolicConditional("X", "E"));
|
new SymbolicConditional("X", "E"));
|
||||||
|
|
||||||
|
@ -34,9 +34,8 @@ SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L(
|
||||||
SymbolicBayesTree update(const SymbolicBayesTree& initial,
|
SymbolicBayesTree update(const SymbolicBayesTree& initial,
|
||||||
const boost::shared_ptr<SymbolicFactor>& newFactor) {
|
const boost::shared_ptr<SymbolicFactor>& newFactor) {
|
||||||
|
|
||||||
// create a factor graph with the new factor in it
|
// create an empty factor graph
|
||||||
SymbolicFactorGraph factorGraph;
|
SymbolicFactorGraph factorGraph;
|
||||||
factorGraph.push_back(newFactor);
|
|
||||||
|
|
||||||
// get the ELB clique
|
// get the ELB clique
|
||||||
SymbolicBayesTree::sharedClique ELB = initial["B"];
|
SymbolicBayesTree::sharedClique ELB = initial["B"];
|
||||||
|
@ -52,6 +51,9 @@ SymbolicBayesTree update(const SymbolicBayesTree& initial,
|
||||||
// add it to the factor graph
|
// add it to the factor graph
|
||||||
factorGraph = combine(factorGraph, SLB_factors);
|
factorGraph = combine(factorGraph, SLB_factors);
|
||||||
|
|
||||||
|
// now add the new factor
|
||||||
|
factorGraph.push_back(newFactor);
|
||||||
|
|
||||||
// create an ordering ESLB
|
// create an ordering ESLB
|
||||||
Ordering ordering;
|
Ordering ordering;
|
||||||
ordering += "E","S","L","B";
|
ordering += "E","S","L","B";
|
||||||
|
@ -62,13 +64,14 @@ SymbolicBayesTree update(const SymbolicBayesTree& initial,
|
||||||
// turn back into a Bayes Tree
|
// turn back into a Bayes Tree
|
||||||
BayesTree<SymbolicConditional> newTree(bayesNet);
|
BayesTree<SymbolicConditional> newTree(bayesNet);
|
||||||
|
|
||||||
// add orphans to the bottom of the new tree
|
// get the orphan cliques
|
||||||
// get the ophan cliques
|
|
||||||
SymbolicBayesTree::sharedClique TEL = initial["T"];
|
SymbolicBayesTree::sharedClique TEL = initial["T"];
|
||||||
SymbolicBayesTree::sharedClique XE = initial["X"];
|
SymbolicBayesTree::sharedClique XE = initial["X"];
|
||||||
|
|
||||||
// get clique from new tree to attach to
|
// get clique from new tree to attach to
|
||||||
SymbolicBayesTree::sharedClique new_ELB = newTree["E"];
|
SymbolicBayesTree::sharedClique new_ELB = newTree["E"];
|
||||||
|
|
||||||
|
// add orphans to the bottom of the new tree
|
||||||
new_ELB->children_ += TEL,XE;
|
new_ELB->children_ += TEL,XE;
|
||||||
|
|
||||||
return newTree;
|
return newTree;
|
||||||
|
@ -85,7 +88,6 @@ TEST( BayesTree, iSAM )
|
||||||
bayesTree.insert(S);
|
bayesTree.insert(S);
|
||||||
bayesTree.insert(T);
|
bayesTree.insert(T);
|
||||||
bayesTree.insert(X);
|
bayesTree.insert(X);
|
||||||
//bayesTree.print("bayesTree");
|
|
||||||
|
|
||||||
// Create expected Bayes tree
|
// Create expected Bayes tree
|
||||||
SymbolicBayesTree expected;
|
SymbolicBayesTree expected;
|
||||||
|
@ -95,7 +97,6 @@ TEST( BayesTree, iSAM )
|
||||||
expected.insert(E);
|
expected.insert(E);
|
||||||
expected.insert(T);
|
expected.insert(T);
|
||||||
expected.insert(X);
|
expected.insert(X);
|
||||||
//expected.print("expected");
|
|
||||||
|
|
||||||
// create a new factor to be inserted
|
// create a new factor to be inserted
|
||||||
list<string> keys;
|
list<string> keys;
|
||||||
|
|
Loading…
Reference in New Issue