I build a MILP model by Pyomo and use Gurobi 9.0.3 as solver. When the model comes infeasible, I try to use pyomo.contrib.iis.iis.write_iis to compute infeasible constraints yet failed. The program says

gurobipy.GurobiError: Cannot compute IIS on a feasible model

Could somebody give suggestions about fixing it?


1 Answer 1


This model is likely on the borderline between feasibility and infeasibility. The algorithm used to determine feasibility in the solver is different than the algorithm used in IIS, and may reach a different conclusion on feasibility.

The most likely reason is poor numerics in the model. You should try to change the scaling (units) on the problem so that all non-zero coefficients (input data) are within a small number of orders of magnitude of one. The Gurobi solver output shows the coefficient ranges.

In addition to improving scaling, if needed, you can also set NumericFocus to a higher than default value (for instance, its maximum value of 3). You can also adjust FeasibilityTol and other parameters listed at https://www.gurobi.com/documentation/current/refman/making_the_algorithm_less_.html

Gurobi developer Tobias Achterberg wrote the following in a support forum post in reply to a similar question to yours:

Gurobi asserts that the model is infeasible but when coputing the IIS it says "Cannot compute IIS on a feasible model"

Your coefficient statistics shows a very big range in the matrix coefficients. Coefficients in the order of 1e-10 can lead to numerical issues in the linear system solves, which are caused by the finite precision floating point arithmetics of the CPU. This could cause the simplex algorithm to declare the model infeasible, while the IIS algorithm thinks that it is feasible.

You should try to reformulate your model so that those tiny coefficients in the constraint matrix are avoided. Maybe rescaling your columns may already suffice.

  • $\begingroup$ Thx for your help, I fix it with set NumericFocus=3 $\endgroup$
    – CangWangu
    Nov 6, 2023 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.