forceOrder flag respects order of constrained variables passed to conditionalBayesNet
parent
bd8f9d0006
commit
34a9000134
|
|
@ -31,7 +31,7 @@ using namespace gtsam;
|
||||||
TEST( SymbolicSequentialSolver, SymbolicSequentialSolver ) {
|
TEST( SymbolicSequentialSolver, SymbolicSequentialSolver ) {
|
||||||
// create factor graph
|
// create factor graph
|
||||||
SymbolicFactorGraph g;
|
SymbolicFactorGraph g;
|
||||||
g.push_factor(2, 2, 0);
|
g.push_factor(2, 1, 0);
|
||||||
g.push_factor(2, 0);
|
g.push_factor(2, 0);
|
||||||
g.push_factor(2);
|
g.push_factor(2);
|
||||||
// test solver is Testable
|
// test solver is Testable
|
||||||
|
|
@ -116,12 +116,33 @@ TEST( SymbolicSequentialSolver, inference ) {
|
||||||
SymbolicBayesNet::shared_ptr actualBN = //
|
SymbolicBayesNet::shared_ptr actualBN = //
|
||||||
solver.conditionalBayesNet(js, nrFrontals);
|
solver.conditionalBayesNet(js, nrFrontals);
|
||||||
SymbolicBayesNet expectedBN;
|
SymbolicBayesNet expectedBN;
|
||||||
expectedBN.push_front(boost::make_shared<IndexConditional>(3, 2));
|
expectedBN.push_front(boost::make_shared<IndexConditional>(2, 3));
|
||||||
expectedBN.push_front(boost::make_shared<IndexConditional>(0, 3, 2));
|
expectedBN.push_front(boost::make_shared<IndexConditional>(0, 2, 3));
|
||||||
EXPECT( assert_equal(expectedBN,*actualBN));
|
EXPECT( assert_equal(expectedBN,*actualBN));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
// This test shows a problem with my (Frank) attempt at a faster conditionalBayesNet
|
||||||
|
TEST( SymbolicSequentialSolver, problematicConditional ) {
|
||||||
|
// Create factor graph
|
||||||
|
SymbolicFactorGraph fg;
|
||||||
|
fg.push_factor(9, 12, 14);
|
||||||
|
|
||||||
|
// eliminate
|
||||||
|
SymbolicSequentialSolver solver(fg);
|
||||||
|
// conditionalBayesNet
|
||||||
|
vector<Index> js;
|
||||||
|
js.push_back(12);
|
||||||
|
js.push_back(14);
|
||||||
|
size_t nrFrontals = 1;
|
||||||
|
SymbolicBayesNet::shared_ptr actualBN = //
|
||||||
|
solver.conditionalBayesNet(js, nrFrontals);
|
||||||
|
SymbolicBayesNet expectedBN;
|
||||||
|
expectedBN.push_front(boost::make_shared<IndexConditional>(12,14));
|
||||||
|
EXPECT( assert_equal(expectedBN,*actualBN));
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
int main() {
|
int main() {
|
||||||
TestResult tr;
|
TestResult tr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue