coin-or / pulp

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

Add back highspy test, with numpy included #683

Closed aphi closed 11 months ago

aphi commented 11 months ago

Right now we're not testing the highs api solver. It was removed from the test script because it was failing because Highspy depends on Numpy under the hood. (E.g. inside pybind11 within highs_bindings.cpp)

This PR adds it back, including numpy, which resolves the issue.

The HiGHS documentation recommends numpy as a likely dependency here: https://github.com/ERGO-Code/HiGHS/blob/master/docs/src/interfaces/python/index.md

pchtsp commented 11 months ago

Unfortunately it seems that the high solver keeps having some errors in Ubuntu... I will approve this PR as it's not the cause. But it would be nice to see a way to solve it.

pchtsp commented 11 months ago

Maybe @siwy knows about this since it was him who brought the changes with setLogCallback in https://github.com/coin-or/pulp/commit/6a8e4631fdc09575834b2017e339c74017a5ac07. It only fails in Ubuntu, not in mac:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pulp/tests/test_pulp.py", line 842, in test_msg_arg
    pulpTestCheck(
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pulp/tests/test_pulp.py", line 1556, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pulp/pulp.py", line 1920, in solve
    status = solver.actualSolve(self, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pulp/apis/highs_api.py", line 394, in actualSolve
    self.createAndConfigureSolver(lp)
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pulp/apis/highs_api.py", line 301, in createAndConfigureSolver
    lp.solverModel.setLogCallback(*callbackTuple)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Highs' object has no attribute 'setLogCallback'
siwy commented 11 months ago

@pchtsp - I think it's the same issue as in https://github.com/coin-or/pulp/pull/678. Highspy removed the setLogCallback API, but plan on adding it back: https://github.com/ERGO-Code/HiGHS/issues/1379