Пример #1
0
  ExecStatus
  EqInt<VY>::propagate(Space& home, const ModEventDelta& med) {
    // Add assigned views to value set
    if (IntView::me(med) == ME_INT_VAL)
      add(home);

    GECODE_ME_CHECK(y.gq(home, vs.size()));
    GECODE_ME_CHECK(y.lq(home, x.size() + vs.size()));

    if (x.size() == 0) 
      return home.ES_SUBSUMED(*this);

    // All values must be in the value set
    if (y.max() == vs.size())
      return all_in_valset(home);

    // Compute positions of disjoint views and eliminate subsumed views
    Region r(home);
    int* dis; int n_dis;
    disjoint(home,r,dis,n_dis);

    // The number might have changed due to elimination of subsumed views
    GECODE_ME_CHECK(y.lq(home, x.size() + vs.size()));

    if (x.size() == 0) {
      assert(y.val() == vs.size());
      return home.ES_SUBSUMED(*this);
    }

    GECODE_ES_CHECK(prune_upper(home,g));

    // No lower bound pruning possible
    if (n_dis == 0)
      return ES_NOFIX;

    // Only if the propagator is at fixpoint here, continue with
    // propagating the lower bound
    if (IntView::me(Propagator::modeventdelta()) != ME_INT_NONE)
      return ES_NOFIX;

    // Do lower bound-based pruning
    GECODE_ES_CHECK(prune_lower(home,dis,n_dis));

    return ES_NOFIX;
  }
Пример #2
0
  ExecStatus
  GqInt<VY>::propagate(Space& home, const ModEventDelta& med) {
    if (IntView::me(med) == ME_INT_VAL)
      add(home);

    // Eliminate subsumed views
    eliminate(home);

    GECODE_ME_CHECK(y.lq(home, x.size() + vs.size()));

    if (x.size() == 0)
      return home.ES_SUBSUMED(*this);

    if (vs.size() >= y.max())
      return home.ES_SUBSUMED(*this);
      
    GECODE_ES_CHECK(prune_upper(home,g));

    return ES_NOFIX;
  }