-
Notifications
You must be signed in to change notification settings - Fork 117
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
set multithread cbc solver in cvxpy problem #489
Comments
Hi, I think you can set a time limit and it will give you the best not-necessarily-optimal partial solution.From what I've read, optimization problems aren't easy to parallelize, even by hand. Heuristics gleanedfrom knowledge of the problem domain can help you set upper limits. Notice for example, that systems themselves areoften designed such as to facilitate routing optimization. Then there is also quantum computing if your organization has the budget ...Robert
On Tuesday, April 5, 2022, 08:24:40 AM PDT, Marie73 ***@***.***> wrote:
Hello,
I have an integer linear programming issue, which I managed to solve by formulating CVXPY problem with use of CBC solver. The task is to transport suitable boxes and units of products from source warehouse to more target warehouses according to minimal and maximal demand for product. Before rewriting to cvxpy, I reduce the problem dimension as much as possible and use sparse matrices.
I use this formula for finding solution:
problem.solve(verbose=True, solver='CBC', numberThreads = 1, allowablePercentageGap = 1)
It does not seem to take the numberThreads and allowablePercentageGap parameters into account. The solution time is almost the same for different parameter settings.
Can you help me set the CBC solver to run in parallel? Or do you have an idea how to solve ILP faster?
The small problem is solved in 2 minutes, the big one in 30-40 minutes. But we have to find a solution ideally within 15 minutes.
I posted this issue also in cvxpy lib : cvxpy/cvxpy#1741
Thank you
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Thank you for answer. I set maximal time of computation as: I can slit problem by target warehouses - calculate faster and less optimal, but still if there is some option to make it faster and right, I would like to try it. |
You should know that cbc is not rigourously tested.Have you tried other solvers besides cbc? In particular, CPLEX has good documentation and gives you a "quickstart" on mathematical programming.(Sorry if Im assuming too much about your background or the problem you are solving) - Free version up to 1000 variables.
On Wednesday, April 6, 2022, 12:18:15 AM PDT, Marie73 ***@***.***> wrote:
Thank you for answer. I set maximal time of computation as:
problem.solve(verbose=True, solver='CBC', numberThreads = 1, allowablePercentageGap = 1, maximumSeconds = 13*60)
But the solution doesnt fit all constraints.
I can slit problem by target warehouses - calculate faster and less optimal, but still if there is some option to make it faster and right, I would like to try it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
I tried SCIP and GLPK_MI with certain parameters. I didnt try CPLEX because it is commercial solver and I dont have a licence, the same with GUROBI and EXPRESS.
It will run as application in production, do you think that CBC is not reliable enough? |
Normally Cbc is faster and more reliable than Glpk. It just looks as if
the interface from cvxpy is not passing parameters in correctly.
It should probably be threads=4 (or 6) anyway - but the allowable gap is
more important for time.
I can try and look at interface code - but I know nothing about cvxpy.
…On 08/04/2022 08:58, Marie73 wrote:
I tried SCIP and GLPK_MI with certain parameters. I didnt try CPLEX
because it is commercial solver and I dont have a licence, the same
with GUROBI and EXPRESS.
|problem.solve(verbose=True, solver=cp.SCIP, scip_params =
{'parallel/mode' : 1, 'lp/threads' : 6, 'parallel/minnthreads' : 6,
'limits/gap': 0.1})|
|problem.solve(verbose=True, solver='GLPK_MI', reltol = 0.1)|
It will run as application in production, do you think that CBC is not
reliable enough?
—
Reply to this email directly, view it on GitHub
<#489 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWJYHDO27VRK7ECJHZF4EDVD7RLFANCNFSM5STEF4AQ>.
You are receiving this because you are subscribed to this
thread.Message ID: ***@***.***>
|
I have the same problem and have the same experiences as you Marie |
The documentation here is a bit optimistic :). The interface to Cbc is through CyLP and CyLP doesn't support setting arbitrary Cbc parameters. The way the interface is implemented, it seems to in fact be true that all the parameters are ignored :(. Changing this would require a change to CyLP, which is probably not very difficult. For the record, I think it's pretty misleading to characterize Cbc as "not rigorously tested." It is quite robust in practice. |
Thank you for your response! In other words, CyLP can compute cbc using multiple threads, but the problem is in parameter communication. I'm new to python, so I can't make changes to packages myself yet, but I can report it as a bug / new feature in CyLP (?) ps: Thank you for cbc support, I feel calmer now :) |
Yes, the main thing needed is the ability to pass parameters to Cbc, which #1 and #133 do both address for the case of setting the number of threads. Secondarily, the Cbc library that is used must also be built with support for multithreading. The current wheels made available are not built with this support, but this could also be changed. If you open an issue in CyLP about adding a method for setting arbitrary parameters, I will try to find some time to address it. |
Thank you! I opened the issue in CyLP. |
Hello,
I have an integer linear programming issue, which I managed to solve by formulating CVXPY problem with use of CBC solver. The task is to transport suitable boxes and units of products from source warehouse to more target warehouses according to minimal and maximal demand for product. Before rewriting to cvxpy, I reduce the problem dimension as much as possible and use sparse matrices.
I use this formula for finding solution:
problem.solve(verbose=True, solver='CBC', numberThreads = 1, allowablePercentageGap = 1)
It does not seem to take the numberThreads and allowablePercentageGap parameters into account. The solution time is almost the same for different parameter settings.
Can you help me set the CBC solver to run in parallel? Or do you have an idea how to solve ILP faster?
The small problem is solved in 2 minutes, the big one in 30-40 minutes. But we have to find a solution ideally within 15 minutes.
I posted this issue also in cvxpy lib : cvxpy/cvxpy#1741
Thank you
The text was updated successfully, but these errors were encountered: