|
|
| Choice () |
| | Default constructor for serialization.
|
| bool | isLeaf () const override |
|
| Choice (const L &label, size_t count) |
| | Constructor, given choice label and mandatory expected branch count.
|
|
| Choice (const Choice &f, const Choice &g, const Binary &op) |
| | Construct from applying binary op to two Choice nodes.
|
|
const L & | label () const |
| | Return the label of this choice node.
|
|
size_t | nrChoices () const |
|
const std::vector< NodePtr > & | branches () const |
|
std::vector< NodePtr > & | branches () |
|
void | push_back (NodePtr &&node) |
| | add a branch: TODO merge into constructor
|
| void | print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const override |
| | print (as a tree).
|
| void | dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero) const override |
| | output to graphviz (as a a graph)
|
| bool | sameLeaf (const Leaf &q) const override |
| | Choice-Leaf equality: always false.
|
| bool | sameLeaf (const Node &q) const override |
| | polymorphic equality: if q is a leaf, could be...
|
| bool | equals (const Node &q, const CompareFunc &compare) const override |
| | equality
|
| const Y & | operator() (const Assignment< L > &x) const override |
| | evaluate
|
|
| Choice (const L &label, const Choice &f, const Unary &op) |
| | Construct from applying unary op to a Choice node.
|
| | Choice (const L &label, const Choice &f, const UnaryAssignment &op, const Assignment< L > &assignment) |
| | Constructor which accepts a UnaryAssignment op and the corresponding assignment.
|
| NodePtr | apply (const Unary &op) const override |
| | apply unary operator.
|
| NodePtr | apply (const UnaryAssignment &op, const Assignment< L > &assignment) const override |
| | Apply unary operator with assignment.
|
| NodePtr | apply_f_op_g (const Node &g, const Binary &op) const override |
| NodePtr | apply_g_op_fL (const Leaf &fL, const Binary &op) const override |
| NodePtr | apply_g_op_fC (const Choice &fC, const Binary &op) const override |
|
template<typename OP> |
| NodePtr | apply_fC_op_gL (const Leaf &gL, OP op) const |
| NodePtr | choose (const L &label, size_t index) const override |
| | choose a branch, recursively
|
|
const void * | id () const |
template<typename L, typename Y>
template<typename L, typename Y>
Merge branches with equal leaf values for every choice node in a decision tree.
If all branches are the same (i.e. have the same leaf value), replace the choice node with the equivalent leaf node.
This function applies the branch merging (if enabled) recursively on the decision tree represented by the root node passed in as the argument. It recurses to the leaf nodes and merges branches with equal leaf values in a bottom-up fashion.
Thus, if all branches of a choice node f are the same, just return a single branch at each recursion step.
- Parameters
-
| node | The root node of the decision tree. |
- Returns
- NodePtr