pulp
pulp copied to clipboard
Incorrect Infeasible Problem Status with GUROBI_CMD
Details for the issue
What did you do?
Solved a toy infeasible problem using the pulp.GUROBI_CMD solver:
import pulp
prob = pulp.LpProblem()
x = pulp.LpVariable("x", upBound=10, lowBound=0, cat="Integer")
prob += x
prob += x >= 11, 'constraint' # This renders the problem infeasible
prob.solve(solver=pulp.GUROBI_CMD())
print(pulp.LpStatus[prob.status])
PuLP Output: Not Solved
Gurobi Output:
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (linux64)
Copyright (c) 2021, Gurobi Optimization, LLC
Read LP format model from file /tmp/66eb5c2c452b4a9490569b9b0cf665ce-pulp.lp
Reading time = 0.00 seconds
OBJ: 1 rows, 1 columns, 1 nonzeros
Thread count: 32 physical cores, 64 logical processors, using up to 32 threads
Optimize a model with 1 rows, 1 columns and 1 nonzeros
Model fingerprint: 0x7d00dcfe
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [1e+01, 1e+01]
RHS range [1e+01, 1e+01]
Presolve time: 0.00s
Solved in 0 iterations and 0.00 seconds
Infeasible model
Unable to retrieve attribute 'X'
0
What did you expect to see?
I expected to see PuLP output Infeasible (prob.status value of -1)
What did you see instead?
The PuLP output was Not Solved (prob.status value of 0)
Other Notes
I am running code that differentiates between whether PuLP problems were infeasible or whether they timed out. Since GUROBI_CMD outputs Not Solved for both of these cases, it's confusing to try to distinguish whether a problem timed out or was infeasible.
If I solve the exact same problem using the pulp.GUROBI solver, the PuLP output is Infeasible (prob.status value of -1):
import pulp
prob = pulp.LpProblem()
x = pulp.LpVariable("x", upBound=10, lowBound=0, cat="Integer")
prob += x
prob += x >= 11, 'constraint' # This renders the problem infeasible
prob.solve(solver=pulp.GUROBI())
print(pulp.LpStatus[prob.status])
PuLP Output: Infeasible
Gurobi Output:
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (linux64)
Thread count: 32 physical cores, 64 logical processors, using up to 32 threads
Optimize a model with 1 rows, 1 columns and 1 nonzeros
Model fingerprint: 0xfd01d504
Variable types: 0 continuous, 1 integer (0 binary)
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [1e+00, 1e+00]
Bounds range [1e+01, 1e+01]
RHS range [1e+01, 1e+01]
Presolve time: 0.00s
Explored 0 nodes (0 simplex iterations) in 0.00 seconds
Thread count was 1 (of 64 available processors)
Solution count 0
Model is infeasible
Best objective -, best bound -, gap -
Gurobi status= 3
-1
Useful extra information
The info below often helps, please fill it out if you're able to. :)
What operating system are you using?
- [ ] Windows: ( version: ___ )
- [x] Linux: ( distro: Ubuntu 18.04)
- [ ] Mac OS: ( version: ___ )
- [ ] Other: ___
I'm using python version:
- [ ] 2.7
- [ ] 3.4
- [ ] 3.5
- [ ] 3.6
- [x] Other: 3.8
I installed PuLP via:
- [ ] pypi (python -m pip install pulp)
- [ ] github (python -m pip install -U git+https://github.com/coin-or/pulp)
- [x] Other: pip inside conda environment
- Output of
pip show pulp:
- Output of
Name: PuLP
Version: 2.4
Summary: PuLP is an LP modeler written in python. PuLP can generate MPS or LP files and call GLPK, COIN CLP/CBC, CPLEX, and GUROBI to solve linear problems.
Home-page: https://github.com/coin-or/pulp
Author: J.S. Roy and S.A. Mitchell
Author-email: [email protected]
License: UNKNOWN
Requires: amply
Required-by:
Did you also
- [x] Tried out the latest github version: https://github.com/coin-or/pulp
- Same problem when I clone the PuLP repo directly using pip, using Python 3.6.
- [x] Searched for an existing similar issue: https://github.com/coin-or/pulp/issues?utf8=%E2%9C%93&q=is%3Aissue%20
- The only existing similar issue is #141, which dealt with Gurobi v7.5.0. I'm using Gurobi 9.1.2.
After further searching, I found this related discussion: #382
I also think the gurobi command line outputs infeasible or unbounded so It was hard to tell if it was infeasible
(I could be wrong here)
Stuart Mitchell PhD Engineering Science Extraordinary Freelance Programmer and Optimisation Guru www.stuartmitchell.com
On Wed, Sep 22, 2021 at 6:12 AM jusevitch-mitll @.***> wrote:
After further searching, I found this related discussion: #382 https://github.com/coin-or/pulp/discussions/382
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/coin-or/pulp/issues/484#issuecomment-924237053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFUIWL2HBMZOSRSIIIPBUTUDDDKNANCNFSM5EO7P4OQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.