cudd  3.0.0
The University of Colorado Decision Diagram Package
Data Structures | Macros | Typedefs | Functions
cuddSubsetHB.c File Reference

Procedure to subset the given BDD by choosing the heavier branches. More...

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

Data Structures

struct  NodeData
 Data structure to store the information on each node. More...
 
struct  SubsetInfo
 Miscellaneous info. More...
 

Macros

#define DBL_MAX_EXP   1024
 
#define DEFAULT_PAGE_SIZE   2048
 
#define DEFAULT_NODE_DATA_PAGE_SIZE   1024
 
#define INITIAL_PAGES   128
 

Typedefs

typedef struct NodeData NodeData_t
 
typedef struct SubsetInfo SubsetInfo_t
 

Functions

DdNodeCudd_SubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold)
 Extracts a dense subset from a BDD with the heavy branch heuristic. More...
 
DdNodeCudd_SupersetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold)
 Extracts a dense superset from a BDD with the heavy branch heuristic. More...
 
DdNodecuddSubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold)
 The main procedure that returns a subset by choosing the heavier branch in the BDD. More...
 
static void ResizeNodeDataPages (SubsetInfo_t *info)
 Resize the number of pages allocated to store the node data. More...
 
static void ResizeCountMintermPages (SubsetInfo_t *info)
 Resize the number of pages allocated to store the minterm counts. More...
 
static void ResizeCountNodePages (SubsetInfo_t *info)
 Resize the number of pages allocated to store the node counts. More...
 
static double SubsetCountMintermAux (DdNode *node, double max, st_table *table, SubsetInfo_t *info)
 Recursively counts minterms of each node in the DAG. More...
 
static st_tableSubsetCountMinterm (DdNode *node, int nvars, SubsetInfo_t *info)
 Counts minterms of each node in the DAG. More...
 
static int SubsetCountNodesAux (DdNode *node, st_table *table, double max, SubsetInfo_t *info)
 Recursively counts the number of nodes under the dag. Also counts the number of nodes under the lighter child of this node. More...
 
static int SubsetCountNodes (DdNode *node, st_table *table, int nvars, SubsetInfo_t *info)
 Counts the nodes under the current node and its lighter child. More...
 
static void StoreNodes (st_table *storeTable, DdManager *dd, DdNode *node)
 Procedure to recursively store nodes that are retained in the subset. More...
 
static DdNodeBuildSubsetBdd (DdManager *dd, DdNode *node, int *size, st_table *visitedTable, int threshold, st_table *storeTable, st_table *approxTable, SubsetInfo_t *info)
 Builds the subset BDD using the heavy branch method. More...
 

Detailed Description

Procedure to subset the given BDD by choosing the heavier branches.

See also
cuddSubsetSP.c
Author
Kavita Ravi

Function Documentation

◆ BuildSubsetBdd()

static DdNode* BuildSubsetBdd ( DdManager dd,
DdNode node,
int *  size,
st_table visitedTable,
int  threshold,
st_table storeTable,
st_table approxTable,
SubsetInfo_t info 
)
static

Builds the subset BDD using the heavy branch method.

The procedure carries out the building of the subset BDD starting at the root. Using the three different counts labelling each node, the procedure chooses the heavier branch starting from the root and keeps track of the number of nodes it discards at each step, thus keeping count of the size of the subset BDD dynamically. Once the threshold is satisfied, the procedure then calls ITE to build the BDD.

Side effects None
Parameters
ddDD manager
nodecurrent node
sizecurrent size of the subset
visitedTablevisited table storing all node data
thresholdsubsetting threshold
storeTablestore table
approxTableapproximation table
infomiscellaneous info

◆ Cudd_SubsetHeavyBranch()

DdNode* Cudd_SubsetHeavyBranch ( DdManager dd,
DdNode f,
int  numVars,
int  threshold 
)

Extracts a dense subset from a BDD with the heavy branch heuristic.

This procedure builds a subset by throwing away one of the children of each node, starting from the root, until the result is small enough. The child that is eliminated from the result is the one that contributes the fewer minterms. The parameter numVars is the maximum number of variables to be used in minterm calculation and node count calculation. The optimal number should be as close as possible to the size of the support of f. However, it is safe to pass the value returned by Cudd_ReadSize for numVars when the number of variables is under 1023. If numVars is larger than 1023, it will overflow. If a 0 parameter is passed then the procedure will compute a value which will avoid overflow but will cause underflow with 2046 variables or more.

Returns
a pointer to the BDD of the subset if successful. NULL if the procedure runs out of memory.
Side effects None
See also
Cudd_SubsetShortPaths Cudd_SupersetHeavyBranch Cudd_ReadSize
Parameters
ddmanager
ffunction to be subset
numVarsnumber of variables in the support of f
thresholdmaximum number of nodes in the subset

◆ Cudd_SupersetHeavyBranch()

DdNode* Cudd_SupersetHeavyBranch ( DdManager dd,
DdNode f,
int  numVars,
int  threshold 
)

Extracts a dense superset from a BDD with the heavy branch heuristic.

