Esempio n. 1
0
 @Override
 public void propagate(int idxVarInProp, int mask) throws ContradictionException {
   if (isS1Var(idxVarInProp)) {
     s1D.freeze();
     s1D.forEach(s1Env -> s2.remove(s1Env, this), SetEventType.REMOVE_FROM_ENVELOPE);
     s1D.forEach(s1Ker -> s2.force(s1Ker, this), SetEventType.ADD_TO_KER);
     s1D.unfreeze();
   } else {
     assert isS2Var(idxVarInProp);
     s2D.freeze();
     s2D.forEach(s2Env -> s1.remove(s2Env, this), SetEventType.REMOVE_FROM_ENVELOPE);
     s2D.forEach(s2Ker -> s1.force(s2Ker, this), SetEventType.ADD_TO_KER);
     s2D.unfreeze();
   }
 }
Esempio n. 2
0
 @Override
 public void propagate(int evtmask) throws ContradictionException {
   if (!antecedent.isInstantiated()) {
     if (!PropUtil.isKerSubsetEnv(result, consequent)
         || !PropUtil.isKerSubsetEnv(consequent, result)) {
       antecedent.instantiateTo(0, this);
     } else if (!PropUtil.isKerSubsetEnv(result, alternative)
         || !PropUtil.isKerSubsetEnv(alternative, result)) {
       antecedent.instantiateTo(1, this);
     } else {
       ISetIterator iter = result.getUB().iterator();
       while (iter.hasNext()) {
         int i = iter.nextInt();
         if (!consequent.getUB().contains(i) && !alternative.getUB().contains(i)) {
           result.remove(i, this);
         } else if (consequent.getLB().contains(i) && alternative.getLB().contains(i)) {
           result.force(i, this);
         }
       }
     }
   }
   if (antecedent.isInstantiated()) {
     if (antecedent.getValue() == 1) {
       PropUtil.envSubsetEnv(result, consequent, this);
       PropUtil.envSubsetEnv(consequent, result, this);
       PropUtil.kerSubsetKer(result, consequent, this);
       PropUtil.kerSubsetKer(consequent, result, this);
     } else {
       PropUtil.envSubsetEnv(result, alternative, this);
       PropUtil.envSubsetEnv(alternative, result, this);
       PropUtil.kerSubsetKer(result, alternative, this);
       PropUtil.kerSubsetKer(alternative, result, this);
     }
   }
 }