coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
518 stars 92 forks source link

Status: "INT_INFEASIBLE" expected | Status: "INFEASIBLE" observed #188

Open sschnug opened 3 years ago

sschnug commented 3 years ago

Describe the bug According to the docs:

INT_INFEASIBLE = 4 A feasible solution exist for the relaxed linear program but not for the problem with existing integer variables

i would expect that after solving a problem which is LP-feasible and IP-infeasible:

Until now, i never saw INT_INFEASIBLE, but every time observe INFEASIBLE, even when the LP-relaxation is feasible.

To Reproduce Minimal example:

from mip import *

model = Model(sense=MINIMIZE, solver_name=CBC)
model.verbose = True

x = model.add_var(var_type=BINARY, obj=1.0)
model += 3 <= 10 * x
model += 10 * x <= 5

print('--------')
print('Solve IP')
status_ip = model.optimize()
print('  status: {}'.format(status_ip))

print('----------------')
print('Solve relaxed IP')
status_relaxed_ip = model.optimize(relax=True)
print('  status: {}'.format(status_relaxed_ip))

Output:

--------
Solve IP
Welcome to the CBC MILP Solver 
Version: devel 
Build Date: Nov 15 2020 

Starting solution of the Linear programming relaxation problem using Primal Simplex

Coin0506I Presolve 0 (-2) rows, 0 (-1) columns and 0 (-2) elements
Clp0000I Optimal - objective value 0.3
Coin0511I After Postsolve, objective 0.3, infeasibilities - dual 0 (0), primal 0 (0)
Clp0032I Optimal objective 0.3 - 0 iterations time 0.002, Presolve 0.00, Idiot 0.00

Starting MIP optimization
Cgl0000I Cut generators found to be infeasible! (or unbounded)
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00

  status: OptimizationStatus.INFEASIBLE
----------------
Solve relaxed IP
Clp0000I Optimal - objective value 0.3
  status: OptimizationStatus.OPTIMAL

Desktop (please complete the following information):