From c7e76891da018df51a095762a8dd0fc3c45d5f58 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Wed, 18 Nov 2009 17:03:19 +0000 Subject: [PATCH] skeleton hardcoded version --- cpp/testIncremental.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/cpp/testIncremental.cpp b/cpp/testIncremental.cpp index 34bd1f816..dce4385f6 100644 --- a/cpp/testIncremental.cpp +++ b/cpp/testIncremental.cpp @@ -10,7 +10,7 @@ using namespace boost::assign; #include #include "SymbolicBayesNet.h" -#include "SymbolicFactor.h" +#include "SymbolicFactorGraph.h" #include "GaussianBayesNet.h" #include "Ordering.h" #include "BayesTree-inl.h" @@ -31,8 +31,31 @@ SymbolicConditional::shared_ptr B(new SymbolicConditional("B")), L( /* ************************************************************************* */ -SymbolicBayesTree update(const SymbolicBayesTree& initial, const SymbolicFactor& newFactor) { - return initial; +SymbolicBayesTree update(const SymbolicBayesTree& initial, + const boost::shared_ptr& newFactor) { + + // create a factor graph with the new factor in it + SymbolicFactorGraph factorGraph; + factorGraph.push_back(newFactor); + + // get the ELB clique + // add it to the factor graph + // get the SLB clique + // add it to the factor graph + + // create an ordering ESLB + Ordering ordering; + ordering += "S","B"; + + // eliminate into a Bayes net + SymbolicBayesNet bayesNet = eliminate(factorGraph,ordering); + + // turn back into a Bayes Tree + BayesTree newTree(bayesNet); + + // add orphans to the bottom of the new tree + + return newTree; } /* ************************************************************************* */ @@ -61,7 +84,7 @@ TEST( BayesTree, iSAM ) // create a new factor to be inserted list keys; keys += "B","S"; - SymbolicFactor newFactor(keys); + boost::shared_ptr newFactor(new SymbolicFactor(keys)); // do incremental inference SymbolicBayesTree actual = update(bayesTree, newFactor);