Closed aphi closed 1 year ago
thanks! I will close the other PR then
@aphi hi long time no see :-)
there seems to be a failing test in highs_api.py in the current master branch are you able to look into it, could be a background dependency issue, as the error showed up in an unrelated commit.
https://github.com/coin-or/pulp/actions/runs/5561352717/job/15064721500
Thanks
For the HiGHS API interface:
Add the setting of a time_limit and significantly speed up solution processing Picking up from the stale branch and PR (https://github.com/coin-or/pulp/pull/614), where the implementation is correct but the tests failed. The reason why took some digging...
The time limit test for all the solvers is actually on the end-to-end time including extraction of solution values.
In this case the solver terminated correctly after 10 seconds, but ~163s were spent in extracting the solution on my machine (or 320s in CI). Specifically, calling the getitem method (i.e. []) in
solution.col_value[var.index]
is a very slow operation (presumably some type conversions via pybind11).For the 134k variables of the bin packing problem, this took 163s and failed the test, but could be reduced very easily to 0.004s 🎉 just by copying solution.col_value to a Python list first, for which index lookups are of course fast.
Demo script in a gist if curious: https://gist.github.com/aphi/4b2f7cfc7ccc52465bead3c24ee9c3f4
Enable setting of any other paramters and clean up init signature Clean up:
epgap
was unused and deprecated in favour ofgapRel
.gapRel
as its own argument was also unsued and misleading. It was passed as an args to the base class, which ignored the args.gapRel
when supplied via the **kwargs to optionsDict functions the same. But now the user can also specify any parameter for HiGHS, just the same handling as the Gurobi API.I've tested this and verified it works with other parameters like
threads
andparallel
from the HiGHS optionsHappy to make any changes - just let me know.
P.S. I contributed to this project back before it was on GitHub (2007~2011) under the guidance of stumitchell. So great to see its immense popularity today!