fix test case

release/4.3a0
Varun Agrawal 2023-06-28 10:12:13 -04:00
parent e5fea0da52
commit 9b7f4b3f54
2 changed files with 10 additions and 10 deletions

View File

@ -137,7 +137,9 @@ namespace gtsam {
// Applying binary operator to two leaves results in a leaf
NodePtr apply_g_op_fL(const Leaf& fL, const Binary& op) const override {
// fL op gL
NodePtr h(new Leaf(op(fL.constant_, constant_), nrAssignments_));
// TODO(Varun) nrAssignments setting is not correct.
// Depending on f and g, the nrAssignments can be different. This is a bug!
NodePtr h(new Leaf(op(fL.constant_, constant_), fL.nrAssignments()));
return h;
}
@ -496,13 +498,11 @@ namespace gtsam {
// DecisionTree
/****************************************************************************/
template<typename L, typename Y>
DecisionTree<L, Y>::DecisionTree() {
}
DecisionTree<L, Y>::DecisionTree() {}
template<typename L, typename Y>
DecisionTree<L, Y>::DecisionTree(const NodePtr& root) :
root_(root) {
}
root_(root) {}
/****************************************************************************/
template<typename L, typename Y>

View File

@ -356,14 +356,14 @@ size: 2
factor 0: f[ (m0,2), (m1,2), (m2,2), ]
Choice(m2)
0 Choice(m1)
0 0 Leaf [1] 0
0 0 Leaf [2] 0
0 1 Choice(m0)
0 1 0 Leaf [1]0.27527634
0 1 1 Leaf [1]0.44944733
0 1 1 Leaf [1] 0
1 Choice(m1)
1 0 Leaf [1] 0
1 0 Leaf [2] 0
1 1 Choice(m0)
1 1 0 Leaf [1] 0
1 1 0 Leaf [1]0.44944733
1 1 1 Leaf [1]0.27527634
factor 1: f[ (m0,2), (m1,2), (m2,2), (m3,2), ]
Choice(m3)
@ -442,7 +442,7 @@ factor 1: f[ (m0,2), (m1,2), (m2,2), (m3,2), ]
)";
#endif
DiscreteKeys d0{{M(2), 2}, {M(1), 2}, {M(0), 2}};
DiscreteKeys d0{{M(0), 2}, {M(1), 2}, {M(2), 2}};
std::vector<double> p0 = {0, 0, 0.17054468, 0.27845056, 0, 0, 0, 0.17054468};
AlgebraicDecisionTree<Key> dt(d0, p0);
//TODO(Varun) Passing ADT to DiscreteConditional causes nrAssignments to get messed up