Package info.scce.addlib.dd.xdd
Class XDD<E>
- java.lang.Object
-
- info.scce.addlib.dd.DD<M,D>
-
- info.scce.addlib.dd.RegularDD<XDDManager<E>,XDD<E>>
-
- info.scce.addlib.dd.xdd.XDD<E>
-
- Type Parameters:
E
- Data type of decision diagram
public class XDD<E> extends RegularDD<XDDManager<E>,XDD<E>>
Extends decision diagrams to handle arbitrary data types (algebraic decision diagrams). Refer to the wiki documentation for performance considerations.
-
-
Constructor Summary
Constructors Constructor Description XDD(long ptr, XDDManager<E> ddManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XDD<E>
add(XDD<E> g)
XDD<E>
addInverse()
XDD<E>
and(XDD<E> g)
XDD<E>
apply(BinaryOperator<E> op, XDD<E> g)
Calls a binary function on the values of XDD andg
and computes the result.XDD<E>
apply2(BinaryOperator<XDD<E>> op, XDD<E> g)
Calls a binary function on the XDD andg
themselves and computes the result.XDD<E>
compl()
XDD<E>
e()
Returns the else DD of the root.XDD<E>
eval(boolean... input)
Evaluate the DD based on a given assignment.E
eval(Function<String,@Nullable Boolean> ddNameToTruthValue)
Evaluate the XDD with a function with variable names as input and boolean assignments as output.E
eval(Map<String,Boolean> ddNameToTruthValueMap)
Evaluate the XDD with a mapping of variable names to boolean assignments.XDD<E>
inf(XDD<E> g)
XDD<E>
intersect(XDD<E> g)
XDD<E>
inverse()
XDD<E>
join(XDD<E> g)
XDD<E>
meet(XDD<E> g)
XDD<E>
monadicApply(UnaryOperator<E> op)
Calls a unary function on the values of the ADD and computes the result.XDD<E>
monadicApply2(UnaryOperator<XDD<E>> op)
Calls a unary function on the ADD itself and computes the result.<E2> XDD<E2>
monadicTransform(XDDManager<E2> ddManagerTarget, Function<E,E2> op)
Transforms the XDD to another data type.<E2> XDD<E2>
monadicTransform2(XDDManager<E2> ddManagerTarget, Function<XDD<E>,XDD<E2>> op)
XDD<E>
mult(XDD<E> g)
XDD<E>
multInverse()
XDD<E>
not()
XDD<E>
or(XDD<E> g)
XDD<E>
sup(XDD<E> g)
XDD<E>
t()
Returns the then DD of the root.protected XDD<E>
thisCasted()
String
toString()
<E2,E3>
XDD<E3>transform(XDDManager<E3> ddManagerTarget, BiFunction<E,E2,E3> op, XDD<E2> g)
<E2,E3>
XDD<E3>transform2(XDDManager<E3> ddManagerTarget, BiFunction<XDD<E>,XDD<E2>,XDD<E3>> op, XDD<E2> g)
XDD<E>
union(XDD<E> g)
@NonNull E
v()
Returns the value of the DD if the root is a leaf.-
Methods inherited from class info.scce.addlib.dd.DD
assertConstant, assertEqualDDManager, assertEqualDDManager, assertNonConstant, dagSize, ddManager, equals, hashCode, isConstant, ptr, readIndex, readName, readPerm, recursiveDeref, ref, regularPtr, withRef
-
-
-
-
Constructor Detail
-
XDD
public XDD(long ptr, XDDManager<E> ddManager)
-
-
Method Detail
-
v
public @NonNull E v()
Returns the value of the DD if the root is a leaf. Otherwise, throws an exception.- Returns:
- Value of root node
-
apply
public XDD<E> apply(BinaryOperator<E> op, XDD<E> g)
Calls a binary function on the values of XDD andg
and computes the result.
-
apply2
public XDD<E> apply2(BinaryOperator<XDD<E>> op, XDD<E> g)
Calls a binary function on the XDD andg
themselves and computes the result. The function is recursively applied to all nodes compared to apply. Note that the result of the function is not dereferenced, so avoid using functions that create new references or store the references, otherwise the pointers remain in the memory.Might crash if another method that accepts two XDDs is called.
-
monadicApply
public XDD<E> monadicApply(UnaryOperator<E> op)
Calls a unary function on the values of the ADD and computes the result.
-
monadicApply2
public XDD<E> monadicApply2(UnaryOperator<XDD<E>> op)
Calls a unary function on the ADD itself and computes the result. The function is recursively applied to all nodes compared to monadicApply. Note that the result of the function is not dereferenced, so avoid using functions that or store the references, otherwise the pointers remain in the memory.
-
transform
public <E2,E3> XDD<E3> transform(XDDManager<E3> ddManagerTarget, BiFunction<E,E2,E3> op, XDD<E2> g)
-
transform2
public <E2,E3> XDD<E3> transform2(XDDManager<E3> ddManagerTarget, BiFunction<XDD<E>,XDD<E2>,XDD<E3>> op, XDD<E2> g)
-
monadicTransform
public <E2> XDD<E2> monadicTransform(XDDManager<E2> ddManagerTarget, Function<E,E2> op)
Transforms the XDD to another data type.- Parameters:
ddManagerTarget
- Manager for transformed XDDop
- Transformation function from old to new type- Returns:
- Transformed XDD.
-
monadicTransform2
public <E2> XDD<E2> monadicTransform2(XDDManager<E2> ddManagerTarget, Function<XDD<E>,XDD<E2>> op)
-
thisCasted
protected XDD<E> thisCasted()
- Specified by:
thisCasted
in classDD<XDDManager<E>,XDD<E>>
-
t
public XDD<E> t()
Description copied from class:DD
Returns the then DD of the root. If the root is constant, an exception is thrown by C.
-
e
public XDD<E> e()
Description copied from class:DD
Returns the else DD of the root. If the root is constant, an exception is thrown by C.
-
eval
public XDD<E> eval(boolean... input)
Description copied from class:DD
Evaluate the DD based on a given assignment.
-
eval
public E eval(Map<String,Boolean> ddNameToTruthValueMap)
Evaluate the XDD with a mapping of variable names to boolean assignments.- Parameters:
ddNameToTruthValueMap
- Map of variable assignments- Returns:
- Result of evaluation
-
eval
public E eval(Function<String,@Nullable Boolean> ddNameToTruthValue)
Evaluate the XDD with a function with variable names as input and boolean assignments as output.- Parameters:
ddNameToTruthValue
- Function for variable assignments- Returns:
- Result of evaluation
-
-