ComputeIIS and how to use it to troubleshoot
AnsweredHello, community,
Please check the following output from the ComputeIIS. From these results, I see that one of these constraints may be causing infeasibility in my model. But I already know for a fact that x[386,135,t2] = 0 and x[386,135,t1] = 0, and then there is easily a solution that satisfies the constraints in IIS (and the model). Could you please suggest me how to proceed?
\ Model model
\ LP format - for model browsing. Use MPS format to capture full model detail.
Minimize
Subject To
R96756: x[386,135,t2] + x[386,135,t1] = 0
R211707: x[46,135,t1] + x[386,135,t1] = 1
R349517: 31.77121433465604 x[46,135,t1] + en[46,135] = 0
Bounds
Binaries
x[46,135,t1] x[386,135,t2] x[386,135,t1]
End
-
Hi Charitha,
it seems to me that you need to redefine your continuous variable to allow it to assume negative values. The default lower bound for continuous variables in Gurobi is 0.
Try the following:
en[46,135] = model.addVar(lb=-GRB.INFINITY, ub=GRB.INFINITY, name="en[46,135]")
and the IIS you showed will not be infeasible any more.
I would also recommend two things:
- If you know some (binary) variables are fixed beforehand, try to reformulate your problem in such a way that they are no longer required. This can usually be done fast and saves model generation time. From my own experience, I can add that it can save a lot of trouble later on (like the ones you are seeing).
- The trick I showed you will only work for this single IIS. Chances are that if you re-run the optimization process with only the two bounds added, your model would still be infeasible and a very similar IIS would be generated, this time with different variables and constraints. You need to "generalize" the "bound-fixing" trick to cover all of the situations in which such infeasibilities could arise.
Hope this helps.
Best regards
Jonasz0 -
Dear Jonas,
Thank you for the reply. x[386,135,t2] = 0 and x[386,135,t1] = 0 because they are coming from a partial solution. So Gurobi also knows it.
You are right. en[46,135] is continuous.
Buddi
0 -
You need to change the lower bound of your continuous variable. Have a look at my first answer - I modified it accordingly.
Best regards
Jonasz0 -
OK, I will try that. When a continuous variable is defined, I thought (-inf, _nf) bounds are implied. I missed that the default lower bound is 0
Thank you very much.
0
Please sign in to leave a comment.
Comments
4 comments