inline ExecStatus
  LqInt<VY>::post(Home home, ViewArray<IntView>& x, VY y) {
    if (x.size() == 0) {
      GECODE_ME_CHECK(y.eq(home,0));
      return ES_OK;
    }

    x.unique(home);

    GECODE_ME_CHECK(y.gq(home,1));

    if (x.size() == 1)
      return ES_OK;

    if (y.max() == 1) {
      assert(y.assigned());
      return Rel::NaryEqDom<IntView>::post(home,x);
    }

    if (y.min() >= x.size())
      return ES_OK;
    
    // Eliminate assigned views and store them into the value set
    ValSet vs;
    int n = x.size();
    for (int i=n; i--; )
      if (x[i].assigned()) {
        vs.add(home, x[i].val());
        x[i] = x[--n];
      }

    GECODE_ME_CHECK(y.gq(home,vs.size()));

    if (n == 0) {
      assert(y.min() >= vs.size());
      return ES_OK;
    }

    x.size(n);

    (void) new (home) LqInt<VY>(home, vs, x, y);
    return ES_OK;
  }
Example #2
0
 forceinline void
 cancel(Space& home, Propagator& p, VY y) {
   y.cancel(home, p, PC_INT_DOM);
 }
Example #3
0
 forceinline void
 subscribe(Space& home, Propagator& p, VY y) {
   y.subscribe(home, p, PC_INT_DOM);
 }