abc-master
|
Go to the source code of this file.
Data Structures | |
struct | NodeDist |
struct | AssortedInfo |
Macros | |
#define | DEFAULT_PAGE_SIZE 2048 /* page size to store the BFS queue element type */ |
#define | DEFAULT_NODE_DIST_PAGE_SIZE 2048 /* page sizesto store NodeDist_t type */ |
#define | MAXSHORTINT |
#define | INITIAL_PAGES |
Typedefs | |
typedef struct NodeDist | NodeDist_t |
Functions | |
static void | ResizeNodeDistPages (void) |
static void | ResizeQueuePages (void) |
static void | CreateTopDist (st__table *pathTable, int parentPage, int parentQueueIndex, int topLen, DdNode **childPage, int childQueueIndex, int numParents, FILE *fp) |
static int | CreateBotDist (DdNode *node, st__table *pathTable, unsigned int *pathLengthArray, FILE *fp) |
static st__table * | CreatePathTable (DdNode *node, unsigned int *pathLengthArray, FILE *fp) |
static unsigned int | AssessPathLength (unsigned int *pathLengthArray, int threshold, int numVars, unsigned int *excess, FILE *fp) |
static DdNode * | BuildSubsetBdd (DdManager *dd, st__table *pathTable, DdNode *node, struct AssortedInfo *info, st__table *subsetNodeTable) |
static enum st__retval | stPathTableDdFree (char *key, char *value, char *arg) |
DdNode * | Cudd_SubsetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit) |
DdNode * | Cudd_SupersetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit) |
DdNode * | cuddSubsetShortPaths (DdManager *dd, DdNode *f, int numVars, int threshold, int hardlimit) |
Variables | |
static char rcsid[] | DD_UNUSED = "$Id: cuddSubsetSP.c,v 1.34 2009/02/19 16:23:19 fabio Exp $" |
static int | memOut |
static DdNode * | zero |
static DdNode * | one |
static NodeDist_t ** | nodeDistPages |
static int | nodeDistPageIndex |
static int | nodeDistPage |
static int | nodeDistPageSize = DEFAULT_NODE_DIST_PAGE_SIZE |
static int | maxNodeDistPages |
static NodeDist_t * | currentNodeDistPage |
static DdNode *** | queuePages |
static int | queuePageIndex |
static int | queuePage |
static int | queuePageSize = DEFAULT_PAGE_SIZE |
static int | maxQueuePages |
static DdNode ** | currentQueuePage |
#define DEFAULT_NODE_DIST_PAGE_SIZE 2048 /* page sizesto store NodeDist_t type */ |
Definition at line 83 of file cuddSubsetSP.c.
CFile***********************************************************************
FileName [cuddSubsetSP.c]
PackageName [cudd]
Synopsis [Procedure to subset the given BDD choosing the shortest paths (largest cubes) in the BDD.]
Description [External procedures included in this module:
Internal procedures included in this module:
Static procedures included in this module:
]
SeeAlso [cuddSubsetHB.c]
Author [Kavita Ravi]
Copyright [Copyright (c) 1995-2004, 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.]
Definition at line 82 of file cuddSubsetSP.c.
#define INITIAL_PAGES |
Definition at line 89 of file cuddSubsetSP.c.
#define MAXSHORTINT |
Definition at line 84 of file cuddSubsetSP.c.
typedef struct NodeDist NodeDist_t |
Definition at line 122 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [Chooses the maximum allowable path length of nodes under the threshold.]
Description [Chooses the maximum allowable path length under each node. The corner cases are when the threshold is larger than the number of nodes in the BDD iself, in which case 'numVars + 1' is returned. If all nodes of a particular path length are needed, then the maxpath returned is the next one with excess nodes = 0;]
SideEffects [None]
SeeAlso []
Definition at line 1171 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [Builds the BDD with nodes labeled with path length less than or equal to maxpath]
Description [Builds the BDD with nodes labeled with path length under maxpath and as many nodes labeled maxpath as determined by the threshold. The procedure uses the path table to determine which nodes in the original bdd need to be retained. This procedure picks a shortest path (tie break decided by taking the child with the shortest distance to the constant) and recurs down the path till it reaches the constant. the procedure then starts building the subset upward from the constant. All nodes labeled by path lengths less than the given maxpath are used to build the subset. However, in the case of nodes that have label equal to maxpath, as many are chosen as required by the threshold. This number is stored in the info structure in the field thresholdReached. This field is decremented whenever a node labeled maxpath is encountered and the nodes labeled maxpath are aggregated in a maxpath table. As soon as the thresholdReached count goes to 0, the shortest path from this node to the constant is found. The extraction of nodes with the above labeling is based on the fact that each node, labeled with a path length, P, has at least one child labeled P or less. So extracting all nodes labeled a given path length P ensures complete paths between the root and the constant. Extraction of a partial number of nodes with a given path length may result in incomplete paths and hence the additional number of nodes are grabbed to complete the path. Since the Bdd is built bottom-up, other nodes labeled maxpath do lie on complete paths. The procedure may cause the subset to have a larger or smaller number of nodes than the specified threshold. The increase in the number of nodes is caused by the building of a subset and the reduction by recombination. However in most cases, the recombination overshadows the increase and the procedure returns a result with lower number of nodes than specified. The subsetNodeTable is NIL when there is no hard limit on the number of nodes. Further efforts towards keeping the subset closer to the threshold number were abandoned in favour of keeping the procedure simple and fast.]
SideEffects [SubsetNodeTable is changed if it is not NIL.]
SeeAlso []
Definition at line 1255 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [ Labels each node with the shortest distance from the constant.]
Description [Labels each node with the shortest distance from the constant. This is done in a DFS search of the BDD. Each node has an odd and even parity distance from the sink (since there exists paths to both zero and one) which is less than MAXSHORTINT. At each node these distances are updated using the minimum distance of its children from the constant. SInce now both the length from the root and child is known, the minimum path length(length of the shortest path between the root and the constant that this node lies on) of this node can be calculated and used to update the pathLengthArray]
SideEffects [Updates Path Table and path length array]
SeeAlso [CreatePathTable CreateTopDist AssessPathLength]
Definition at line 836 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [ The outer procedure to label each node with its shortest distance from the root and constant]
Description [ The outer procedure to label each node with its shortest distance from the root and constant. Calls CreateTopDist and CreateBotDist. The basis for computing the distance between root and constant is that the distance may be the sum of even distances from the node to the root and constant or the sum of odd distances from the node to the root and constant. Both CreateTopDist and CreateBotDist create the odd and even parity distances from the root and constant respectively.]
SideEffects [None]
SeeAlso [CreateTopDist CreateBotDist]
Definition at line 1019 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [ Labels each node with its shortest distance from the root]
Description [ Labels each node with its shortest distance from the root. This is done in a BFS search of the BDD. The nodes are processed in a queue implemented as pages(array) to reduce memory fragmentation. An entry is created for each node visited. The distance from the root to the node with the corresponding parity is updated. The procedure is called recursively each recusion level handling nodes at a given level from the root.]
SideEffects [Creates entries in the pathTable]
SeeAlso [CreatePathTable CreateBotDist]
Definition at line 635 of file cuddSubsetSP.c.
DdNode* Cudd_SubsetShortPaths | ( | DdManager * | dd, |
DdNode * | f, | ||
int | numVars, | ||
int | threshold, | ||
int | hardlimit | ||
) |
AutomaticEnd Function********************************************************************
Synopsis [Extracts a dense subset from a BDD with the shortest paths heuristic.]
Description [Extracts a dense subset from a BDD. This procedure tries to preserve the shortest paths of the input BDD, because they give many minterms and contribute few nodes. This procedure may increase the number of nodes in trying to create the subset or reduce the number of nodes due to recombination as compared to the original BDD. Hence the threshold may not be strictly adhered to. In practice, recombination overshadows the increase in the number of nodes and results in small BDDs as compared to the threshold. The hardlimit specifies whether threshold needs to be strictly adhered to. If it is set to 1, the procedure ensures that result is never larger than the specified limit but may be considerably less than the threshold. Returns a pointer to the BDD for the subset if successful; NULL otherwise. The value for numVars should be as close as possible to the size of the support of f for better efficiency. However, it is safe to pass the value returned by Cudd_ReadSize for numVars. If 0 is passed, then the value returned by Cudd_ReadSize is used.]
SideEffects [None]
SeeAlso [Cudd_SupersetShortPaths Cudd_SubsetHeavyBranch Cudd_ReadSize]
Definition at line 220 of file cuddSubsetSP.c.
DdNode* Cudd_SupersetShortPaths | ( | DdManager * | dd, |
DdNode * | f, | ||
int | numVars, | ||
int | threshold, | ||
int | hardlimit | ||
) |
Function********************************************************************
Synopsis [Extracts a dense superset from a BDD with the shortest paths heuristic.]
Description [Extracts a dense superset from a BDD. 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 tries to preserve the shortest paths of the complement BDD, because they give many minterms and contribute few nodes. This procedure may increase the number of nodes in trying to create the superset or reduce the number of nodes due to recombination as compared to the original BDD. Hence the threshold may not be strictly adhered to. In practice, recombination overshadows the increase in the number of nodes and results in small BDDs as compared to the threshold. The hardlimit specifies whether threshold needs to be strictly adhered to. If it is set to 1, the procedure ensures that result is never larger than the specified limit but may be considerably less than the threshold. Returns a pointer to the BDD for the superset if successful; NULL otherwise. The value for numVars should be as close as possible to the size of the support of f for better efficiency. However, it is safe to pass the value returned by Cudd_ReadSize for numVar. If 0 is passed, then the value returned by Cudd_ReadSize is used.]
SideEffects [None]
SeeAlso [Cudd_SubsetShortPaths Cudd_SupersetHeavyBranch Cudd_ReadSize]
Definition at line 272 of file cuddSubsetSP.c.
DdNode* cuddSubsetShortPaths | ( | DdManager * | dd, |
DdNode * | f, | ||
int | numVars, | ||
int | threshold, | ||
int | hardlimit | ||
) |
Function********************************************************************
Synopsis [The outermost procedure to return a subset of the given BDD with the shortest path lengths.]
Description [The outermost procedure to return a subset of the given BDD with the largest cubes. The path lengths are calculated, the maximum allowable path length is determined and the number of nodes of this path length that can be used to build a subset. If the threshold is larger than the size of the original BDD, the original BDD is returned. ]
SideEffects [None]
SeeAlso [Cudd_SubsetShortPaths]
Definition at line 316 of file cuddSubsetSP.c.
|
static |
AutomaticStart
Function********************************************************************
Synopsis [Resize the number of pages allocated to store the distances related to each node.]
Description [Resize the number of pages allocated to store the distances related to each node. The procedure moves the counter to the next page when the end of the page is reached and allocates new pages when necessary. ]
SideEffects [Changes the size of pages, page, page index, maximum number of pages freeing stuff in case of memory out. ]
SeeAlso []
Definition at line 512 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [Resize the number of pages allocated to store nodes in the BFS traversal of the Bdd .]
Description [Resize the number of pages allocated to store nodes in the BFS traversal of the Bdd. The procedure moves the counter to the next page when the end of the page is reached and allocates new pages when necessary.]
SideEffects [Changes the size of pages, page, page index, maximum number of pages freeing stuff in case of memory out. ]
SeeAlso []
Definition at line 574 of file cuddSubsetSP.c.
|
static |
Function********************************************************************
Synopsis [Procedure to free te result dds stored in the NodeDist pages.]
Description [None]
SideEffects [None]
SeeAlso []
Definition at line 1643 of file cuddSubsetSP.c.
|
static |
Definition at line 147 of file cuddSubsetSP.c.
|
static |
Definition at line 154 of file cuddSubsetSP.c.
|
static |
Definition at line 129 of file cuddSubsetSP.c.
|
static |
Definition at line 146 of file cuddSubsetSP.c.
|
static |
Definition at line 153 of file cuddSubsetSP.c.
|
static |
Definition at line 139 of file cuddSubsetSP.c.
|
static |
Definition at line 144 of file cuddSubsetSP.c.
|
static |
Definition at line 143 of file cuddSubsetSP.c.
|
static |
Definition at line 142 of file cuddSubsetSP.c.
|
static |
Definition at line 145 of file cuddSubsetSP.c.
|
static |
Definition at line 140 of file cuddSubsetSP.c.
|
static |
Definition at line 151 of file cuddSubsetSP.c.
|
static |
Definition at line 150 of file cuddSubsetSP.c.
|
static |
Definition at line 149 of file cuddSubsetSP.c.
|
static |
Definition at line 152 of file cuddSubsetSP.c.
|
static |
Definition at line 140 of file cuddSubsetSP.c.