fix testCSP by using the default key ordering.
parent
bf11f93cee
commit
1531abd285
|
@ -15,8 +15,8 @@ using namespace std;
|
|||
namespace gtsam {
|
||||
|
||||
/// Find the best total assignment - can be expensive
|
||||
CSP::sharedValues CSP::optimalAssignment() const {
|
||||
DiscreteBayesNet::shared_ptr chordal = this->eliminateSequential();
|
||||
CSP::sharedValues CSP::optimalAssignment(OptionalOrdering ordering) const {
|
||||
DiscreteBayesNet::shared_ptr chordal = this->eliminateSequential(ordering);
|
||||
sharedValues mpe = chordal->optimize();
|
||||
return mpe;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace gtsam {
|
|||
// }
|
||||
|
||||
/// Find the best total assignment - can be expensive
|
||||
sharedValues optimalAssignment() const;
|
||||
sharedValues optimalAssignment(OptionalOrdering ordering = boost::none) const;
|
||||
|
||||
// /*
|
||||
// * Perform loopy belief propagation
|
||||
|
|
|
@ -116,7 +116,9 @@ TEST_UNSAFE( CSP, WesternUS)
|
|||
csp.addAllDiff(CO,NM);
|
||||
|
||||
// Solve
|
||||
CSP::sharedValues mpe = csp.optimalAssignment();
|
||||
Ordering ordering;
|
||||
ordering += Key(0),Key(1),Key(2),Key(3),Key(4),Key(5),Key(6),Key(7),Key(8),Key(9),Key(10);
|
||||
CSP::sharedValues mpe = csp.optimalAssignment(ordering);
|
||||
// GTSAM_PRINT(*mpe);
|
||||
CSP::Values expected;
|
||||
insert(expected)
|
||||
|
@ -127,7 +129,6 @@ TEST_UNSAFE( CSP, WesternUS)
|
|||
// TODO: Fix me! mpe result seems to be right. (See the printing)
|
||||
// It has the same prob as the expected solution.
|
||||
// Is mpe another solution, or the expected solution is unique???
|
||||
cout << csp(*mpe) << " should be >= " << csp(expected) << endl;
|
||||
EXPECT(assert_equal(expected,*mpe));
|
||||
EXPECT_DOUBLES_EQUAL(1, csp(*mpe), 1e-9);
|
||||
|
||||
|
|
Loading…
Reference in New Issue