Debugging infeasible models with an IIS#
When solve() returns status == "infeasible", the model has no solution — but
the full constraint list rarely tells you why: most constraints are innocent
bystanders. An Irreducible Infeasible Subsystem (IIS) is a minimal set of
constraints (and variable bounds) that is infeasible on its own, yet becomes
feasible if any single member is removed [Chinneck, 2008]. It is the
smallest self-contained explanation of the conflict — the analogue of Gurobi’s
computeIIS and CPLEX’s conflict refiner.
The algorithm: deletion filtering#
discopt computes an IIS by deletion filtering [Chinneck and Dravnieks, 1991]:
Confirm the full model is (provably) infeasible.
Tentatively drop one candidate (a constraint or a finite variable bound) and re-solve a feasibility problem.
If the remainder is still provably infeasible, the candidate is redundant to the conflict — drop it for good. If feasibility is restored, the candidate is essential — keep it.
What survives is an IIS.
Soundness with an incomplete solver. A candidate is removed only when the
reduced model is proven infeasible. A solve that is merely inconclusive (a
nonconvex MINLP that times out without a proof) is conservatively treated as
“keep the candidate”. The result is therefore always a genuine infeasible
subsystem; it is irreducible exactly when every probe was conclusive — always
the case for LP / MILP / convex models. IISResult.proven_irreducible reports
which guarantee you have.
import discopt.modeling as dm
Conflicts involving variable bounds#
Infeasibility is often driven by a bound, not a constraint. By default
compute_iis also treats finite variable bounds as removable members, so it can
surface a clash between a bound and a constraint. Here the lower bound x >= 5
fights the constraint x <= 2:
m2 = dm.Model('bound_conflict')
x2 = m2.continuous('x', lb=5, ub=10) # the lower bound is the culprit
z = m2.continuous('z', lb=-1, ub=1)
m2.subject_to(x2 <= 2, name='cap')
m2.subject_to(z >= -0.5, name='unrelated')
m2.minimize(x2)
iis2 = m2.compute_iis()
print(iis2.summary())
Irreducible Infeasible Subsystem (2 members):
Constraints:
- cap: (x - 2) <= 0
Variable bounds:
- x >= 5
The IIS reports both the constraint cap and the variable bound x >= 5,
while ignoring the unrelated variable z. Pass include_bounds=False to restrict
the IIS to explicit constraints only.
Integer-domain infeasibility#
Deletion filtering works for any class the solver can certify infeasible — including integrality. Requiring an integer strictly between 3 and 4 is infeasible, and the IIS isolates the two bracketing constraints:
m3 = dm.Model('integer_gap')
yv = m3.integer('y', lb=0, ub=10)
m3.subject_to(yv >= 3.2, name='lower')
m3.subject_to(yv <= 3.8, name='upper')
m3.minimize(yv)
print('status:', m3.solve().status)
print(m3.compute_iis(include_bounds=False).summary())
status: infeasible
Irreducible Infeasible Subsystem (2 members):
Constraints:
- lower: (3.2 - y) <= 0
- upper: (y - 3.8) <= 0
Integrality as a member of the IIS#
The example above removes only constraints and bounds; the integrality of y
is taken as given. On a linear model, include_integrality=True also treats
each integer element’s integrality as a removable member, so the IIS can say
that a conflict exists only because some variables are integer. Below,
2a + 2b = 7 has real solutions, but no integer ones: the left side is even
and the right side is odd. discopt proves this with a mod-2 (parity)
certificate rather than by enumerating integer points, and the IIS names the
row together with the two integrality restrictions, leaving out the two
satisfiable constraints.
total_time_limit bounds the whole computation; if it runs out, the result is
still a certified infeasible subsystem, just not necessarily a minimal one.
Which IIS deletion filtering finds depends on the order in which it visits
members, so portfolio= runs several orders in parallel processes and keeps
the smallest result. An order is a permutation of "ICB" (integrality,
constraints, bounds), optionally followed by -r to visit elements in reverse.
m4 = dm.Model('parity')
a = m4.integer('a', lb=0, ub=10)
b = m4.integer('b', lb=0, ub=10)
c = m4.continuous('c', lb=0, ub=10)
m4.subject_to(2 * a + 2 * b == 7, name='even_sum')
m4.subject_to(c <= 4, name='side_limit') # red herring
m4.subject_to(a + c >= 1, name='coupling') # red herring
m4.minimize(a + b + c)
print('solve status:', m4.solve().status)
iis4 = m4.compute_iis(include_integrality=True, total_time_limit=60,
portfolio=['ICB', 'CIB-r'])
print(iis4.summary())
print('proven irreducible:', iis4.proven_irreducible)
solve status: infeasible
Irreducible Infeasible Subsystem (3 members, certified 3/3):
Constraints:
- even_sum: (((2 * a) + (2 * b)) - 7) == 0
Integrality:
- a integer
- b integer
proven irreducible: True
Practical notes#
Cost. Deletion filtering performs up to one feasibility solve per candidate, so it scales with the number of constraints and finite bounds. Run it on demand (when a solve returns infeasible), not in the hot loop.
Reliability. Most precise on LP / MILP / convex models, where infeasibility is certifiable. On nonconvex MINLP a probe may time out without a proof;
compute_iisthen keeps the candidate and setsproven_irreducible = False, so the returned set stays a valid (if possibly non-minimal) infeasible subsystem [Chinneck, 2008].Not unique. A model can have several IISes;
compute_iisreturns one.
Summary#
Model.compute_iis() turns an opaque infeasible verdict into a short,
actionable list of the constraints and bounds that conflict — computed by sound
deletion filtering [Chinneck and Dravnieks, 1991] on discopt’s own solver, with an
explicit minimality guarantee.