@Override
 public void propagate(int evtmask) throws ContradictionException {
   if (PropagatorEventType.isFullPropagation(evtmask)) {
     if (n2 < n + vars[n].getLB()) {
       fails(); // TODO: could be more precise, for explanation purpose
     }
     buildDigraph();
   }
   digraph.removeNode(n2);
   digraph.removeNode(n2 + 1);
   free.clear();
   for (int i = 0; i < n; i++) {
     if (digraph.getPredOf(i).size() == 0) {
       free.set(i);
     }
   }
   for (int i = n; i < n2; i++) {
     if (digraph.getSuccOf(i).size() == 0) {
       free.set(i);
     }
   }
   int card = repairMatching();
   vars[n].updateUpperBound(card, this);
   if (vars[n].getLB() == card) {
     filter();
   }
   for (int i = 0; i < idms.length; i++) {
     idms[i].unfreeze();
   }
 }
Example #2
0
 @Override
 public void propagate(int evtmask) throws ContradictionException {
   if (PropagatorEventType.isFullPropagation(evtmask)) {
     poss.clear();
     int nbMandForSure = 0;
     for (int i = 0; i < nb_vars; i++) {
       IntVar var = vars[i];
       int nb = 0;
       for (int j : values) {
         if (var.contains(j)) {
           nb++;
         }
       }
       if (nb == var.getDomainSize()) {
         nbMandForSure++;
       } else if (nb > 0) {
         poss.add(i);
       }
     }
     nbSure.set(nbMandForSure);
   }
   filter();
 }