cudd  3.0.0
The University of Colorado Decision Diagram Package
Functions
cuddCompose.c File Reference

Functional composition and variable permutation of DDs. More...

#include "util.h"
#include "cuddInt.h"
Include dependency graph for cuddCompose.c:

Functions

DdNodeCudd_bddCompose (DdManager *dd, DdNode *f, DdNode *g, int v)
 Substitutes g for x_v in the BDD for f. More...
 
DdNodeCudd_addCompose (DdManager *dd, DdNode *f, DdNode *g, int v)
 Substitutes g for x_v in the ADD for f. More...
 
DdNodeCudd_addPermute (DdManager *manager, DdNode *node, int *permut)
 Permutes the variables of an ADD. More...
 
DdNodeCudd_addSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n)
 Swaps two sets of variables of the same size (x and y) in the ADD f. More...
 
DdNodeCudd_bddPermute (DdManager *manager, DdNode *node, int *permut)
 Permutes the variables of a BDD. More...
 
DdNodeCudd_bddVarMap (DdManager *manager, DdNode *f)
 Remaps the variables of a BDD using the default variable map. More...
 
int Cudd_SetVarMap (DdManager *manager, DdNode **x, DdNode **y, int n)
 Registers a variable mapping with the manager. More...
 
DdNodeCudd_bddSwapVariables (DdManager *dd, DdNode *f, DdNode **x, DdNode **y, int n)
 Swaps two sets of variables of the same size (x and y) in the BDD f. More...
 
DdNodeCudd_bddAdjPermuteX (DdManager *dd, DdNode *B, DdNode **x, int n)
 Rearranges a set of variables in the BDD B. More...
 
DdNodeCudd_addVectorCompose (DdManager *dd, DdNode *f, DdNode **vector)
 Composes an ADD with a vector of 0-1 ADDs. More...
 
DdNodeCudd_addGeneralVectorCompose (DdManager *dd, DdNode *f, DdNode **vectorOn, DdNode **vectorOff)
 Composes an ADD with a vector of ADDs. More...
 
DdNodeCudd_addNonSimCompose (DdManager *dd, DdNode *f, DdNode **vector)
 Composes an ADD with a vector of 0-1 ADDs. More...
 
DdNodeCudd_bddVectorCompose (DdManager *dd, DdNode *f, DdNode **vector)
 Composes a BDD with a vector of BDDs. More...
 
DdNodecuddBddComposeRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *proj)
 Performs the recursive step of Cudd_bddCompose. More...
 
DdNodecuddAddComposeRecur (DdManager *dd, DdNode *f, DdNode *g, DdNode *proj)
 Performs the recursive step of Cudd_addCompose. More...
 
static DdNodecuddAddPermuteRecur (DdManager *manager, DdHashTable *table, DdNode *node, int *permut)
 Implements the recursive step of Cudd_addPermute. More...
 
static DdNodecuddBddPermuteRecur (DdManager *manager, DdHashTable *table, DdNode *node, int *permut)
 Implements the recursive step of Cudd_bddPermute. More...
 
static DdNodecuddBddVarMapRecur (DdManager *manager, DdNode *f)
 Implements the recursive step of Cudd_bddVarMap. More...
 
static DdNodecuddAddVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vector, int deepest)
 Performs the recursive step of Cudd_addVectorCompose. More...
 
static DdNodecuddAddGeneralVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vectorOn, DdNode **vectorOff, int deepest)
 Performs the recursive step of Cudd_addGeneralVectorCompose. More...
 
static DdNodecuddAddNonSimComposeRecur (DdManager *dd, DdNode *f, DdNode **vector, DdNode *key, DdNode *cube, int lastsub)
 Performs the recursive step of Cudd_addNonSimCompose. More...
 
static DdNodecuddBddVectorComposeRecur (DdManager *dd, DdHashTable *table, DdNode *f, DdNode **vector, int deepest)
 Performs the recursive step of Cudd_bddVectorCompose. More...
 
static int ddIsIthAddVar (DdManager *dd, DdNode *f, unsigned int i)
 Comparison of a function to the i-th ADD variable. More...
 
static int ddIsIthAddVarPair (DdManager *dd, DdNode *f, DdNode *g, unsigned int i)
 Comparison of a pair of functions to the i-th ADD variable. More...
 

