Post constraint on \a xwyho
| 239 | } |
| 240 | /// Post constraint on \a xwyho |
| 241 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& xwyho) { |
| 242 | using namespace Gecode; |
| 243 | int n = (xwyho.size() - 2) / 2; |
| 244 | IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); |
| 245 | BoolVarArgs o(n); |
| 246 | for (int i=0; i<n; i++) { |
| 247 | x0[i]=xwyho[2*i+0]; w[i]=xwyho[2*i+1]; |
| 248 | x1[i]=expr(home, x0[i] + w[i]); |
| 249 | y0[i]=xwyho[2*i+0]; h[i]=xwyho[2*i+1]; |
| 250 | y1[i]=expr(home, y0[i] + h[i]); |
| 251 | o[i]=expr(home, xwyho[2*n + (i % 2)] > 0); |
| 252 | } |
| 253 | nooverlap(home, x0, w, x1, y0, h, y1, o); |
| 254 | } |
| 255 | }; |
| 256 | |
| 257 |