Example #1
0
  @Override
  public void consistency(Store store) {

    do {

      // domain consistency
      int xMin;
      if (Math.abs(p.min()) < (double) IntDomain.MaxInt)
        xMin = (int) (Math.round(Math.ceil(p.min())));
      else xMin = IntDomain.MinInt;

      int xMax;
      if (Math.abs(p.max()) < (double) IntDomain.MaxInt)
        xMax = (int) (Math.round(Math.floor(p.max())));
      else xMax = IntDomain.MaxInt;

      if (xMin > xMax) {
        int t = xMax;
        xMax = xMin;
        xMin = t;
      }

      x.domain.in(store.level, x, xMin, xMax);

      store.propagationHasOccurred = false;

      p.domain.in(store.level, p, x.min(), x.max());

    } while (store.propagationHasOccurred);
  }
Example #2
0
  @Override
  public void notConsistency(Store store) {

    do {

      store.propagationHasOccurred = false;

      if (r.singleton()) p.domain.inComplement(store.level, p, r.min() - c);

      if (p.singleton()) r.domain.inComplement(store.level, r, p.min() + c);

    } while (store.propagationHasOccurred);
  }
Example #3
0
  @Override
  public void consistency(Store store) {

    do {
      store.propagationHasOccurred = false;

      FloatIntervalDomain pDom = FloatDomain.subBounds(r.min(), r.max(), c, c);
      p.domain.in(store.level, p, pDom.min(), pDom.max());

      FloatIntervalDomain rDom = FloatDomain.addBounds(p.min(), p.max(), c, c);
      r.domain.in(store.level, r, rDom.min(), rDom.max());

    } while (store.propagationHasOccurred);
  }
Example #4
0
 @Override
 public boolean satisfied() {
   return x.singleton() && p.singleton() && x.min() <= p.max() && x.max() >= p.min();
 }