Post constraint on \a x
| 233 | } |
| 234 | /// Post constraint on \a x |
| 235 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 236 | int n=x.size() / 3; |
| 237 | |
| 238 | Gecode::IntVarArgs s(n); |
| 239 | Gecode::IntVarArgs px(n); |
| 240 | Gecode::IntVarArgs e(home,n, |
| 241 | Gecode::Int::Limits::min, |
| 242 | Gecode::Int::Limits::max); |
| 243 | for (int i=n; i--;) { |
| 244 | s[i] = expr(home, off+x[i]); |
| 245 | px[i] = x[2*n+i]; |
| 246 | rel(home, s[i]+px[i] == e[i]); |
| 247 | rel(home, _minP <= px[i]); |
| 248 | rel(home, _maxP >= px[i]); |
| 249 | } |
| 250 | Gecode::BoolVarArgs m(n); |
| 251 | for (int i=0; i<n; i++) |
| 252 | m[i]=Gecode::expr(home, (x[n+i] > l)); |
| 253 | Gecode::unary(home, s, px, e, m, ipl); |
| 254 | } |
| 255 | }; |
| 256 | |
| 257 | /// Help class to create and register tests |