Post constraint on \a x
| 235 | } |
| 236 | /// Post constraint on \a x |
| 237 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) { |
| 238 | int nn=(c >= 0) ? x.size() : x.size()-1; |
| 239 | int n=nn / 2; |
| 240 | Gecode::IntVarArgs s(n); |
| 241 | Gecode::BoolVarArgs m(n); |
| 242 | |
| 243 | for (int i=0; i<n; i++) { |
| 244 | s[i]=(c >= 0) ? x[i] : Gecode::expr(home,x[i]+o,Gecode::IPL_DOM); |
| 245 | m[i]=Gecode::expr(home, x[n+i] > l); |
| 246 | } |
| 247 | |
| 248 | if (c >= 0) { |
| 249 | Gecode::cumulative(home, c, s, p, u, m, ipl); |
| 250 | } else { |
| 251 | Gecode::rel(home, x[nn] <= -c); |
| 252 | Gecode::cumulative(home, x[nn], s, p, u, m, ipl); |
| 253 | } |
| 254 | } |
| 255 | }; |
| 256 | |
| 257 | /// Test for cumulative constraint with flexible mandatory tasks |
nothing calls this directly
no test coverage detected