Do faster optimization with Cbc solver in JuMP

I am trying to do an optimization of a MILP problem with Cbc solver but it is too slow. I know that with CPLEX it is much faster but I need to use Cbc. Does anyone know of a resource to get it? Maybe multi-threading?

if you need to use use Cbc you’re using Cbc, unless you are talking about write a Julia Cbc?

No. I am using JuMP and the Cbc solver for MILP optimization but it is too slow and I want to know if there is any way to make the optimization more faster.

but you still have to use Cbc optimizer, correct? if so, you’re asking how to make your JuMP code faster maybe (which was not clear, except maybe implied from the tag)

Make sure you set the threads attribute:

using Cbc
using JuMP
n = # the number of threads available on your machine
model = Model(Cbc.Optimizer)
set_optimizer_attribute(model, "threads", n) 

The answer is “it depends.”

Define “too slow.” To find a feasible solution? Or to prove optimality?

Most solvers will quickly find a good-enough solution, and then spend a long time proving it is near optimal. Just set a time-limit and return the good-enough solution.

Poor formulations, like large big-M constraints can also play a part. You could also try to provide a good starting point as a hint via

You should also take a read of


Another way to make Cbc faster is to shrink your search space with heuristics. Depending on how your problem is constructed, you might be able to apply to basic logic that will obviously reduce the area of search before it even gets to Cbc.

For instance, if you were trying to solve the Traveling Salesman Problem (TSP), then a natural heuristic would be to exclude options where the salesman travels to opposite sides of the geography.

Also, you might be including infeasible options in your search space. These options could waste time. If you find a way to exclude infeasible options from the get-go, then you’ll shrink the search space and Cbc will solve faster.