abc/src/bdd/cudd/cuddSubsetSP.c
/**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     []

******************************************************************************/
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;]




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 ; ]
static unsigned int
AssessPathLength(
  unsigned int * pathLengthArray ,
  int  threshold ,
  int  numVars ,
  unsigned int * excess ,
  FILE *fp )
{
    unsigned int i, maxpath;
    int temp;
    temp = threshold;
    i = 0;
    maxpath = 0;
    while ((i < (unsigned) numVars+1) && (temp > 0)) {
        if (pathLengthArray[i] > 0) {
            maxpath = i;
            temp = temp - pathLengthArray[i];
        }
        i++;
    }
    if (temp >= 0) {
        maxpath++; 
        *excess = 0;
    } else { 
        *excess = temp + pathLengthArray[maxpath];
    }
    if (maxpath == 0) {
        fprintf(fp, "Path Length array seems to be all zeroes, check\n");
    }
    return(maxpath);
}
static unsigned int AssessPathLength ( unsigned int * pathLengthArray , int threshold , int numVars , unsigned int * excess , FILE * fp ) { unsigned int i , maxpath ; int temp ; temp = threshold ; i = 0 ; maxpath = 0 ; while ( ( i < ( unsigned ) numVars + 1 ) && ( temp > 0 ) ) { if ( pathLengthArray [ i ] > 0 ) { maxpath = i ; temp = temp - pathLengthArray [ i ] ; } i ++ ; } if ( temp >= 0 ) { maxpath ++ ; * excess = 0 ; } else { * excess = temp + pathLengthArray [ maxpath ] ; } if ( maxpath == 0 ) { fprintf ( fp , " \n " ) ; } return ( maxpath ) ; }
Function
Synopsis    [Chooses the maximum allowable path length of nodes under the
threshold.]
Function Synopsis [ Chooses the maximum allowable path length of nodes under the threshold . ]
/* array determining number of nodes belonging to the different path lengths */ /* threshold to determine maximum allowable nodes in the subset */ /* maximum number of variables */ /* number of nodes labeled maxpath required in the subset */ /* where to write messages */ /* quit loop if i reaches max number of variables or if temp reaches
     * below zero
     */ /* if all nodes of max path are needed */ /* now maxpath  becomes the next maxppath or max number
                      of variables */ /* normal case when subset required is less than size of
                original BDD */