Skip to content

Missing Status Code for HiGHS Solver Causes KeyError #895

@xxmissingnoxx

Description

@xxmissingnoxx

Details for the issue

What did you do?

HiGHS solver offers an option, mip_max_improving_cols, to terminate early based on the number of improving solutions observed thus far. I was able to use the option via pulp's solverParams argument:
model.solve(solver=pulp.HiGHS(mip_max_improving_sols = 1))

What did you expect to see?

I expected to see a feasible solution after the solver has executed.

What did you see instead?

Although the output available showed that the problem was feasible, after solving, I saw a key error as pulp did not recognize the status code produced by the highspy library:

        if obj_value == float(inf) and status in (
            HighsModelStatus.kTimeLimit,
            HighsModelStatus.kIterationLimit,
        ):
            return (
                constants.LpStatusNotSolved,
                constants.LpSolutionNoSolutionFound,
            )
        else:
>           return status_dict[status]
                   ^^^^^^^^^^^^^^^^^^^
E           KeyError: <HighsModelStatus.kSolutionLimit: 16>

.venv/lib/python3.13/site-packages/pulp/apis/highs_api.py:517: KeyError

I suspect this is because the latest version of PuLP does not include the highspy key. It looks as though PuLP covers many of the other status codes. I'm currently using highspy 1.12.

Thank you for your work on this project. Please let me know if additional information is needed.

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: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: ___

I'm using python version:

  • 3.7
  • 3.8
  • 3.9
  • 3.10
  • 3.11
  • [x ] Other: 3.13.5

I installed PuLP via:

Did you also

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions