Post constraint on \a x
| 342 | } |
| 343 | /// Post constraint on \a x |
| 344 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 345 | int nn = (c >= 0) ? x.size() : x.size()-1; |
| 346 | int n = nn/2; |
| 347 | int pstart = (c >= 0) ? n : n+1; |
| 348 | Gecode::IntVarArgs s(n); |
| 349 | Gecode::IntVarArgs px(x.slice(pstart,1,n)); |
| 350 | Gecode::IntVarArgs e(home,n, |
| 351 | Gecode::Int::Limits::min, |
| 352 | Gecode::Int::Limits::max); |
| 353 | for (int i=s.size(); i--;) { |
| 354 | s[i] = expr(home, o+x[i], Gecode::IPL_DOM); |
| 355 | rel(home, s[i]+px[i] == e[i]); |
| 356 | rel(home, _minP <= px[i]); |
| 357 | rel(home, _maxP >= px[i]); |
| 358 | } |
| 359 | if (c >= 0) { |
| 360 | Gecode::cumulative(home, c, s, px, e, u, ipl); |
| 361 | } else { |
| 362 | rel(home, x[n] <= -c); |
| 363 | Gecode::cumulative(home, x[n], s, px, e, u, ipl); |
| 364 | } |
| 365 | } |
| 366 | }; |
| 367 | |
| 368 | /// Test for cumulative constraint with optional flexible tasks |
nothing calls this directly
no test coverage detected