Detailed Description

Functional composition and variable permutation of DDs.

The permutation functions use a local cache because the results to be remembered depend on the permutation being applied. Since the permutation is just an array, it cannot be stored in the global cache. There are different procedured for BDDs and ADDs. This is because bddPermuteRecur uses cuddBddIteRecur. If this were changed, the procedures could be merged.

Author
Fabio Somenzi and Kavita Ravi

Function Documentation

◆ Cudd_addCompose()

DdNode* Cudd_addCompose ( DdManager dd,
DdNode f,
DdNode g,
int  v 
)

Substitutes g for x_v in the ADD for f.

v is the index of the variable to be substituted. g must be a 0-1 ADD. Cudd_bddCompose passes the corresponding projection function to the recursive procedure, so that the cache may be used.

Returns
the composed ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddCompose

◆ Cudd_addGeneralVectorCompose()

DdNode* Cudd_addGeneralVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vectorOn,
DdNode **  vectorOff 
)

Composes an ADD with a vector of ADDs.

Given a vector of ADDs, creates a new ADD by substituting the ADDs for the variables of the ADD f. vectorOn contains ADDs to be substituted for the x_v and vectorOff the ADDs to be substituted for x_v'. There should be an entry in vector for each variable in the manager. If no substitution is sought for a given variable, the corresponding projection function should be specified in the vector. This function implements simultaneous composition.

Returns
a pointer to the resulting ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_addVectorCompose Cudd_addNonSimCompose Cudd_addPermute Cudd_addCompose Cudd_bddVectorCompose

◆ Cudd_addNonSimCompose()

DdNode* Cudd_addNonSimCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

Composes an ADD with a vector of 0-1 ADDs.

Given a vector of 0-1 ADDs, creates a new ADD by substituting the 0-1 ADDs for the variables of the ADD f. There should be an entry in vector for each variable in the manager. This function implements non-simultaneous composition. If any of the functions being composed depends on any of the variables being substituted, then the result depends on the order of composition, which in turn depends on the variable order: The variables farther from the roots in the order are substituted first.

Returns
a pointer to the resulting ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_addVectorCompose Cudd_addPermute Cudd_addCompose

◆ Cudd_addPermute()

DdNode* Cudd_addPermute ( DdManager manager,
DdNode node,
int *  permut 
)

Permutes the variables of an ADD.

Given a permutation in array permut, creates a new ADD with permuted variables. There should be an entry in array permut for each variable in the manager. The i-th entry of permut holds the index of the variable that is to substitute the i-th variable.

Returns
a pointer to the resulting ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddPermute Cudd_addSwapVariables

◆ Cudd_addSwapVariables()

DdNode* Cudd_addSwapVariables ( DdManager dd,
DdNode f,
DdNode **  x,
DdNode **  y,
int  n 
)

Swaps two sets of variables of the same size (x and y) in the ADD f.

The size is given by n. The two sets of variables are assumed to be disjoint.

Returns
a pointer to the resulting ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_addPermute Cudd_bddSwapVariables

◆ Cudd_addVectorCompose()

DdNode* Cudd_addVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

Composes an ADD with a vector of 0-1 ADDs.

Given a vector of 0-1 ADDs, creates a new ADD by substituting the 0-1 ADDs for the variables of the ADD f. There should be an entry in vector for each variable in the manager. If no substitution is sought for a given variable, the corresponding projection function should be specified in the vector. This function implements simultaneous composition.

Returns
a pointer to the resulting ADD if successful; NULL otherwise.
Side effects None
See also
Cudd_addNonSimCompose Cudd_addPermute Cudd_addCompose Cudd_bddVectorCompose

◆ Cudd_bddAdjPermuteX()

DdNode* Cudd_bddAdjPermuteX ( DdManager dd,
DdNode B,
DdNode **  x,
int  n 
)

Rearranges a set of variables in the BDD B.

The size of the set is given by n. This procedure is intended for the ‘randomization’ of the priority functions.

Returns
a pointer to the BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddPermute Cudd_bddSwapVariables Cudd_Dxygtdxz Cudd_Dxygtdyz Cudd_PrioritySelect

◆ Cudd_bddCompose()

