Changing `Model.sense` makes (feasible) relaxation infeasible
See original GitHub issueI am trying to determine whether the feasibility region of an MIP-relaxation is bounded or not. To do that, I pick a random objective and both minimize and maximize it, checking whether one of the problems is unbounded. Unfortunately, python-mip tells me during minimization that an optimal solution has been found, during maximization it tells me that the problem is infeasible. I’m not sure why that would be the case. Is this a bug or is this somehow expected behavior?
To reproduce
I can reproduce this problem with instances from MIPLIB, e.g. dano3mip:
# `model` is an MIP from MIPLIB, with the original objective etc.
status_min = model.optimize(relax=True) # OptimizationStatus.OPTIMAL
model.sense = mip.MAXIMIZE
status_max = model.optimize(relax=True) # OptimizationStatus.INFEASIBLE
I am happy to provide a complete minimal working example if that should be necessary.
System info
I am running:
- Ubuntu 20.04.4 LTS
- python 3.8.10
- python-mip 1.13.0
Issue Analytics
- State:
- Created a year ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Infeasibility, Unboundedness and Instability - FICO
Discrete or integer infeasibility is where a MIP problem has a feasible relaxation (a relaxation of a MIP is the problem we get...
Read more >14.2 Automatic Repair of Infeasible Problems - Mosek
MOSEK provides an automatic repair tool for infeasible linear problems which we cover in this section. Note that most infeasible models are so...
Read more >Identifying infeasibility constraint and relaxing/removing it in ...
If the linear relaxation is feasible, then deactivate each constraint once. Frequently you find some obvious constraints being infeasible, such ...
Read more >Constraint Relaxation - Gurobi Support Portal
If the model turns out infeasible then I want Gurobi to change the RHS of Con1 for feasibility. However RHS of Con2 can't...
Read more >Gurobi finishes with 'infeasible' although optimal solution exists
I tried enforcing these values by adding them as additional equality constraints, but this still leaves the model infeasible without relaxation ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know the answer to this, because it has bitten me before. This is the problem: https://github.com/coin-or/python-mip/blob/08b3ad46259406b45fa1845dfa89ea1557a4fdd0/mip/cbc.py#L1251-L1252 For LPs
isProvenInfeasible
can mean dual infeasible.Here’s what we do in Cbc.jl: https://github.com/jump-dev/Cbc.jl/blob/3db1f16751a18d4f200b15bfd6116925fbdfddb0/src/MOI_wrapper/MOI_wrapper.jl#L644-L650
I don’t know whether the maximization problem is actually unbounded, that’s what I want to find out (it might also be optimal, which occurs for some MIPLIB instances). But maximization being infeasible while minimization is optimal makes no sense.