I'm trying to solve a scheduling problem in Python using docplex.cp.
In my problem I have a constraint that states that if a given optional interval variable is present, then some other optional interval variable must be absent.
I have tried this:
mdl.add(
mdl.if_then(
mdl.presence_of(optional_interval_var1),
mdl.equal(mdl.presence_of(optional_interval_var2), 0)
)
)
But it doesn't seem to work. I find that this constraint isn't enforced in the solution provided by the solver.