コード例 #1
0
 @Override
 public ESat isEntailed() {
   boolean possibleTrue =
       PropUtil.isKerSubsetEnv(result, consequent) && PropUtil.isKerSubsetEnv(consequent, result);
   boolean possibleFalse =
       PropUtil.isKerSubsetEnv(result, alternative)
           && PropUtil.isKerSubsetEnv(alternative, result);
   if (!possibleTrue && !possibleFalse) {
     return ESat.FALSE;
   }
   if (antecedent.isInstantiated()) {
     if (antecedent.getValue() == 1) {
       if (!possibleTrue) {
         return ESat.FALSE;
       }
       return result.isInstantiated() && consequent.isInstantiated() ? ESat.TRUE : ESat.UNDEFINED;
     } else {
       if (!possibleFalse) {
         return ESat.FALSE;
       }
       return result.isInstantiated() && alternative.isInstantiated() ? ESat.TRUE : ESat.UNDEFINED;
     }
   }
   if (possibleTrue
       && possibleFalse
       && result.isInstantiated()
       && consequent.isInstantiated()
       && alternative.isInstantiated()) {
     return ESat.TRUE;
   }
   return ESat.UNDEFINED;
 }
コード例 #2
0
ファイル: PropSetEqual.java プロジェクト: gsdlab/chocosolver
  @Override
  public ESat isEntailed() {
    if (!PropUtil.isKerSubsetEnv(s1, s2) || !PropUtil.isKerSubsetEnv(s2, s1)) {
      return ESat.FALSE;
    }
    if (s1.isInstantiated() && s2.isInstantiated()) {
      return ESat.TRUE;
    }
    int setIntersection = 0;
    ISetIterator iter = s1.getUB().iterator();
    while (iter.hasNext()) {
      int i = iter.nextInt();
      if (s2.getUB().contains(i)) {
        setIntersection++;
      }
    }
    if (setIntersection < s1.getCard().getLB() || setIntersection < s2.getCard().getLB()) {
      return ESat.FALSE;
    }

    return ESat.UNDEFINED;
  }