Originally posted by: Paul Shaw
When you write something like:
resources=cp.sum(resources, cp.stepAtStart(sourceDepot, 10)); //Vehicle starts with full supply
a new cumul function is created which is the sum of two children. This new cumul function does not
have a name until you name it with setName. If you write the following
//Resource consumption
IloCumulFunctionExpr resources=cp.cumulFunctionExpr("resourceConsumption");
IloCumulFunctionExpr total=cp.sum(resources, cp.stepAtStart(sourceDepot, 10)); //Vehicle starts with full supply
total=cp.diff(total, cp.stepAtStart(job1, 4)); //Job1 needs 4 supply
total=cp.diff(total, cp.stepAtStart(job2, 5)); //Job2 needs 5 supply
total=cp.diff(total, cp.stepAtStart(job3, 8)); //Job3 needs 8 supply
total=cp.sum(total, cp.stepAtStart(resupply, 0, 10)); //Resupply up to max vehicle capacity
total.setName("total");
then the variable total will have the name "total" while the variable "resources" will have the name "resourceConsumption".
#CPOptimizer#DecisionOptimization