The procedure is identical to the subset procedure except for the fact that it receives the complement of the given function. Extracting the subset of the complement function is equivalent to extracting the superset of the function. This procedure builds a superset by throwing away one of the children of each node starting from the root of the complement function, until the result is small enough. The child that is eliminated from the result is the one that contributes the fewer minterms. The parameter numVars is the maximum number of variables to be used in minterm calculation and node count calculation. The optimal number should be as close as possible to the size of the support of f. However, it is safe to pass the value returned by Cudd_ReadSize for numVars when the number of variables is under 1023. If numVars is larger than 1023, it will overflow. If a 0 parameter is passed then the procedure will compute a value which will avoid overflow but will cause underflow with 2046 variables or more.

Returns
a pointer to the BDD of the superset if successful. NULL if intermediate result causes the procedure to run out of memory.
Side effects None
See also
Cudd_SubsetHeavyBranch Cudd_SupersetShortPaths Cudd_ReadSize
Parameters
ddmanager
ffunction to be superset
numVarsnumber of variables in the support of f
thresholdmaximum number of nodes in the superset

◆ cuddSubsetHeavyBranch()

DdNode* cuddSubsetHeavyBranch ( DdManager dd,
DdNode f,
int  numVars,
int  threshold 
)

The main procedure that returns a subset by choosing the heavier branch in the BDD.

Here a subset BDD is built by throwing away one of the children. Starting at root, annotate each node with the number of minterms (in terms of the total number of variables specified - numVars), number of nodes taken by the DAG rooted at this node and number of additional nodes taken by the child that has the lesser minterms. The child with the lower number of minterms is thrown away and a dyanmic count of the nodes of the subset is kept. Once the threshold is reached the subset is returned to the calling procedure.

Side effects None
See also
Cudd_SubsetHeavyBranch
Parameters
ddDD manager
fcurrent DD
numVarsmaximum number of variables
thresholdthreshold size for the subset

◆ ResizeCountMintermPages()

static void ResizeCountMintermPages ( SubsetInfo_t info)
static

Resize the number of pages allocated to store the minterm counts.

The procedure moves the counter to the next page when the end of the page is reached and allocates new pages when necessary.

Side effects Changes the size of minterm pages, page, page index, maximum
number of pages freeing stuff in case of memory out.

◆ ResizeCountNodePages()

static void ResizeCountNodePages ( SubsetInfo_t info)
static

Resize the number of pages allocated to store the node counts.

The procedure moves the counter to the next page when the end of the page is reached and allocates new pages when necessary.

Side effects Changes the size of pages, page, page index, maximum
number of pages freeing stuff in case of memory out.

◆ ResizeNodeDataPages()

static void ResizeNodeDataPages ( SubsetInfo_t info)
static

Resize the number of pages allocated to store the node data.

The procedure moves the counter to the next page when the end of the page is reached and allocates new pages when necessary.

Side effects Changes the size of pages, page, page index, maximum
number of pages freeing stuff in case of memory out.

◆ StoreNodes()

static void StoreNodes ( st_table storeTable,
DdManager dd,
DdNode node 
)
static

Procedure to recursively store nodes that are retained in the subset.

Side effects None
See also
StoreNodes

◆ SubsetCountMinterm()

static st_table* SubsetCountMinterm ( DdNode node,
int  nvars,
SubsetInfo_t info 
)
static

Counts minterms of each node in the DAG.

Similar to the Cudd_CountMinterm procedure except this returns the minterm count for all the nodes in the bdd in an st_table.

Side effects none
See also
SubsetCountMintermAux
Parameters
nodefunction to be analyzed
nvarsnumber of variables node depends on
infomiscellaneous info

◆ SubsetCountMintermAux()

static double SubsetCountMintermAux ( DdNode node,
double  max,
st_table table,
SubsetInfo_t info 
)
static

Recursively counts minterms of each node in the DAG.

Similar to the cuddCountMintermAux which recursively counts the number of minterms for the dag rooted at each node in terms of the total number of variables (max). This procedure creates the node data structure and stores the minterm count as part of the node data structure.

Side effects Creates structures of type node quality and fills the st_table
See also
SubsetCountMinterm
Parameters
nodefunction to analyze
maxnumber of minterms of constant 1
tablevisitedTable table
infomiscellaneous info

◆ SubsetCountNodes()

static int SubsetCountNodes ( DdNode node,
st_table table,
int  nvars,
SubsetInfo_t info 
)
static

Counts the nodes under the current node and its lighter child.

Calls a recursive procedure to count the number of nodes of a DAG rooted at a particular node and the number of nodes taken by its lighter child.

Side effects None
See also
SubsetCountNodesAux
Parameters
nodefunction to be analyzed
tablenode quality table
nvarsnumber of variables node depends on
infomiscellaneous info

◆ SubsetCountNodesAux()

static int SubsetCountNodesAux ( DdNode node,
st_table table,
double  max,
SubsetInfo_t info 
)
static

Recursively counts the number of nodes under the dag. Also counts the number of nodes under the lighter child of this node.

Note that the same dag may be the lighter child of two different nodes and have different counts. As with the minterm counts, the node counts are stored in pages to be space efficient and the address for these node counts are stored in an st_table associated to each node.

Side effects Updates the node data table with node counts
See also
SubsetCountNodes
Parameters
nodecurrent node
tabletable to update node count, also serves as visited table.
maxmaximum number of variables