Hey everyone,
I'm currently developing a scheduling model with docplex.cp (Python) where I need to schedule multiple tasks in two machines.
I need to use an allDifferent constraint to ensure that the starting time of certain tasks are different from others, which means I'm using a constraint similar to this one:
for m in M:
mdl.add_constraint(all_diff([start_of(opttask[j,m]) for j in J]))
The problem is that the variable
opttask is optional. This means that in the case of two tasks being assigned to the same machine (e.g., opttask[1,1] and opttask[2,1]), the interval variables associated with those two tasks will not exist in the other machine (e.g., opttask[1,2] and opttask[2,2]). Due to this situation, the constraint above does not work because the results for start_of(opttask[1,2]) and start_of(opttask[2,2]) are the same.
Is there any way to create an exception for this kind of constraint when the interval variables don't exist? Let me know if I wasn't clear enough and I can try to explain better.
Thank you in advance,
Paulo
------------------------------
Paulo Nascimento
------------------------------
#DecisionOptimization