Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiGHS API interface improvements including time_limit #641

Merged
merged 6 commits into from
Apr 1, 2023

Conversation

aphi
Copy link
Contributor

@aphi aphi commented Apr 1, 2023

For the HiGHS API interface:

  1. Add the setting of a time_limit and significantly speed up solution processing
    Picking up from the stale branch and PR (Implementing TimeLimit for highspy #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

    image
  2. Enable setting of any other paramters and clean up init signature
    Clean up: epgap was unused and deprecated in favour of gapRel. 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 and parallel from the HiGHS options

  3. Some minor tidyups

Happy 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!

@pchtsp pchtsp merged commit a7684ac into coin-or:master Apr 1, 2023
@pchtsp
Copy link
Collaborator

pchtsp commented Apr 1, 2023

thanks! I will close the other PR then

@stumitchell
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants