Added EliminationTree framework

release/4.3a0
Frank Dellaert 2010-07-14 15:22:37 +00:00
parent c19a404ae2
commit bd58c65a9c
8 changed files with 133 additions and 10 deletions

View File

@ -610,6 +610,14 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="testEliminationTree.run" path="build/inference" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>testEliminationTree.run</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="check" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>check</buildTarget>

View File

@ -0,0 +1,24 @@
/*
* EliminationTree-inl.h
* Created on: Feb 4, 2010
* @Author: Kai Ni
* @Author: Frank Dellaert
* @brief: The elimination tree, template bodies
*/
#pragma once
#include <boost/foreach.hpp>
#include "EliminationTree.h"
namespace gtsam {
using namespace std;
/* ************************************************************************* */
template <class FG>
EliminationTree<FG>::EliminationTree(FG& fg, const Ordering& ordering) {
}
} //namespace gtsam

View File

@ -0,0 +1,40 @@
/*
* EliminationTree.h
* Created on: Feb 4, 2010
* @Author: Kai Ni
* @Author: Frank Dellaert
* @brief: The elimination tree
*/
#pragma once
#include <set>
#include "ClusterTree.h"
namespace gtsam {
/**
* An elimination tree (see Gilbert01bit) associated with a factorg raph and an ordering
* is a cluster-tree where there is one node j for each variable, and the parent of each node
* corresponds to the first variable in the ordering that variable j is connected to.
*/
template<class FG>
class EliminationTree: public ClusterTree<FG> {
public:
// In a junction tree each cluster is associated with a clique
typedef typename ClusterTree<FG>::Cluster Node;
typedef typename Node::shared_ptr sharedNode;
public:
// constructor
EliminationTree() {
}
// constructor given a factor graph and the elimination ordering
EliminationTree(FG& fg, const Ordering& ordering);
}; // EliminationTree
} // namespace gtsam

View File

@ -1,9 +1,9 @@
/*
* JunctionTree-inl.h
*
* Created on: Feb 4, 2010
* Author: nikai
* Description: the junction tree
* Created on: Feb 4, 2010
* @Author: Kai Ni
* @Author: Frank Dellaert
* @brief: The junction tree, template bodies
*/
#pragma once

View File

@ -1,9 +1,9 @@
/*
* JunctionTree.h
*
* Created on: Feb 4, 2010
* Author: nikai
* Description: The junction tree
* Created on: Feb 4, 2010
* @Author: Kai Ni
* @Author: Frank Dellaert
* @brief: The junction tree
*/
#pragma once

View File

@ -26,11 +26,12 @@ headers += graph.h graph-inl.h
headers += FactorGraph.h FactorGraph-inl.h
headers += ClusterTree.h ClusterTree-inl.h
headers += JunctionTree.h JunctionTree-inl.h
headers += EliminationTree.h EliminationTree-inl.h
headers += BayesNet.h BayesNet-inl.h
headers += BayesTree.h BayesTree-inl.h
headers += ISAM.h ISAM-inl.h
headers += ISAM2.h ISAM2-inl.h
check_PROGRAMS += testFactorGraph testClusterTree testJunctionTree testBayesTree testISAM
check_PROGRAMS += testFactorGraph testClusterTree testEliminationTree testJunctionTree testBayesTree testISAM
#----------------------------------------------------------------------------------------------------
# discrete

View File

@ -0,0 +1,50 @@
/**
* @file testEliminationTree.cpp
* @brief Unit tests for Elimination Tree
* @author Kai Ni
* @author Frank Dellaert
*/
#include <boost/assign/std/list.hpp> // for operator +=
#include <boost/assign/std/set.hpp> // for operator +=
using namespace boost::assign;
#include <CppUnitLite/TestHarness.h>
#define GTSAM_MAGIC_KEY
#include "SymbolicFactorGraph.h"
#include "ClusterTree-inl.h"
#include "EliminationTree-inl.h"
using namespace gtsam;
// explicit instantiation and typedef
template class EliminationTree<SymbolicFactorGraph>;
typedef EliminationTree<SymbolicFactorGraph> SymbolicEliminationTree;
/* ************************************************************************* *
* graph: x1 - x2 - x3 - x4
* tree: x1 -> x2 -> x3 -> x4 (arrow is parent pointer)
****************************************************************************/
TEST( EliminationTree, constructor )
{
SymbolicFactorGraph fg;
fg.push_factor("x1","x2");
fg.push_factor("x2","x3");
fg.push_factor("x3","x4");
SymbolicEliminationTree expected();
Ordering ordering; ordering += "x2","x1","x3","x4";
SymbolicEliminationTree actual(fg, ordering);
// CHECK(assert_equal(expected, actual));
}
/* ************************************************************************* */
int main() {
TestResult tr;
return TestRegistry::runAllTests(tr);
}
/* ************************************************************************* */

View File

@ -1,6 +1,6 @@
/**
* @file testJunctionTree.cpp
* @brief Unit tests for Bayes Tree
* @brief Unit tests for Junction Tree
* @author Kai Ni
* @author Frank Dellaert
*/