mobook / MO-book

Hands-On Optimization with Python
MIT License
153 stars 40 forks source link

Add support for HiGHS solver #53

Closed leonlan closed 1 year ago

leonlan commented 1 year ago

HiGHS is a new open-source, high-performance solver for MILPs. It would be nice to add support for the HiGHS solver installation.

HiGHS has been recently added to PyPi, and there's now also an interface with Pyomo. I haven't tried it yet, but I think it could be as simple as pip install highspy and then selecting 'highs' in the solver interface.

jckantor commented 1 year ago

Completely agree, and this could take the place of cbc and glpk for the MILP and LP examples throughout the notebooks. I've started using HIGHS myself. By default it is a persistent solver, which we don't use enough in the examples.

The place for this fix is in helper.py. The issue I've been having is how to test for a prior install of HIGHS. The current test doesn't seem to work, not sure why HIGHS doesn't add itself to the path automatically, In any event, that part of helper.py is a kluge anyway. So I'd like to replace that test with the Pyomo available solver test, then add HIGHS.

jckantor commented 1 year ago

Hi Leon,

I've added Highs as the "default" for many of the notebooks. The key is to select the "appsi_highs" solver after install highspy. It's working very well. It also appears to work when highspy is installed "over" idaes-pse, but I haven't tested that enough to be confident recommending that for every case.

I'll close this for now. Feel free to reopen if you have some thoughts.

Jeff