cudd  3.0.0
The University of Colorado Decision Diagram Package
Macros | Functions
cuddSymmetry.c File Reference

Functions for symmetry-based variable reordering. More...

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

Macros

#define MV_OOM   (Move *)1
 

Functions

void Cudd_SymmProfile (DdManager *table, int lower, int upper)
 Prints statistics on symmetric variables. More...
 
int cuddSymmCheck (DdManager *table, int x, int y)
 Checks for symmetry of x and y. More...
 
int cuddSymmSifting (DdManager *table, int lower, int upper)
 Symmetric sifting algorithm. More...
 
int cuddSymmSiftingConv (DdManager *table, int lower, int upper)
 Symmetric sifting to convergence algorithm. More...
 
static int ddSymmUniqueCompare (void const *ptrX, void const *ptrY)
 Comparison function used by qsort. More...
 
static int ddSymmSiftingAux (DdManager *table, int x, int xLow, int xHigh)
 Given xLow <= x <= xHigh moves x up and down between the boundaries. More...
 
static int ddSymmSiftingConvAux (DdManager *table, int x, int xLow, int xHigh)
 Given xLow <= x <= xHigh moves x up and down between the boundaries. More...
 
static MoveddSymmSiftingUp (DdManager *table, int y, int xLow)
 Moves x up until either it reaches the bound (xLow) or the size of the DD heap increases too much. More...
 
static MoveddSymmSiftingDown (DdManager *table, int x, int xHigh)
 Moves x down until either it reaches the bound (xHigh) or the size of the DD heap increases too much. More...
 
static int ddSymmGroupMove (DdManager *table, int x, int y, Move **moves)
 Swaps two groups. More...
 
static int ddSymmGroupMoveBackward (DdManager *table, int x, int y)
 Undoes the swap of two groups. More...
 
static int ddSymmSiftingBackward (DdManager *table, Move *moves, int size)
 Given a set of moves, returns the DD heap to the position giving the minimum size. More...
 
static void ddSymmSummary (DdManager *table, int lower, int upper, int *symvars, int *symgroups)
 Counts numbers of symmetric variables and symmetry groups. More...
 

Detailed Description

Functions for symmetry-based variable reordering.

Author
Shipra Panda, Fabio Somenzi

Function Documentation

◆ Cudd_SymmProfile()

void Cudd_SymmProfile ( DdManager table,
int  lower,
int  upper 
)

Prints statistics on symmetric variables.

The information is accurate only if this function is called right after reordering with methods CUDD_REORDER_SYMM_SIFT or CUDD_REORDER_SYMM_SIFT_CONV.

Side effects None

◆ cuddSymmCheck()

int cuddSymmCheck ( DdManager table,
int  x,
int  y 
)

Checks for symmetry of x and y.

Ignores projection functions, unless they are isolated.

Returns
1 in case of symmetry; 0 otherwise.
Side effects None

◆ cuddSymmSifting()

int cuddSymmSifting ( DdManager table,
int  lower,
int  upper 
)

Symmetric sifting algorithm.

Assumes that no dead nodes are present.

  1. Order all the variables according to the number of entries in each unique subtable.
  2. Sift the variable up and down, remembering each time the total size of the DD heap and grouping variables that are symmetric.
  3. Select the best permutation.
  4. Repeat 3 and 4 for all variables.
Returns
1 plus the number of symmetric variables if successful; 0 otherwise.
Side effects None
See also
cuddSymmSiftingConv

◆ cuddSymmSiftingConv()

int cuddSymmSiftingConv ( DdManager table,
int  lower,
int  upper 
)

Symmetric sifting to convergence algorithm.

Assumes that no dead nodes are present.

  1. Order all the variables according to the number of entries in each unique subtable.
  2. Sift the variable up and down, remembering each time the total size of the DD heap and grouping variables that are symmetric.
  3. Select the best permutation.
  4. Repeat 3 and 4 for all variables.
  5. Repeat 1-4 until no further improvement.
Returns
1 plus the number of symmetric variables if successful; 0 otherwise.
Side effects None
See also
cuddSymmSifting

◆ ddSymmGroupMove()

static int ddSymmGroupMove ( DdManager table,
int  x,
int  y,
Move **  moves 
)
static

Swaps two groups.

x is assumed to be the bottom variable of the first group. y is assumed to be the top variable of the second group. Updates the list of moves.

Returns
the number of keys in the table if successful; 0 otherwise.
Side effects None

◆ ddSymmGroupMoveBackward()

static int ddSymmGroupMoveBackward ( DdManager table,
int  x,
int  y 
)
static

Undoes the swap of two groups.

x is assumed to be the bottom variable of the first group. y is assumed to be the top variable of the second group.

Returns
the number of keys in the table if successful; 0 otherwise.
Side effects None

◆ ddSymmSiftingAux()

static int ddSymmSiftingAux ( DdManager table,
int  x,
int  xLow,
int  xHigh 
)
static

Given xLow <= x <= xHigh moves x up and down between the boundaries.

Finds the best position and does the required changes. Assumes that x is not part of a symmetry group.

Returns
1 if successful; 0 otherwise.
Side effects None

◆ ddSymmSiftingBackward()

static int ddSymmSiftingBackward ( DdManager table,
Move moves,
int  size 
)
static

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.
Side effects None

◆ ddSymmSiftingConvAux()

static int ddSymmSiftingConvAux ( DdManager table,
int  x,
int  xLow,
int  xHigh 
)
static

Given xLow <= x <= xHigh moves x up and down between the boundaries.

Finds the best position and does the required changes. Assumes that x is either an isolated variable, or it is the bottom of a symmetry group. All symmetries may not have been found, because of exceeded growth limit.

Returns
1 if successful; 0 otherwise.
Side effects None

◆ ddSymmSiftingDown()

static Move* ddSymmSiftingDown ( DdManager table,
int  x,
int  xHigh 
)
static

Moves x down until either it reaches the bound (xHigh) or the size of the DD heap increases too much.

Assumes that x is the bottom of a symmetry group. Checks x for symmetry to the adjacent variables. If symmetry is found, the symmetry group of x is merged with the symmetry group of the other variable.

Returns
the set of moves in case of success; MV_OOM if memory is full.
Side effects None

◆ ddSymmSiftingUp()

static Move* ddSymmSiftingUp ( DdManager table,
int  y,
int  xLow 
)
static

Moves x up until either it reaches the bound (xLow) or the size of the DD heap increases too much.

Assumes that x is the top of a symmetry group. Checks x for symmetry to the adjacent variables. If symmetry is found, the symmetry group of x is merged with the symmetry group of the other variable.

Returns
the set of moves in case of success; MV_OOM if memory is full.
Side effects None

◆ ddSymmSummary()

static void ddSymmSummary ( DdManager table,
int  lower,
int  upper,
int *  symvars,
int *  symgroups 
)
static

Counts numbers of symmetric variables and symmetry groups.

Side effects None

◆ ddSymmUniqueCompare()

static int ddSymmUniqueCompare ( void const *  ptrX,
void const *  ptrY 
)
static

Comparison function used by qsort.

Used 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.
Side effects None