pyddlib package¶
Submodules¶
pyddlib.add module¶
-
class
pyddlib.add.
ADD
(index, low, high, value)[source]¶ Bases:
pyddlib.dd.DD
Reduced Ordered Algebraic Decision Diagram class.
Parameters: - index (int) – root vertex variable index (-1 if terminal vertex)
- low (pyddlib.ADD) – low child vertex of ADD (None if terminal vertex)
- high (pyddlib.ADD) – high child vertex of ADD (None if terminal vertex)
- value – terminal numeric value (None if non-terminal vertex)
-
classmethod
constant
(value)[source]¶ Return a terminal node with a given numeric value.
Parameters: value (Number) – numeric value Return type: pyddlib.ADD
-
index
¶ Return variable index of node.
Return type: int
-
is_constant
()[source]¶ Return True if ADD function represents a constant value. Otherwise, return False.
Return type: bool
-
is_terminal
()[source]¶ Return True if ADD function represents a constant value. Otherwise, return False.
Return type: bool
-
is_variable
()[source]¶ Return True if ADD function represents the function of a single boolean variable. Otherwise, return False.
Return type: bool
-
marginalize
(variable)[source]¶ Compute a new reduced ADD with variable marginalized. Return self.restrict({variable.index: 1}) + self.restrict({variable.index: 0})
Parameters: variable – ADD variable node Return type: pyddlib.ADD
-
classmethod
terminal
(value)[source]¶ Return a terminal node with a given numeric value.
Parameters: value (Number) – numeric value Return type: pyddlib.ADD
-
value
¶ Return node value.
Return type: Number or None
pyddlib.bdd module¶
-
class
pyddlib.bdd.
BDD
(index, low, high, value)[source]¶ Bases:
pyddlib.dd.DD
Reduced Ordered Binary Decision Diagram class.
Parameters: - index (int) – root vertex variable index (-1 if terminal vertex)
- low (pyddlib.BDD) – low child vertex of BDD (None if terminal vertex)
- high (pyddlib.BDD) – high child vertex of BDD (None if terminal vertex)
- value – terminal boolean value (None if non-terminal vertex)
-
is_one
()[source]¶ Return True if BDD function represents boolean value True. Otherwise, return False.
Return type: bool
-
is_terminal
()[source]¶ Return True if BDD function represents a constant value. Otherwise, return False.
Return type: bool
-
is_variable
()[source]¶ Return True if BDD function represents the function of a single boolean variable. Otherwise, return False.
Return type: bool
-
is_zero
()[source]¶ Return True if BDD function represents boolean value False. Otherwise, return False.
Return type: bool
-
classmethod
one
()[source]¶ Return the BDD representing the constant function True.
Return type: pyddlib.BDD
-
classmethod
terminal
(value)[source]¶ Return a terminal node with a given boolean value.
Parameters: value (bool) – True or False Return type: pyddlib.BDD
pyddlib.dd module¶
-
class
pyddlib.dd.
DD
[source]¶ Bases:
object
Decision Diagram abstract base class.
-
classmethod
apply
(v1, v2, op)[source]¶ Return a new canonical representation of the pyddlib.DD object for the result of v1 op v2.
Parameters: - v1 (pyddlib.DD) – root vertex of left operand
- v2 (pyddlib.DD) – root vertex of right operand
- op (callable object or function) – a binary operator
Return type: pyddlib.DD
-
classmethod