Good evening to everyone.
I am facing a rather peculiar situation which is as follows:
I have a MIP problem with several constraints (about five). All of them have the same type (with different parameters, though).
The form of these constraints is:
Let U denotes some integer variables (indices not included for simplicity reasons), where
- Lower <= U <= Upper (where -Lower and Upper depend on the variable U)
Let D be a binary variable.
I mast model the following:
D = 1 if U > 0 (i.e. 1 <= U <=Upper) and D = 0 otherwise (i.e. -Lower <= U <= 0). [Rel 1]
I have tested the following model:
[1] U <= Upper*D
[2] U + Lower >= (Lower + 1)*D
As it is easily verified these two constraints ensure the relation [Rel 1].
Now, I noticed that if I exclude the second form of constraints ([2]) from my model at all, an error occurs . To be more exact, D takes wrong value, when -Lower <= U <= 0.
At the other hand, if I include both [1] and [2], the solution is correct but the execution time is too much while the value of objective function is high. (but correct).
To make things even more complex, I noticed that when I exclude again the form [2] from all my constraints, but I keep it in only one of them, the model works perfectly. The execution is done fast and the objective value is almost optimal.
Now the question is: in order to model a condition like [Rel 1] are both [1] and [2] constraints necessary or [1] should be enough?
Thanks in advance for spending your time on my issue and for any answer.