-
Notifications
You must be signed in to change notification settings - Fork 95
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 with python-mip is slow #372
Comments
I have not looked into the code in a long while, but since the above call to EDIT: Maybe the call to |
Thanks, @rschwarz. I'll take a look into it. |
The solution is to avoid using The name of variable is set automatically at Line 40 in 0ccb811
I met the same problem in PyOptInterface and decide to maintain the name mapping internally: metab0t/PyOptInterface@0074dc0 Update: A fix is proposed at ERGO-Code/HiGHS#1782 to solve this problem. |
Since the fix (ERGO-Code/HiGHS#1782) has been merged in the meantime, I wanted to reevaluate the issue. On my machine, with
So there is still a difference between Cbc and HiGHS, but it's arguably less than the variation within each solver's run. When I increase the number of variables by another factor 10, the timings become less varied and there is a more obvious factor 2 from Cbc to HiGHS. That means that the overhead can maybe still be improved (maybe by caching the names on the Python side) but the order of magnitude is now OK. |
What is more striking to me is that the test script above doesn't even set a name for the variables. The default value for But, it turns out that a name is always provided, using this logic: I find this a bit strange, because if generic names are needed, eg, to export a problem from the solver to In any case, removing this default name logic will reduce the time for HiGHS by about a third. This sounds like a lot, but in a more realistic use case that actually builds expressions for constraints etc, I don't think it would make a big difference. In summary, I'd consider this issue closed (@colonetti). |
Hello, everyone
Firstly, thanks for the great package and also for adding support for Highs.
However, it seems that creating a optimization model with Highs is rather slow.
Describe the bug
Adding variables to a Highs optimization model is slow.
To Reproduce
Expected behavior
GRB: 0.021987227955833077 seconds to add vars
CBC: 0.026054809102788568 seconds to add vars
Highs: 6.408406416885555 seconds to add vars
Desktop (please complete the following information):
Thanks again!
The text was updated successfully, but these errors were encountered: