Do not overload machines
| 295 | } |
| 296 | /// Do not overload machines |
| 297 | void nooverload(void) { |
| 298 | // Number of jobs and machines/steps |
| 299 | int n = spec.jobs(), m = spec.machines(); |
| 300 | |
| 301 | IntVarArgs jobs(m*n); |
| 302 | IntArgs dur(m*n); |
| 303 | |
| 304 | for (int i=0; i<n; i++) |
| 305 | for (int j=0; j<m; j++) { |
| 306 | jobs[spec.machine(i,j)*n+i] = start[i*m+j]; |
| 307 | dur[spec.machine(i,j)*n+i] = spec.duration(i,j); |
| 308 | } |
| 309 | |
| 310 | for (int j=0; j<m; j++) { |
| 311 | IntVarArgs jpm(n); |
| 312 | IntArgs dpm(n); |
| 313 | for (int i=0; i<n; i++) { |
| 314 | jpm[i] = jobs[j*n+i]; dpm[i] = dur[j*n+i]; |
| 315 | } |
| 316 | unary(*this, jpm, dpm); |
| 317 | } |
| 318 | } |
| 319 | /// Return cost |
| 320 | virtual IntVar cost(void) const { |
| 321 | return makespan; |