Ejemplo n.º 1
0
 @Override
 public int getPropagationConditions(int vIdx) {
   if (bothEnumerated) {
     return EventType.INT_ALL_MASK();
   } else {
     return EventType.INSTANTIATE.mask + EventType.BOUND.mask;
   }
 }
Ejemplo n.º 2
0
 @Override
 public void backPropagate(int mask) throws ContradictionException {
   // one of the variable as changed externally, this involves a complete update of this
   if (!EventType.isRemove(mask)) {
     int elb = A.getLB() + B.getLB();
     int eub = A.getUB() + B.getUB();
     int ilb = LB.get();
     int iub = UB.get();
     int old_size = iub - ilb; // is == 0, then the view is already instantiated
     boolean up = false, down = false;
     EventType e = EventType.VOID;
     if (elb > ilb) {
       if (elb > iub) {
         this.contradiction(this, MSG_LOW);
       }
       VALUES.clear(ilb - OFFSET, elb - OFFSET);
       ilb = VALUES.nextSetBit(ilb - OFFSET) + OFFSET;
       LB.set(ilb);
       e = EventType.INCLOW;
       down = true;
     }
     if (eub < iub) {
       if (eub < ilb) {
         this.contradiction(this, MSG_LOW);
       }
       VALUES.clear(eub - OFFSET + 1, iub - OFFSET + 1);
       iub = VALUES.prevSetBit(iub - OFFSET + 1) + OFFSET;
       UB.set(iub);
       if (e != EventType.VOID) {
         e = EventType.BOUND;
       } else {
         e = EventType.DECUPP;
       }
       up = true;
     }
     int size = VALUES.cardinality();
     SIZE.set(size);
     if (ilb > iub) {
       this.contradiction(this, MSG_EMPTY);
     }
     if (down || size == 1) {
       filterOnGeq(this, ilb);
     }
     if (up || size == 1) { // size == 1 means instantiation, then force filtering algo
       filterOnLeq(this, iub);
     }
     if (ilb == iub) { // size == 1 means instantiation, then force filtering algo
       if (old_size > 0) {
         notifyPropagators(EventType.INSTANTIATE, this);
       }
     } else {
       notifyPropagators(e, this);
     }
   }
 }
Ejemplo n.º 3
0
  @Override
  public void backPropagate(int mask) throws ContradictionException {
    // one of the variable as changed externally, this involves a complete update of this
    // one of the variable as changed externally, this involves a complete update of this
    if (!EventType.isRemove(mask)) {
      int lA = A.getLB(), uA = A.getUB();
      int lB = B.getLB(), uB = B.getUB();

      int elb = Math.max(lA, lB);
      int eub = Math.max(uA, uB);

      int ilb = LB.get();
      int iub = UB.get();
      boolean change = false;
      EventType e = EventType.VOID;
      if (elb > ilb) {
        if (elb > iub) {
          this.contradiction(this, MSG_LOW);
        }
        SIZE.add(elb - ilb);
        ilb = elb;
        LB.set(ilb);
        e = EventType.INCLOW;
        change = true;
      }
      if (eub < iub) {
        if (eub < ilb) {
          this.contradiction(this, MSG_LOW);
        }
        SIZE.add(eub - iub);
        iub = eub;
        UB.set(iub);
        if (e != EventType.VOID) {
          e = EventType.BOUND;
        } else {
          e = EventType.DECUPP;
        }
        change |= true;
      }
      if (ilb > iub) {
        this.contradiction(this, MSG_EMPTY);
      }
      if (change) {
        if (ilb == iub) {
          notifyPropagators(EventType.INSTANTIATE, this);
        } else {
          notifyPropagators(e, this);
        }
      }
    }
  }
Ejemplo n.º 4
0
 @Override
 public int getPropagationConditions(int vIdx) {
   return EventType.REMOVEARC.mask + EventType.ENFORCEARC.mask + EventType.INT_ALL_MASK();
 }
Ejemplo n.º 5
0
 @Override
 public int getPropagationConditions(int vIdx) {
   return EventType.INT_ALL_MASK();
 }
Ejemplo n.º 6
0
 /**
  * Awakening conditions (any variable domain modification)
  *
  * @param vIdx variable which has changed
  * @return a mask of modifications (int_all_mask)
  */
 protected int getPropagationConditions(int vIdx) {
   return EventType.INT_ALL_MASK();
 }