| 130 | |
| 131 | template<class View> |
| 132 | ExecStatus |
| 133 | Prop<View>::propagate(Space& home, const ModEventDelta& med) { |
| 134 | // Add assigned views to value set |
| 135 | if (View::me(med) == ME_INT_VAL) |
| 136 | add(home,vs,x); |
| 137 | |
| 138 | // Eliminate views from x |
| 139 | eliminate(home); |
| 140 | |
| 141 | if (x.size() == 0) { |
| 142 | // y must have values in the value set |
| 143 | ValSet::Ranges vsr(vs); |
| 144 | GECODE_ME_CHECK(y.inter_r(home,vsr,false)); |
| 145 | return home.ES_SUBSUMED(*this); |
| 146 | } |
| 147 | |
| 148 | // Constrain y to union of x and value set |
| 149 | Region r; |
| 150 | |
| 151 | assert(x.size() > 0); |
| 152 | ValSet::Ranges vsr(vs); |
| 153 | ViewRanges<View> xsr(x[0]); |
| 154 | Iter::Ranges::NaryUnion u(r,vsr,xsr); |
| 155 | for (int i=1; i<x.size(); i++) { |
| 156 | ViewRanges<View> xir(x[i]); |
| 157 | u |= xir; |
| 158 | } |
| 159 | |
| 160 | GECODE_ME_CHECK(y.inter_r(home,u,false)); |
| 161 | |
| 162 | // Check whether all values in y are already in the value set |
| 163 | if (vs.subset(y)) |
| 164 | return home.ES_SUBSUMED(*this); |
| 165 | |
| 166 | return ES_FIX; |
| 167 | } |
| 168 | |
| 169 | }}} |
| 170 | |