Skip to content

Commit

Permalink
Disable multiple threads for Cbc solver on Windows
Browse files Browse the repository at this point in the history
Cbc cannot be used on Windows with multiple threads: <jump-dev/Cbc.jl#186>
The `threads` argument is already disabled on Windows since Cbc v1.0.0: <jump-dev/Cbc.jl#192>
We cannot use Cbc v1.0.0 at the moment because it requires MathOptInterface v1 and we require MathOptInterface v0.10.9.
Removal of MathOptInterface from FlexPlan.jl dependencies is to be done: <#121 (comment)>
  • Loading branch information
matteorossini committed Apr 19, 2022
1 parent f6a3d10 commit a555593
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ using Test

ipopt_solver = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "tol" => 1e-6, "print_level" => 0)
scs_solver = JuMP.optimizer_with_attributes(SCS.Optimizer, "verbose" => 0)
cbc = JuMP.optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0, "threads"=>Threads.nthreads())

# Cbc cannot be used on Windows with multiple threads: <https://github.com/jump-dev/Cbc.jl/issues/186>
# The `threads` argument is already disabled on Windows since Cbc v1.0.0: <https://github.com/jump-dev/Cbc.jl/pull/192>
# We cannot use Cbc v1.0.0 at the moment because it requires MathOptInterface v1 and we require MathOptInterface v0.10.9.
# Removal of MathOptInterface from FlexPlan.jl dependencies is to be done: <https://github.com/Electa-Git/FlexPlan.jl/issues/121#issue-1158572058>
if Sys.iswindows()
cbc = JuMP.optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0)
else
cbc = JuMP.optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0, "threads"=>Threads.nthreads())
end

juniper = JuMP.optimizer_with_attributes(Juniper.Optimizer, "nl_solver" => ipopt_solver, "mip_solver" => cbc, "time_limit" => 7200)

@testset "FlexPlan" begin
Expand Down

0 comments on commit a555593

Please sign in to comment.