| 1330 | } |
| 1331 | |
| 1332 | void p_cumulatives(FlatZincSpace& s, const ConExpr& ce, |
| 1333 | AST::Node* ann) { |
| 1334 | if (ce.size() == 6) { |
| 1335 | // Full cumulatives call |
| 1336 | IntVarArgs start = s.arg2intvarargs(ce[0]); |
| 1337 | IntVarArgs duration = s.arg2intvarargs(ce[1]); |
| 1338 | IntVarArgs resources = s.arg2intvarargs(ce[2]); |
| 1339 | IntVarArgs machine = s.arg2intvarargs(ce[3]); |
| 1340 | IntArgs bound = s.arg2intargs(ce[4]); |
| 1341 | bool upper = ce[5]->getBool(); |
| 1342 | int n = start.size(); |
| 1343 | |
| 1344 | if (duration.assigned()) { |
| 1345 | IntArgs durationI(n); |
| 1346 | for (int i = n; (i--) != 0;) { |
| 1347 | durationI[i] = duration[i].val(); |
| 1348 | } |
| 1349 | IntVarArgs end(n); |
| 1350 | for (int i = n; (i--) != 0;) { |
| 1351 | end[i] = expr(s, start[i] + durationI[i]); |
| 1352 | } |
| 1353 | if (machine.assigned()) { |
| 1354 | IntArgs machineI(n); |
| 1355 | for (int i = n; (i--) != 0;) { |
| 1356 | machineI[i] = machine[i].val(); |
| 1357 | } |
| 1358 | if (resources.assigned()) { |
| 1359 | IntArgs resourcesI(n); |
| 1360 | for (int i = n; (i--) != 0;) { |
| 1361 | resourcesI[i] = resources[i].val(); |
| 1362 | } |
| 1363 | cumulatives(s, machineI, start, durationI, end, resourcesI, bound, upper, s.ann2ipl(ann)); |
| 1364 | } else { |
| 1365 | cumulatives(s, machineI, start, durationI, end, resources, bound, upper, s.ann2ipl(ann)); |
| 1366 | } |
| 1367 | } else if (resources.assigned()) { |
| 1368 | IntArgs resourcesI(n); |
| 1369 | for (int i = n; (i--) != 0;) { |
| 1370 | resourcesI[i] = resources[i].val(); |
| 1371 | } |
| 1372 | cumulatives(s, machine, start, durationI, end, resourcesI, bound, upper, s.ann2ipl(ann)); |
| 1373 | } else { |
| 1374 | cumulatives(s, machine, start, durationI, end, resources, bound, upper, s.ann2ipl(ann)); |
| 1375 | } |
| 1376 | } else { |
| 1377 | IntVarArgs end(n); |
| 1378 | for (int i = n; (i--) != 0;) { |
| 1379 | end[i] = expr(s, start[i] + duration[i]); |
| 1380 | } |
| 1381 | if (machine.assigned()) { |
| 1382 | IntArgs machineI(n); |
| 1383 | for (int i = n; (i--) != 0;) { |
| 1384 | machineI[i] = machine[i].val(); |
| 1385 | } |
| 1386 | if (resources.assigned()) { |
| 1387 | IntArgs resourcesI(n); |
| 1388 | for (int i = n; (i--) != 0;) { |
| 1389 | resourcesI[i] = resources[i].val(); |
nothing calls this directly
no test coverage detected