Closed uuuutsu closed 10 months ago
Using "big M" formulations without tight upper bounds is in general a bad idea as it will lead to numerical issues sooner or later. Would recommend to use
#express abs(x - y)
abs_pos = model.add_var(lb=0)
abs_neg = model.add_var(lb=0)
# divide expression into positive and negative part
model += (x - y == abs_pos - abs_neg)
# only one part may be non zero
model.add_sos([abs_pos, abs_neg], 1)
# now abs(.) = abs_pos + abs_neg
model += (abs_pos + abs_neg >= 1)
Thanks a lot! It fixed everything and is very insightful. Happy New Year!
Describe the bug I'm encountering an issue with the Python-MIP library where incrementing a certain variable (
large_sufficient_ub
) causes the model to become infeasible. While new to Mixed-Integer Programming, I am unable to find a logical explanation for it.To Reproduce Here's a simplified version of the code to reproduce the issue:
Increasing
large_sufficient_ub
by one results inOptimizationStatus.INFEASIBLE
. This issue only arises when the objective functionmip.xsum([x, y])
is set. If this line is omitted, the model converges correctly regardless of thelarge_sufficient_ub
value.Expected behavior I expected the model to find an optimal solution with any reasonable value of
large_sufficient_ub
, regardless of the presence of the objective function.Desktop (please complete the following information):