Replies: 3 comments 2 replies
-
|
Would you like to post the PyOptInterface implementation as a comparison? By the way, PyOptInterface uses the C API of HiGHS instead of highspy and the names are passed to HiGHS in |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for posting this study. I'm not surprised that something based on the C API rather than pybind11 is faster, and I can see that the difference is meaningful on MIPs that are so simple to solve. We've seen a similar situation when building problems with Pyomo: the time taken to communicate the problem to HiGHS is dominant (because it's done in Python, rather than via a data file) when the problem is easy to solve. However, the absolute times are small compared to the solve time for a non-trivial MIP, and the relative time difference is only a factor of 4-5. To re-write the HiGHS Python API so that it calls the C API rather than use pybind11 to achieve the efficiency of PyOptInterface isn't a worthwhile use of HiGHS team resources. Of course, if someone externally wants to contribute it, then let us know! |
Beta Was this translation helpful? Give feedback.
-
Agreed, whole heartedly! Having the HiGHSpy interface be on par with the other Python interfaces (Pulp, Pyomo, PyOptInterface, etc...) is great as-is. It was a joy to essentially only need to change the function names instead of the whole frame of thought for building and extracting. 👍 With the growth of automatic bind gen packages I wouldn't be surprised if it could be automated. Then, in those cases where construction speed is the priority there's always directly interfacing from a compiled language. :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I don't know if this is a 'discussion' or just a 'report' but here it is.
The short of it:
I hadn't tried HiGHSpy in a while and spotted some nice quality of life changes in the interface that made it virtually 1:1 with PyOptInterface and other front-ends so I gave it a shot...
I tried doing the model creation using the bulk addBinaries, addIntegers instead of iterating and it did not improve the situation presented below. I also tried directly using addVariable for each using Inter var types with lb and ub, no love from that either.
HiGHSpy v1.11.0
PyOptinterface using HiGHSpy v1.10.0
The long of it:
Here's the iterative variable addition version which matches the exact logic of the PyOptInterface version except the PyOptInterface version does include the variable names which, iirc, PyOptInterface handles instead of sending to HiGHS:
and just for completeness to show the model equivalency:
HiGHSpy v1.11.0
PyOptInterface
Beta Was this translation helpful? Give feedback.
All reactions