Originally posted by: PhilippeLaborie
The expression overlapLength(task1,task2) returns the length of the intersection between task1 and task2 when intervals task1 and task2 are both present. So I suppose that this is the definition that you expect.
> The second Task can also be shorter than the overlapLength.
This is clearly impossible, indeed. Can you show an instance of overlapLength, with the values of the two intervals and the value returned by the overlapLength expression?
There is something that could be clarified in your formulation:
auto overlap = IloOverlapLength(env, pilotTasks[i], pilotTasks[j]);
IloNumExprArg overlapValue = totalInference * overlap;
First, I don't think you should use IloNumExprArg at all. This type is not supposed to be used in the formulations. See: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.cpo.help/CP_Optimizer/User_manual/topics/model_vars_expr.html : Note that the parent classes IloIntExprArg and IloNumExprArg are used internally by Concert Technology to build expressions. You should not use IloIntExprArg or IloNumExprArg directly.
And also instead of auto I would explicitly use the integer expression class. So:
IloIntExpr overlap = IloOverlapLength(env, pilotTasks[i], pilotTasks[j]);
IloNumExpr overlapValue = totalInference * overlap;
I'm not sure this is related with the problem but in any case it will be clearer.
Also if I remember well, we had a bug in overlapLength expression but it was fixed several versions ago. Which version of CP Optimizer are you using?
If you are using a recent version (12.8 or 12.9) and still have the problem, could you try to generate a .cpo file of your model that illustrates the problem (ideally, as small as possible) ?
#CPOptimizer#DecisionOptimization