coin-or / pulp

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

Fix error in HiGHS interface for infeasible/unbounded solutions #732

Closed tmaarse closed 7 months ago

tmaarse commented 7 months ago

Currently the following problem:

from pulp import *

problem = LpProblem("infeasible", LpMaximize)

# Infeasible problem
x = LpVariable("x", 0, 1)
y = LpVariable("y", 0, 1)
problem += x <= -1

solver = HiGHS_CMD(timeLimit=1, msg=1)

problem.solve(solver)

results in an error pulp.apis.core.PulpSolverError: Cannot read HiGHS solver output (line 253 of highs_api.py).

This error appeared after b0856c2c2ae9e1c4e2d3df5f0637363129743896, which sets the solution status for infeasible/unbounded problems. This PR fixes the attempt to read the solution in those cases.