expansion
Applies a given operation over a BinaryDecisionDiagram using the Shannon Expansion. The result is a reduction of a given diagram, determined by applying an operation recursively over a BDD with bottom-up order: each Terminal is mapped to falseTerminal/trueTerminal, and each Variable is folded with operator, receiving the already-computed E values of its low/high sub-diagrams.
This is the core mechanism 2P-Kt uses to turn a BDD-encoded probabilistic explanation into a probability value via Weighted Model Counting: see it.unibo.tuprolog.solve.problog.lib.knowledge.impl.BinaryDecisionDiagramExplanation.probability, which computes node.probability * high + (1.0 - node.probability) * low bottom-up over the diagram.
Return
the E value resulting from folding the whole diagram.
Parameters
the E value associated to a false Terminal.
the E value associated to a true Terminal.
combines a BinaryDecisionDiagram.Variable's value with the already computed E values of its low and high sub-diagrams.
Throws
if the computation fails, e.g. because operator throws.