DdNode* Cudd_bddCompose ( DdManager dd,
DdNode f,
DdNode g,
int  v 
)

Substitutes g for x_v in the BDD for f.

v is the index of the variable to be substituted. Cudd_bddCompose passes the corresponding projection function to the recursive procedure, so that the cache may be used.

Returns
the composed BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_addCompose

◆ Cudd_bddPermute()

DdNode* Cudd_bddPermute ( DdManager manager,
DdNode node,
int *  permut 
)

Permutes the variables of a BDD.

Given a permutation in array permut, creates a new BDD with permuted variables. There should be an entry in array permut for each variable in the manager. The i-th entry of permut holds the index of the variable that is to substitute the i-th variable.

Returns
a pointer to the resulting BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_addPermute Cudd_bddSwapVariables

◆ Cudd_bddSwapVariables()

DdNode* Cudd_bddSwapVariables ( DdManager dd,
DdNode f,
DdNode **  x,
DdNode **  y,
int  n 
)

Swaps two sets of variables of the same size (x and y) in the BDD f.

The size is given by n. The two sets of variables are assumed to be disjoint.

Returns
a pointer to the resulting BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddPermute Cudd_addSwapVariables

◆ Cudd_bddVarMap()

DdNode* Cudd_bddVarMap ( DdManager manager,
DdNode f 
)

Remaps the variables of a BDD using the default variable map.

A typical use of this function is to swap two sets of variables. The variable map must be registered with Cudd_SetVarMap.

Returns
a pointer to the resulting BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddPermute Cudd_bddSwapVariables Cudd_SetVarMap
Parameters
managerDD manager
ffunction in which to remap variables

◆ Cudd_bddVectorCompose()

DdNode* Cudd_bddVectorCompose ( DdManager dd,
DdNode f,
DdNode **  vector 
)

Composes a BDD with a vector of BDDs.

Given a vector of BDDs, creates a new BDD by substituting the BDDs for the variables of the BDD f. There should be an entry in vector for each variable in the manager. If no substitution is sought for a given variable, the corresponding projection function should be specified in the vector. This function implements simultaneous composition.

Returns
a pointer to the resulting BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddPermute Cudd_bddCompose Cudd_addVectorCompose

◆ Cudd_SetVarMap()

int Cudd_SetVarMap ( DdManager manager,
DdNode **  x,
DdNode **  y,
int  n 
)

Registers a variable mapping with the manager.

Registers with the manager a variable mapping described by two sets of variables. This variable mapping is then used by functions like Cudd_bddVarMap. This function is convenient for those applications that perform the same mapping several times. However, if several different permutations are used, it may be more efficient not to rely on the registered mapping, because changing mapping causes the cache to be cleared. (The initial setting, however, does not clear the cache.) The two sets of variables (x and y) must have the same size (x and y). The size is given by n. The two sets of variables are normally disjoint, but this restriction is not imposeded by the function. When new variables are created, the map is automatically extended (each new variable maps to itself). The typical use, however, is to wait until all variables are created, and then create the map.

Returns
1 if the mapping is successfully registered with the manager; 0 otherwise.
Side effects Modifies the manager. May clear the cache.
See also
Cudd_bddVarMap Cudd_bddPermute Cudd_bddSwapVariables
Parameters
managerDD manager
xfirst array of variables
ysecond array of variables
nlength of both arrays

◆ cuddAddComposeRecur()

DdNode* cuddAddComposeRecur ( DdManager dd,
DdNode f,
DdNode g,
DdNode proj 
)

Performs the recursive step of Cudd_addCompose.

Returns
the composed BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_addCompose

◆ cuddAddGeneralVectorComposeRecur()

static DdNode* cuddAddGeneralVectorComposeRecur ( DdManager dd,
DdHashTable table,
DdNode f,
DdNode **  vectorOn,
DdNode **  vectorOff,
int  deepest 
)
static

Performs the recursive step of Cudd_addGeneralVectorCompose.

Side effects None
Parameters
ddDD manager
tablecomputed table
fADD in which to compose
vectorOnfunctions to substitute for x_i
vectorOfffunctions to substitute for x_i'
deepestdepth of deepest substitution

◆ cuddAddNonSimComposeRecur()

