Example #1
0
 inline ModEvent
 SetVarImp::excludeI(Space& home, I& iterator) {
   if (!iterator())
     return ME_SET_NONE;
   if (assigned()) {
     BndSetRanges ubi(lub);
     Iter::Ranges::Inter<BndSetRanges,I> probe(ubi,iterator);
     return probe() ? ME_SET_FAILED : ME_SET_NONE;
   }
   int mi=iterator.min();
   int ma=iterator.max();
   ++iterator;
   if (iterator())
     return excludeI_full(home, mi, ma, iterator);
   else
     return exclude(home, mi, ma);
 }
Example #2
0
  ExecStatus
  Eq<View0,View1>::propagate(Space& home, const ModEventDelta& med) {

    ModEvent me0 = View0::me(med);
    ModEvent me1 = View1::me(med);

    Region r(home);

    if (testSetEventLB(me0,me1)) {
      GlbRanges<View0> x0lb(x0);
      GlbRanges<View1> x1lb(x1);
      Iter::Ranges::Union<GlbRanges<View0>,GlbRanges<View1> > lbu(x0lb,x1lb);
      Iter::Ranges::Cache<Iter::Ranges::Union
        <GlbRanges<View0>, GlbRanges<View1> > > lbuc(r,lbu);
      GECODE_ME_CHECK(x0.includeI(home,lbuc));
      lbuc.reset();
      GECODE_ME_CHECK(x1.includeI(home,lbuc));
    }

    if (testSetEventUB(me0,me1)) {
      LubRanges<View0> x0ub(x0);
      LubRanges<View1> x1ub(x1);
      Iter::Ranges::Inter<LubRanges<View0>,LubRanges<View1> > ubi(x0ub,x1ub);
      Iter::Ranges::Cache<Iter::Ranges::Inter
        <LubRanges<View0>,LubRanges<View1> > > ubic(r,ubi);
      GECODE_ME_CHECK(x0.intersectI(home,ubic));
      ubic.reset();
      GECODE_ME_CHECK(x1.intersectI(home,ubic));
    }

    if (testSetEventCard(me0,me1) ) {
      unsigned int max = std::min(x0.cardMax(),x1.cardMax());
      unsigned int min = std::max(x0.cardMin(),x1.cardMin());
      GECODE_ME_CHECK ( x0.cardMax(home,max) );
      GECODE_ME_CHECK ( x1.cardMax(home,max) );
      GECODE_ME_CHECK ( x0.cardMin(home,min) );
      GECODE_ME_CHECK ( x1.cardMin(home,min) );
    }

    if (x0.assigned()) {
      assert (x1.assigned());
      return home.ES_SUBSUMED(*this);
    }
    return shared(x0,x1) ? ES_NOFIX : ES_FIX;
  }