abc-master
|
Go to the source code of this file.
Macros | |
#define | DD_MAX_SUBTABLE_SPARSITY 8 |
#define | DD_SHRINK_FACTOR 2 |
Functions | |
static int | ddUniqueCompare (int *ptrX, int *ptrY) |
static Move * | ddSwapAny (DdManager *table, int x, int y) |
static int | ddSiftingAux (DdManager *table, int x, int xLow, int xHigh) |
static Move * | ddSiftingUp (DdManager *table, int y, int xLow) |
static Move * | ddSiftingDown (DdManager *table, int x, int xHigh) |
static int | ddSiftingBackward (DdManager *table, int size, Move *moves) |
static int | ddReorderPreprocess (DdManager *table) |
static int | ddReorderPostprocess (DdManager *table) |
static int | ddShuffle (DdManager *table, int *permutation) |
static int | ddSiftUp (DdManager *table, int x, int xLow) |
static void | bddFixTree (DdManager *table, MtrNode *treenode) |
static int | ddUpdateMtrTree (DdManager *table, MtrNode *treenode, int *perm, int *invperm) |
static int | ddCheckPermuation (DdManager *table, MtrNode *treenode, int *perm, int *invperm) |
int | Cudd_ReduceHeap (DdManager *table, Cudd_ReorderingType heuristic, int minsize) |
int | Cudd_ShuffleHeap (DdManager *table, int *permutation) |
DdNode * | cuddDynamicAllocNode (DdManager *table) |
int | cuddSifting (DdManager *table, int lower, int upper) |
int | cuddSwapping (DdManager *table, int lower, int upper, Cudd_ReorderingType heuristic) |
int | cuddNextHigh (DdManager *table, int x) |
int | cuddNextLow (DdManager *table, int x) |
int | cuddSwapInPlace (DdManager *table, int x, int y) |
int | cuddBddAlignToZdd (DdManager *table) |
Variables | |
static char rcsid[] | DD_UNUSED = "$Id: cuddReorder.c,v 1.69 2009/02/21 18:24:10 fabio Exp $" |
static int * | entry |
int | ddTotalNumberSwapping |
#define DD_MAX_SUBTABLE_SPARSITY 8 |
CFile***********************************************************************
FileName [cuddReorder.c]
PackageName [cudd]
Synopsis [Functions for dynamic variable reordering.]
Description [External procedures included in this file:
Internal procedures included in this module:
Static procedures included in this module:
]
Author [Shipra Panda, Bernard Plessier, Fabio Somenzi]
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 86 of file cuddReorder.c.
#define DD_SHRINK_FACTOR 2 |
Definition at line 87 of file cuddReorder.c.
Function********************************************************************
Synopsis [Fixes the BDD variable group tree after a shuffle.]
Description [Fixes the BDD variable group tree after a shuffle. Assumes that the order of the variables in a terminal node has not been changed.]
SideEffects [Changes the BDD variable group tree.]
SeeAlso []
Definition at line 2010 of file cuddReorder.c.
int Cudd_ReduceHeap | ( | DdManager * | table, |
Cudd_ReorderingType | heuristic, | ||
int | minsize | ||
) |
AutomaticEnd Function********************************************************************
Synopsis [Main dynamic reordering routine.]
Description [Main dynamic reordering routine. Calls one of the possible reordering procedures:
For sifting, symmetric sifting, group sifting, and window permutation it is possible to request reordering to convergence.
The core of all methods is the reordering procedure cuddSwapInPlace() which swaps two adjacent variables and is based on Rudell's paper. Returns 1 in case of success; 0 otherwise. In the case of symmetric sifting (with and without convergence) returns 1 plus the number of symmetric variables, in case of success.]
SideEffects [Changes the variable order for all diagrams and clears the cache.]
Definition at line 176 of file cuddReorder.c.
int Cudd_ShuffleHeap | ( | DdManager * | table, |
int * | permutation | ||
) |
Function********************************************************************
Synopsis [Reorders variables according to given permutation.]
Description [Reorders variables according to given permutation. The i-th entry of the permutation array contains the index of the variable that should be brought to the i-th level. The size of the array should be equal or greater to the number of variables currently in use. Returns 1 in case of success; 0 otherwise.]
SideEffects [Changes the variable order for all diagrams and clears the cache.]
SeeAlso [Cudd_ReduceHeap]
Definition at line 338 of file cuddReorder.c.
int cuddBddAlignToZdd | ( | DdManager * | table | ) |
Function********************************************************************
Synopsis [Reorders BDD variables according to the order of the ZDD variables.]
Description [Reorders BDD variables according to the order of the ZDD variables. This function can be called at the end of ZDD reordering to insure that the order of the BDD variables is consistent with the order of the ZDD variables. The number of ZDD variables must be a multiple of the number of BDD variables. Let M
be the ratio of the two numbers. cuddBddAlignToZdd then considers the ZDD variables from M*i
to (M+1)*i-1
as corresponding to BDD variable i
. This function should be normally called from Cudd_zddReduceHeap, which clears the cache. Returns 1 in case of success; 0 otherwise.]
SideEffects [Changes the BDD variable order for all diagrams and performs garbage collection of the BDD unique table.]
SeeAlso [Cudd_ShuffleHeap Cudd_zddReduceHeap]
Definition at line 1251 of file cuddReorder.c.
Function********************************************************************
Synopsis [Dynamically allocates a Node.]
Description [Dynamically allocates a Node. This procedure is similar to cuddAllocNode in Cudd_Table.c, but it does not attempt garbage collection, because during reordering there are no dead nodes. Returns a pointer to a new node if successful; NULL is memory is full.]
SideEffects [None]
SeeAlso [cuddAllocNode]
Definition at line 406 of file cuddReorder.c.
int cuddNextHigh | ( | DdManager * | table, |
int | x | ||
) |
Function********************************************************************
Synopsis [Finds the next subtable with a larger index.]
Description [Finds the next subtable with a larger index. Returns the index.]
SideEffects [None]
SeeAlso [cuddNextLow]
Definition at line 716 of file cuddReorder.c.
int cuddNextLow | ( | DdManager * | table, |
int | x | ||
) |
Function********************************************************************
Synopsis [Finds the next subtable with a smaller index.]
Description [Finds the next subtable with a smaller index. Returns the index.]
SideEffects [None]
SeeAlso [cuddNextHigh]
Definition at line 738 of file cuddReorder.c.
int cuddSifting | ( | DdManager * | table, |
int | lower, | ||
int | upper | ||
) |
Function********************************************************************
Synopsis [Implementation of Rudell's sifting algorithm.]
Description [Implementation of Rudell's sifting algorithm. Assumes that no dead nodes are present.
Returns 1 if successful; 0 otherwise.]
SideEffects [None]
Definition at line 508 of file cuddReorder.c.
int cuddSwapInPlace | ( | DdManager * | table, |
int | x, | ||
int | y | ||
) |
Function********************************************************************
Synopsis [Swaps two adjacent variables.]
Description [Swaps two adjacent variables. It assumes that no dead nodes are present on entry to this procedure. The procedure then guarantees that no dead nodes will be present when it terminates. cuddSwapInPlace assumes that x < y. Returns the number of keys in the table if successful; 0 otherwise.]
SideEffects [None]
Definition at line 761 of file cuddReorder.c.
int cuddSwapping | ( | DdManager * | table, |
int | lower, | ||
int | upper, | ||
Cudd_ReorderingType | heuristic | ||
) |
Function********************************************************************
Synopsis [Reorders variables by a sequence of (non-adjacent) swaps.]
Description [Implementation of Plessier's algorithm that reorders variables by a sequence of (non-adjacent) swaps.
Returns 1 in case of success; 0 otherwise.]
SideEffects [None]
Definition at line 605 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Checks the BDD variable group tree before a shuffle.]
Description [Checks the BDD variable group tree before a shuffle. Returns 1 if successful; 0 otherwise.]
SideEffects [Changes the BDD variable group tree.]
SeeAlso []
Definition at line 2103 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Cleans up at the end of reordering.]
Description []
SideEffects [None]
Definition at line 1864 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Prepares the DD heap for dynamic reordering.]
Description [Prepares the DD heap for dynamic reordering. Does garbage collection, to guarantee that there are no dead nodes; clears the cache, which is invalidated by dynamic reordering; initializes the number of isolated projection functions; and initializes the interaction matrix. Returns 1 in case of success; 0 otherwise.]
SideEffects [None]
Definition at line 1826 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Reorders variables according to a given permutation.]
Description [Reorders variables according to a given permutation. The i-th permutation array contains the index of the variable that should be brought to the i-th level. ddShuffle assumes that no dead nodes are present and that the interaction matrix is properly initialized. The reordering is achieved by a series of upward sifts. Returns 1 if successful; 0 otherwise.]
SideEffects [None]
SeeAlso []
Definition at line 1897 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Given xLow <= x <= xHigh moves x up and down between the boundaries.]
Description [Given xLow <= x <= xHigh moves x up and down between the boundaries. Finds the best position and does the required changes. Returns 1 if successful; 0 otherwise.]
SideEffects [None]
Definition at line 1488 of file cuddReorder.c.
Function********************************************************************
Synopsis [Given a set of moves, returns the DD heap to the position giving the minimum size.]
Description [Given a set of moves, returns the DD heap to the position giving the minimum size. In case of ties, returns to the closest position giving the minimum size. Returns 1 in case of success; 0 otherwise.]
SideEffects [None]
Definition at line 1787 of file cuddReorder.c.
Function********************************************************************
Synopsis [Sifts a variable down.]
Description [Sifts a variable down. Moves x down until either it reaches the bound (xHigh) or the size of the DD heap increases too much. Returns the set of moves in case of success; NULL if memory is full.]
SideEffects [None]
Definition at line 1695 of file cuddReorder.c.
Function********************************************************************
Synopsis [Sifts a variable up.]
Description [Sifts a variable up. Moves y up until either it reaches the bound (xLow) or the size of the DD heap increases too much. Returns the set of moves in case of success; NULL if memory is full.]
SideEffects [None]
Definition at line 1595 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Moves one variable up.]
Description [Takes a variable from position x and sifts it up to position xLow; xLow should be less than or equal to x. Returns 1 if successful; 0 otherwise]
SideEffects [None]
SeeAlso []
Definition at line 1974 of file cuddReorder.c.
Function********************************************************************
Synopsis [Swaps any two variables.]
Description [Swaps any two variables. Returns the set of moves.]
SideEffects [None]
Definition at line 1347 of file cuddReorder.c.
|
static |
AutomaticStart
Function********************************************************************
Synopsis [Comparison function used by qsort.]
Description [Comparison function used by qsort to order the variables according to the number of keys in the subtables. Returns the difference in number of keys between the two variables being compared.]
SideEffects [None]
Definition at line 1323 of file cuddReorder.c.
|
static |
Function********************************************************************
Synopsis [Updates the BDD variable group tree before a shuffle.]
Description [Updates the BDD variable group tree before a shuffle. Returns 1 if successful; 0 otherwise.]
SideEffects [Changes the BDD variable group tree.]
SeeAlso []
Definition at line 2044 of file cuddReorder.c.
|
static |
Definition at line 102 of file cuddReorder.c.
int ddTotalNumberSwapping |
Definition at line 107 of file cuddReorder.c.
|
static |
Definition at line 105 of file cuddReorder.c.