Originally posted by: PhilippeLaborie
It seems to me that your model almost does everything except for the allocation of the task to one of the two "resources".
I suppose that in your model, the duration of the interval variables on the resources is 2n, right?
I would just consider an additional interval variable 'task' of length 2n that represents the task and have an alternative on two optional tasks 'taskEven' and 'taskOdd'. These two intervals are the ones you already have in your model (with the adequate forbidStart constraints, and with a contribution to the adequate resource).
Note that instead of a cumul function you could use a noOverlap for the resources as they have a unit capacity, this may be useful if you have additional constraints on the sequencing of the tasks on these even/odd sequences.
Note also that instead of forbidStart, you could use something like: startOf(x,0)%2 == 0 (for the even tasks) and startOf(x,1)%2 == 1 for the odd tasks).
#DecisionOptimization#OPLusingCPOptimizer