How to get the cause of infeasibility shown on the log file and save it
AnsweredHi,
I have been using the python API of gurobi. My model is returning infeasible which I can see the message on my python console but it does not tell me what is causing the infeasibility. I was wondering how to get the cause of infeasibility printed in the log file.
I have set the log file to be saved as an info.log in the following code snippet but my info.log file comes out to be totally empty which is unlike the output I am getting on my python console.
logging.basicConfig(filename="info.log")
#DSR.LogFile=1
DSR.optimize()
Can anyone please guide me how to get the log file saved properly with the cause of infeasibility printed in it?
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Try setting the logging level to \( \texttt{INFO} \):
logging.basicConfig(filename='info.log', level=logging.INFO)
Note that identifying the source of infeasibility can be a complex issue. One common approach to determining which constraints contribute to the infeasibility is to compute an irreducible inconsistent subsystem (IIS). An IIS is a subset of your model's constraints and variable bounds that together form an infeasible subsystem, but removing any one of the constraints or bounds from the subsystem makes it feasible. You can compute an IIS with Model.computeIIS(), then save the result to an ILP file with Model.write() for visual inspection:
DSR.computeIIS()
DSR.write('dsr.ilp')Another approach is to construct a so-called "feasibility relaxation" of the model. The goal of a feasibility relaxation is to compute the minimal change(s) you need to make to the model's right-hand sides and variable bounds in order to recover feasibility. You can construct a feasibility relaxation with Model.feasRelax() or Model.feasRelaxS().
For more details, I recommend the article How do I determine why my model is infeasible?.
0
Post is closed for comments.
Comments
2 comments