edu.toronto.cs.mdd
Class MDDManager

java.lang.Object
  extended by edu.toronto.cs.mdd.MDDManager

public class MDDManager
extends java.lang.Object

Multi-Valued Decision Diagram package add reference to authors and publications!

Version:
1.1
Author:
B. Devereux, A. Gurfinkel

Nested Class Summary
 class MDDManager.MDDCubeIterator
           
 class MDDManager.MDDMintermIterator
          Iterates over minterms of a given value vars parameter is used to fill-in don't care variables
 
Field Summary
static int NO_VALUE
          Used as an indicator for arbitrary value for a variable.
 
Constructor Summary
MDDManager(int nvars, int _arity)
          Constructor
 
Method Summary
 MDDNode apply(ApplyFunctions.BinApplyFunction function, MDDNode m1, MDDNode m2)
           
 MDDNode apply(ApplyFunctions.UnaryApplyFunction function, MDDNode m1)
          Apply a unary operation to MDDs.
 MDDNode buildCube(int[] vars, int arity, MDDNode top, MDDNode bot)
           
 MDDNode buildCube(int[] vars, MDDNode top, MDDNode bot)
           
protected  MDDNode buildPoint(int[] values, int valuesLen, int arity, MDDNode terminal, MDDNode bot)
          Constructs a point (minterm) in which a path along i = values[i] leads to terminal, and all other assignments lead to bot.
 MDDNode buildPoint(int[] values, int arity, MDDNode terminal, MDDNode bot)
           
 MDDNode buildPoint(int[] values, MDDNode terminal, MDDNode bot)
           
 MDDNode buildVar(int var, int arity, int branch, MDDNode value, MDDNode bot)
           
 MDDNode buildVar(int var, int branch, MDDNode value, MDDNode bot)
           
 MDDNode cofactor(MDDNode m, int var, int branch)
          Restrict a specified variable to a certain value.
 MDDNode cofactor(MDDNode m, MDDNode cube, MDDNode background)
           
 int[][] collectValues(MDDNode node)
           
 java.util.Iterator cubeIterator(MDDNode node, MDDNode background)
          cubeIterator.
 int dagSize(MDDNode mddNode)
           
 MDDLeafNode getLeafNode(int val)
          Returns a cannonical version of a leaf node with value var.
 int getNvars()
          Number of currently allocated variables.
 MDDNode kase(int var, MDDNode[] children)
          Creates a decision diagram with root var and children children.
 MDDNode makeUnique(int level, MDDNode[] children)
          Returns the cannonical version of an MDDNode with root level level and children children.
 java.util.Iterator mintermIterator(MDDNode node, MDDNode background, MDDNode vars, int termVal)
           
 MDDNode quantify(ApplyFunctions.QuantifyFunction function, MDDNode node, MDDNode cube)
          performs universal/existentia/other quantification
 MDDNode renameVars(MDDNode mdd, int[] newVars)
           
 void renew()
          Clears the computational cache.
 void setCaching(boolean v)
          Toggles caching.
 int sharedSize(MDDNode[] mddNodes)
           
 DaVinciGraph toDaVinci(MDDNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_VALUE

public static final int NO_VALUE
Used as an indicator for arbitrary value for a variable.

See Also:
Constant Field Values
Constructor Detail

MDDManager

public MDDManager(int nvars,
                  int _arity)
Constructor

Parameters:
nvars - initial number of variables
arity - breadth factor of each DD node
Method Detail

renew

public void renew()
Clears the computational cache. Can be used when the semantics of the operations have changed during the life-time of this manager.


getNvars

public int getNvars()
Number of currently allocated variables. Any existing DD can have at most that many variables.

Returns:
an int value

setCaching

public void setCaching(boolean v)
Toggles caching.

Parameters:
v - a boolean value

getLeafNode

public MDDLeafNode getLeafNode(int val)
Returns a cannonical version of a leaf node with value var.

Parameters:
val - value of the constant node
Returns:
a MDDLeafNode value

kase

public MDDNode kase(int var,
                    MDDNode[] children)
Creates a decision diagram with root var and children children. The root node of each child is assumed to be greater than var. This is not checked!

Parameters:
var - a NAME of the node to create
children - a MDDNode[] value
Returns:
a MDDNode value

makeUnique

public MDDNode makeUnique(int level,
                          MDDNode[] children)
Returns the cannonical version of an MDDNode with root level level and children children.

Parameters:
level - level at the root of the tree
children - array of children
Returns:
a cannonical MDDNode value with level level and children children

apply

public MDDNode apply(ApplyFunctions.BinApplyFunction function,
                     MDDNode m1,
                     MDDNode m2)

apply

public MDDNode apply(ApplyFunctions.UnaryApplyFunction function,
                     MDDNode m1)
Apply a unary operation to MDDs.


cofactor

public MDDNode cofactor(MDDNode m,
                        MDDNode cube,
                        MDDNode background)

cofactor

public MDDNode cofactor(MDDNode m,
                        int var,
                        int branch)
Restrict a specified variable to a certain value.


quantify

public MDDNode quantify(ApplyFunctions.QuantifyFunction function,
                        MDDNode node,
                        MDDNode cube)
performs universal/existentia/other quantification


renameVars

public MDDNode renameVars(MDDNode mdd,
                          int[] newVars)

buildVar

public MDDNode buildVar(int var,
                        int branch,
                        MDDNode value,
                        MDDNode bot)

buildVar

public MDDNode buildVar(int var,
                        int arity,
                        int branch,
                        MDDNode value,
                        MDDNode bot)

buildCube

public MDDNode buildCube(int[] vars,
                         MDDNode top,
                         MDDNode bot)

buildCube

public MDDNode buildCube(int[] vars,
                         int arity,
                         MDDNode top,
                         MDDNode bot)

buildPoint

public MDDNode buildPoint(int[] values,
                          MDDNode terminal,
                          MDDNode bot)

buildPoint

public MDDNode buildPoint(int[] values,
                          int arity,
                          MDDNode terminal,
                          MDDNode bot)

buildPoint

protected MDDNode buildPoint(int[] values,
                             int valuesLen,
                             int arity,
                             MDDNode terminal,
                             MDDNode bot)
Constructs a point (minterm) in which a path along i = values[i] leads to terminal, and all other assignments lead to bot.

Parameters:
values - an int[] value
arity - an int value
terminal - a MDDNode value
bot - a MDDNode value
Returns:
a MDDNode value

dagSize

public int dagSize(MDDNode mddNode)

sharedSize

public int sharedSize(MDDNode[] mddNodes)

collectValues

public int[][] collectValues(MDDNode node)

cubeIterator

public java.util.Iterator cubeIterator(MDDNode node,
                                       MDDNode background)
cubeIterator.

Returns:
an Iterator over the cubes of node

mintermIterator

public java.util.Iterator mintermIterator(MDDNode node,
                                          MDDNode background,
                                          MDDNode vars,
                                          int termVal)

toDaVinci

public DaVinciGraph toDaVinci(MDDNode node)