static DdNode* cuddAddNonSimComposeRecur ( DdManager dd,
DdNode f,
DdNode **  vector,
DdNode key,
DdNode cube,
int  lastsub 
)
static

Performs the recursive step of Cudd_addNonSimCompose.

Side effects None

◆ cuddAddPermuteRecur()

static DdNode* cuddAddPermuteRecur ( DdManager manager,
DdHashTable table,
DdNode node,
int *  permut 
)
static

Implements the recursive step of Cudd_addPermute.

Recursively puts the ADD in the order given in the array permut. Checks for trivial cases to terminate recursion, then splits on the children of this node. Once the solutions for the children are obtained, it puts into the current position the node from the rest of the ADD that should be here. Then returns this ADD. The key here is that the node being visited is NOT put in its proper place by this instance, but rather is switched when its proper position is reached in the recursion tree.

The DdNode * that is returned is the same ADD as passed in as node, but in the new order.

Side effects None
See also
Cudd_addPermute cuddBddPermuteRecur
Parameters
managerDD manager
tablecomputed table
nodeADD to be reordered
permutpermutation array

◆ cuddAddVectorComposeRecur()

static DdNode* cuddAddVectorComposeRecur ( DdManager dd,
DdHashTable table,
DdNode f,
DdNode **  vector,
int  deepest 
)
static

Performs the recursive step of Cudd_addVectorCompose.

Side effects None
Parameters
ddDD manager
tablecomputed table
fADD in which to compose
vectorfunctions to substitute
deepestdepth of deepest substitution

◆ cuddBddComposeRecur()

DdNode* cuddBddComposeRecur ( DdManager dd,
DdNode f,
DdNode g,
DdNode proj 
)

Performs the recursive step of Cudd_bddCompose.

Exploits the fact that the composition of f' with g produces the complement of the composition of f with g to better utilize the cache.

Returns
the composed BDD if successful; NULL otherwise.
Side effects None
See also
Cudd_bddCompose

◆ cuddBddPermuteRecur()

static DdNode* cuddBddPermuteRecur ( DdManager manager,
DdHashTable table,
DdNode node,
int *  permut 
)
static

Implements the recursive step of Cudd_bddPermute.

Recursively puts the BDD in the order given in the array permut. Checks for trivial cases to terminate recursion, then splits on the children of this node. Once the solutions for the children are obtained, it puts into the current position the node from the rest of the BDD that should be here. Then returns this BDD. The key here is that the node being visited is NOT put in its proper place by this instance, but rather is switched when its proper position is reached in the recursion tree.

The DdNode * that is returned is the same BDD as passed in as node, but in the new order.

Side effects None
See also
Cudd_bddPermute cuddAddPermuteRecur
Parameters
managerDD manager
tablecomputed table
nodeBDD to be reordered
permutpermutation array

◆ cuddBddVarMapRecur()

static DdNode* cuddBddVarMapRecur ( DdManager manager,
DdNode f 
)
static

Implements the recursive step of Cudd_bddVarMap.

Returns
a pointer to the result if successful; NULL otherwise.
Side effects None
See also
Cudd_bddVarMap
Parameters
managerDD manager
fBDD to be remapped

◆ cuddBddVectorComposeRecur()

static DdNode* cuddBddVectorComposeRecur ( DdManager dd,
DdHashTable table,
DdNode f,
DdNode **  vector,
int  deepest 
)
static

Performs the recursive step of Cudd_bddVectorCompose.

Side effects None
Parameters
ddDD manager
tablecomputed table
fBDD in which to compose
vectorfunctions to be composed
deepestdepth of the deepest substitution

◆ ddIsIthAddVar()

static int ddIsIthAddVar ( DdManager dd,
DdNode f,
unsigned int  i 
)
static

Comparison of a function to the i-th ADD variable.

Returns
1 if the function is the i-th ADD variable; 0 otherwise.
Side effects None

◆ ddIsIthAddVarPair()

static int ddIsIthAddVarPair ( DdManager dd,
DdNode f,
DdNode g,
unsigned int  i 
)
static

Comparison of a pair of functions to the i-th ADD variable.

Returns
1 if the functions are the i-th ADD variable and its complement; 0 otherwise.
Side effects None