coin-or / pulp

A python Linear Programming API
http://coin-or.github.io/pulp/
Other
2.04k stars 381 forks source link

Inconsistent `LpStatus` with `HiGHS` #661

Closed ManuelNavarroGarcia closed 7 months ago

ManuelNavarroGarcia commented 1 year ago

Details for the issue

What did you do?

I was very interested in using HiGHS solver under PuLP, and downloaded the latest GitHub version https://github.com/coin-or/pulp/commit/a7684ac90d93dc3bca382d90841a9ab5f398b50f. I ran a small feasible problem with HiGHS like this:

import pulp 
from pulp.apis.highs_api import HiGHS
prob = pulp.LpProblem("problem", pulp.LpMaximize)
...
prob.solve(HiGHS)

What did you expect to see?

As the problem is known to be feasible, I would expect that prob.status = 1 since

pulp.LpStatus
{0: 'Not Solved', 1: 'Optimal', -1: 'Infeasible', -2: 'Unbounded', -3: 'Undefined'}

What did you see instead?

What I obtained is that prob.status is 0, which is inconsistent with the pulp.LpStatus mapping. As set out in linprog, HiGHS has a different way to represent the exit status of the algorithm:

0 : Optimization terminated successfully.
1 : Iteration or time limit reached.
2 : Problem appears to be infeasible.
3 : Problem appears to be unbounded.
4 : The HiGHS solver ran into a problem.

The mapping with this solver must be aligned with the general pulp.LpStatus.

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

I'm using python version:

I installed PuLP via:

Did you also