abc/src/bdd/cudd/cuddZddSymm.c
/**Function********************************************************************

  Synopsis [Given a set of moves, returns the ZDD heap to the position
  giving the minimum size.]

  Description [Given a set of moves, returns the ZDD 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]

  SeeAlso     []

******************************************************************************/
Function
Synopsis [Given a set of moves, returns the ZDD heap to the position
giving the minimum size.]

Description [Given a set of moves, returns the ZDD 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.]




Function Synopsis [ Given a set of moves returns the ZDD heap to the position giving the minimum size . ] Description [ Given a set of moves returns the ZDD 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 . ]
static int
cuddZddSymmSiftingBackward(
  DdManager * table,
  Move * moves,
  int  size)
{
    int         i;
    int         i_best;
    Move        *move;
    int         res = -1;
    i_best = -1;
    for (move = moves, i = 0; move != NULL; move = move->next, i++) {
        if (move->size < size) {
            i_best = i;
            size = move->size;
        }
    }
    for (move = moves, i = 0; move != NULL; move = move->next, i++) {
        if (i == i_best) break;
        if ((table->subtableZ[move->x].next == move->x) &&
            (table->subtableZ[move->y].next == move->y)) {
            res = cuddZddSwapInPlace(table, move->x, move->y);
            if (!res) return(0);
        }
        else { 
            res = zdd_group_move_backward(table, move->x, move->y);
        }
        if (i_best == -1 && res == size)
            break;
    }
    return(1);
}
static int cuddZddSymmSiftingBackward ( DdManager * table , Move * moves , int size ) { int i ; int i_best ; Move * move ; int res = -1 ; i_best = -1 ; for ( move = moves , i = 0 ; move != NULL ; move = move -> next , i ++ ) { if ( move -> size < size ) { i_best = i ; size = move -> size ; } } for ( move = moves , i = 0 ; move != NULL ; move = move -> next , i ++ ) { if ( i == i_best ) break ; if ( ( table -> subtableZ [ move -> x ] . next == move -> x ) && ( table -> subtableZ [ move -> y ] . next == move -> y ) ) { res = cuddZddSwapInPlace ( table , move -> x , move -> y ) ; if ( ! res ) return ( 0 ) ; } else { res = zdd_group_move_backward ( table , move -> x , move -> y ) ; } if ( i_best == -1 && res == size ) break ; } return ( 1 ) ; }
Function
Synopsis [Given a set of moves, returns the ZDD heap to the position
giving the minimum size.]
Function Synopsis [ Given a set of moves returns the ZDD heap to the position giving the minimum size . ]
/* Group move necessary */