FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Irreducible Infeasible Sets

Description
Shows how to analyze an infeasible problem by retrieving an irreducible infeasible subset

Further explanation of this example: 'Xpress Python Reference Manual'

Infeasible_python.zip[download all files]

Source Files





example_infeasible.py

#!/bin/env python

from __future__ import print_function

import xpress as xp

minf = xp.problem("ex-infeas")

x0 = xp.var()
x1 = xp.var()
x2 = xp.var(vartype=xp.binary)

minf.addVariable(x0, x1, x2)

c1 = x0 + 2 * x1 >= 1
c2 = 2 * x0 + x1 >= 1
c3 = x0 + x1 <= .5

minf.addConstraint(c1, c2, c3)
minf.solve()
minf.iisall()
print("there are ", minf.attributes.numiis, " iis's")

miisrow = []
miiscol = []
constrainttype = []
colbndtype = []
duals = []
rdcs = []
isolationrows = []
isolationcols = []

# get data for the first IIS

minf.getiisdata(1, miisrow, miiscol, constrainttype, colbndtype,
                duals, rdcs, isolationrows, isolationcols)

print("iis data:", miisrow, miiscol, constrainttype, colbndtype,
      duals, rdcs, isolationrows, isolationcols)

# Another way to check IIS isolations
print("iis isolations:", minf.iisisolations(1))

rowsizes = []
colsizes = []
suminfeas = []
numinfeas = []

print("iisstatus:", minf.iisstatus(rowsizes, colsizes, suminfeas, numinfeas))
print("vectors:", rowsizes, colsizes, suminfeas, numinfeas)

Back to examples browserPrevious exampleNext example