Skip to content

Highs not working #394

Closed
Closed
@andreaswiese

Description

@andreaswiese

Describe the bug

When I try to use the solver HiGHS in Python-MIP, I get the error message

FileNotFoundError: HiGHS not found.Please install the highspy package, orset the PMIP_HIGHS_LIBRARY environment variable.

To Reproduce

Small example:

from mip import *

p = [10, 13, 18, 31, 7, 15]
w = [11, 15, 20, 35, 10, 33]
c, I = 47, range(len(w))

m = Model("knapsack", sense=MAXIMIZE, solver_name="highs")

x = [m.add_var(var_type=BINARY) for i in I]

m.objective = maximize(xsum(p[i] * x[i] for i in I))

m += xsum(w[i] * x[i] for i in I) <= c

m.optimize()

Expected behavior
Python-MIP solves the MIP

Desktop (please complete the following information):

  • Operating System, version: Ubuntu 24.04.1 LTS
  • Python version: 3.12
  • Python-MIP version (we recommend you to test with the latest version): 1.6.0rc0

Workaround
I noticed that model.py executes the command

import mip.highs

Then, highs.py searches for a HiGHS library with the pattern

pattern = "highs_bindings.*.so"

In my folder /lib/python3.12/site-packages/highspy there is no library following this pattern and I believe that this causes this error. However, there is a library called "_core.cpython-312-x86_64-linux-gnu.so" and I believe that this is the library that highs.py is looking for. Therefore, I created a copy of this library called "highs_bindings._core.cpython-312-x86_64-linux-gnu.so" and then Python-MIP correctly solves the MIP with HiGHS.

Maybe highs.py just needs to search for a different file pattern when it searches for the HiGHS library.

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