Procedure to subset the given BDD by choosing the heavier branches. More...
#include "util.h"
#include "cuddInt.h"
Data Structures | |
struct | NodeData |
Data structure to store the information on each node. More... | |
struct | SubsetInfo |
Miscellaneous info. More... | |
Defines | |
#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 | |
DdNode * | Cudd_SubsetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold) |
Extracts a dense subset from a BDD with the heavy branch heuristic. | |
DdNode * | Cudd_SupersetHeavyBranch (DdManager *dd, DdNode *f, int numVars, int threshold) |
Extracts a dense superset from a BDD with the heavy branch heuristic. | |
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. | |
static void | ResizeNodeDataPages (SubsetInfo_t *info) |
Resize the number of pages allocated to store the node data. | |
static void | ResizeCountMintermPages (SubsetInfo_t *info) |
Resize the number of pages allocated to store the minterm counts. | |
static void | ResizeCountNodePages (SubsetInfo_t *info) |
Resize the number of pages allocated to store the node counts. | |
static double | SubsetCountMintermAux (DdNode *node, double max, st_table *table, SubsetInfo_t *info) |
Recursively counts minterms of each node in the DAG. | |
static st_table * | SubsetCountMinterm (DdNode *node, int nvars, SubsetInfo_t *info) |
Counts minterms of each node in the DAG. | |
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. | |
static int | SubsetCountNodes (DdNode *node, st_table *table, int nvars, SubsetInfo_t *info) |
Counts the nodes under the current node and its lighter child. | |
static void | StoreNodes (st_table *storeTable, DdManager *dd, DdNode *node) |
Procedure to recursively store nodes that are retained in the subset. | |
static DdNode * | BuildSubsetBdd (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. |
Procedure to subset the given BDD by choosing the heavier branches.
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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.
dd | DD manager | |
node | current node | |
size | current size of the subset | |
visitedTable | visited table storing all node data | |
threshold | subsetting threshold | |
storeTable | store table | |
approxTable | approximation table | |
info | miscellaneous info |
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.
dd | manager | |
f | function to be subset | |
numVars | number of variables in the support of f | |
threshold | maximum number of nodes in the subset |
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.
dd | manager | |
f | function to be superset | |
numVars | number of variables in the support of f | |
threshold | maximum number of nodes in the superset |
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.
dd | DD manager | |
f | current DD | |
numVars | maximum number of variables | |
threshold | threshold size for the subset |
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.
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.
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.
Procedure to recursively store nodes that are retained in the subset.
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.
node | function to be analyzed | |
nvars | number of variables node depends on | |
info | miscellaneous info |
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.
node | function to analyze | |
max | number of minterms of constant 1 | |
table | visitedTable table | |
info | miscellaneous info |
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.
node | function to be analyzed | |
table | node quality table | |
nvars | number of variables node depends on | |
info | miscellaneous info |
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.
node | current node | |
table | table to update node count, also serves as visited table. | |
max | maximum number of variables |