Exemplo n.º 1
0
 @Override
 public ESat isEntailed() {
   if (set.getEnvelopeSize() == 0) {
     if (notEmpty) {
       return ESat.FALSE;
     } else {
       return ESat.TRUE;
     }
   }
   int lb = min.getLB();
   int ub = min.getUB();
   for (int j = set.getKernelFirst(); j != SetVar.END; j = set.getKernelNext()) {
     if (get(j) < lb) {
       return ESat.FALSE;
     }
   }
   int minVal = Integer.MAX_VALUE;
   for (int j = set.getEnvelopeFirst(); j != SetVar.END; j = set.getEnvelopeNext()) {
     if (minVal > get(j)) {
       minVal = get(j);
     }
   }
   if (minVal > ub && (notEmpty || set.getKernelSize() > 0)) {
     return ESat.FALSE;
   }
   if (isCompletelyInstantiated()) {
     return ESat.TRUE;
   }
   return ESat.UNDEFINED;
 }
Exemplo n.º 2
0
 @Override
 public void propagate(int evtmask) throws ContradictionException {
   for (int j = set.getKernelFirst(); j != SetVar.END; j = set.getKernelNext()) {
     min.updateUpperBound(get(j), this);
   }
   int minVal = Integer.MAX_VALUE;
   int lb = min.getLB();
   for (int j = set.getEnvelopeFirst(); j != SetVar.END; j = set.getEnvelopeNext()) {
     int k = get(j);
     if (k < lb) {
       set.removeFromEnvelope(j, this);
     } else {
       if (minVal > k) {
         minVal = k;
       }
     }
   }
   if (notEmpty || set.getKernelSize() > 0) {
     min.updateLowerBound(minVal, this);
   }
 }