Esempio n. 1
0
 /**
  * Convert a BDD that to a list of indices of this domain. Same as getVarIndices(BDD), except only
  * 'max' indices are extracted.
  *
  * @param bdd bdd that is the disjunction of domain indices
  * @param max maximum number of entries to be returned
  * @see #ithVar(long)
  */
 public BigInteger[] getVarIndices(BDD bdd, int max) {
   BDDVarSet myvarset = set(); // can't use var here, must respect subclass a factory may provide
   int n = (int) bdd.satCount(myvarset);
   if (max != -1 && n > max) n = max;
   BigInteger[] res = new BigInteger[n];
   BDDIterator it = bdd.iterator(myvarset);
   myvarset.free();
   for (int i = 0; i < n; i++) {
     res[i] = it.nextValue(this);
   }
   return res;
 }
Esempio n. 2
0
 /**
  * Returns the variable set that contains the variables used to define this finite domain block.
  *
  * <p>Compare to fdd_ithset.
  *
  * @return BDDVarSet
  */
 public BDDVarSet set() {
   return var.id();
 }