optimization over cliques started
parent
638b174541
commit
34e913e236
|
@ -17,10 +17,28 @@
|
|||
|
||||
#include "Testable.h"
|
||||
#include "BayesTree.h"
|
||||
#include "VectorConfig.h"
|
||||
#include "GaussianConditional.h"
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
typedef BayesTree<GaussianConditional> GaussianBayesTree;
|
||||
#if 0
|
||||
// recursively optimize starting with this conditional and all children
|
||||
void optimize(sharedClique clique, VectorConfig& result) {
|
||||
// parents are assumed to already be solved and available in result
|
||||
BOOST_REVERSE_FOREACH(GaussianConditional::shared_ptr cg, clique) {
|
||||
Vector x = cg->solve(result); // Solve for that variable
|
||||
result.insert(cg->key(),x); // store result in partial solution
|
||||
}
|
||||
BOOST_FOREACH(sharedClique child, clique->children_) {
|
||||
optimize(child, result);
|
||||
}
|
||||
}
|
||||
|
||||
void optimize(const GaussianBayesTree& bayesTree, VectorConfig& result) {
|
||||
// starting from the root, call optimize on each conditional
|
||||
optimize(bayesTree.root(), result);
|
||||
}
|
||||
#endif
|
||||
} /// namespace gtsam
|
||||
|
|
Loading…
Reference in New Issue