Gurobi can compute an Irreducible Inconsistent Subset (IIS) solely for infeasible models.
If you encounter this error, we recommend that you first check the Optimization Status attribute following the call to optimize. If the status is GRB.INF_OR_UNBD, you may not be able to compute an IIS because the model may be unbounded (and not infeasible). To understand how to confirm if the model is infeasible and not unbounded, please see How do I resolve the error "Model is infeasible or unbounded"?
If the Optimization Status is GRB.INFEASIBLE following the call to optimize, and you receive the error "Cannot compute IIS on a feasible model" while computing an IIS, then your model very likely has numerical issues.
In particular, this error typically arises in models that are at the boundary between feasibility and infeasibility. Such models can be both feasible and infeasible -- within numeric tolerances. So, while Gurobi declared the model as infeasible in the original optimization, the computeIIS() method likely took a different solution path and cannot compute an IIS. Generally, for such models, relaxing the feasibility tolerances will give a feasible solution and tightening them will give an IIS.
- Try enforcing smaller tolerances to let Gurobi give a more accurate conclusion.
- Try setting the NumericFocus parameter to a larger value.
- Try disabling Presolve.
- Try using different values of the IISMethod parameter when computing the IIS.
Please note that for numerically unstable models, while different parameter settings may help fix the unexpected behavior, we strongly recommend that you reformulate (or maybe rescale) your model to address the numerical issues. Please refer to our Guideline for Numerical Issues for suggestions on how to best modify your model.
Additionally, Gurobi's open-source package "Gurobi Model Analyzer" can provide insights into ill-conditioned basis matrices for your model.
- How do I determine why my model is infeasible?
- How do I use 'compute IIS' to find a subset of constraints that are causing model infeasibility?
- How do I change variable and/or constraint bounds to make an infeasible model feasible using feasRelax?
- Why does Gurobi report my model is infeasible when it has a feasible solution?