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

  Synopsis    [Finds a small BDD in a function interval.]

  Description [Finds a small BDD in a function interval. Given BDDs
  <code>l</code> and <code>u</code>, representing the lower bound and
  upper bound of a function interval, Cudd_bddSqueeze produces the BDD
  of a function within the interval with a small BDD.  Returns a
  pointer to the result if successful; NULL otherwise.]

  SideEffects [None]

  SeeAlso     [Cudd_bddRestrict Cudd_bddLICompaction]

******************************************************************************/
Function
Synopsis    [Finds a small BDD in a function interval.]

Description [Finds a small BDD in a function interval. Given BDDs
l and u, representing the lower bound and
upper bound of a function interval, Cudd_bddSqueeze produces the BDD
of a function within the interval with a small BDD.  Returns a
pointer to the result if successful; NULL otherwise.]




Function Synopsis [ Finds a small BDD in a function interval . ] Description [ Finds a small BDD in a function interval . Given BDDs l and u representing the lower bound and upper bound of a function interval Cudd_bddSqueeze produces the BDD of a function within the interval with a small BDD . Returns a pointer to the result if successful ; NULL otherwise . ]
DdNode *
Cudd_bddSqueeze(
  DdManager * dd ,
  DdNode * l ,
  DdNode * u )
{
    DdNode *res;
    int sizeRes, sizeL, sizeU;
    do {
        dd->reordered = 0;
        res = cuddBddSqueeze(dd,l,u);
    } while (dd->reordered == 1);
    if (res == NULL) return(NULL);
    sizeRes = Cudd_DagSize(res);
    sizeU = Cudd_DagSize(u);
    if (sizeU <= sizeRes) {
        cuddRef(res);
        Cudd_IterDerefBdd(dd,res);
        res = u;
        sizeRes = sizeU;
    }
    sizeL = Cudd_DagSize(l);
    if (sizeL <= sizeRes) {
        cuddRef(res);
        Cudd_IterDerefBdd(dd,res);
        res = l;
        sizeRes = sizeL;
    }
    return(res);
}
DdNode * Cudd_bddSqueeze ( DdManager * dd , DdNode * l , DdNode * u ) { DdNode * res ; int sizeRes , sizeL , sizeU ; do { dd -> reordered = 0 ; res = cuddBddSqueeze ( dd , l , u ) ; } while ( dd -> reordered == 1 ) ; if ( res == NULL ) return ( NULL ) ; sizeRes = Cudd_DagSize ( res ) ; sizeU = Cudd_DagSize ( u ) ; if ( sizeU <= sizeRes ) { cuddRef ( res ) ; Cudd_IterDerefBdd ( dd , res ) ; res = u ; sizeRes = sizeU ; } sizeL = Cudd_DagSize ( l ) ; if ( sizeL <= sizeRes ) { cuddRef ( res ) ; Cudd_IterDerefBdd ( dd , res ) ; res = l ; sizeRes = sizeL ; } return ( res ) ; }
Function
Synopsis    [Finds a small BDD in a function interval.]
Function Synopsis [ Finds a small BDD in a function interval . ]
/* manager */ /* lower bound */ /* upper bound */ /* We now compare the result with the bounds and return the smallest.
    ** We first compare to u, so that in case l == 0 and u == 1, we return
    ** 0 as in other minimization algorithms. */