Cbc.jl icon indicating copy to clipboard operation
Cbc.jl copied to clipboard

Cbc ignores parameters when model is an LP

Open jd-lara opened this issue 4 years ago • 2 comments

Cbc ignores the outcome of set_silent when the model is an LP. I guess this is because the attribute isn't passed to CLP.

MWE:

using JuMP, Cbc
Cbc_optimizer = JuMP.optimizer_with_attributes(Cbc.Optimizer)
m = Model(Cbc_optimizer)
x = @variable(m, upper_bound = 0)
y = @variable(m, upper_bound = 0)
@objective(m, Min, x + y)
optimize!(m)

jd-lara avatar May 25 '21 22:05 jd-lara

This is an upstream issue.

using Cbc_jll
open("file.lp", "w") do io
    println(
        io, 
"""
Minimize
obj: - 2 x3

Subject To
c1: x2 - x1 <= 10
c2: x1 + x2 + x3 <= 20

Bounds
x1 <= 30

End
""",
    )
end

julia> Cbc_jll.cbc() do exe
           run(`$(exe)`)
       end

Welcome to the CBC MILP Solver 
Version: 2.10.5 
Build Date: Apr 14 2021 

CoinSolver takes input from arguments ( - switches to stdin)
Enter ? for list of commands or help
Coin:import file.lp
Coin:logLevel 0
Coin:logLevel
logLevel has value 0
Coin:solve
Presolve 0 (-2) rows, 0 (-3) columns and 0 (-5) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value -40
After Postsolve, objective -40, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective -40 - 0 iterations time 0.002, Presolve 0.00
Coin:

Although it respects parameters at the command line

julia> Cbc_jll.cbc() do exe
           run(`$(exe) file.lp`)
       end
Welcome to the CBC MILP Solver 
Version: 2.10.5 
Build Date: Apr 14 2021 

command line - /Users/oscar/.julia/artifacts/fcc0f90ee62113a97e8e82c1b20a46265667d88d/bin/cbc file.lp (default strategy 1)
Presolve 0 (-2) rows, 0 (-3) columns and 0 (-5) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value -40
After Postsolve, objective -40, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective -40 - 0 iterations time 0.002, Presolve 0.00
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00

Process(`/Users/oscar/.julia/artifacts/fcc0f90ee62113a97e8e82c1b20a46265667d88d/bin/cbc file.lp`, ProcessExited(0))

julia> Cbc_jll.cbc() do exe
           run(`$(exe) file.lp logLevel=0`)
       end
Process(`/Users/oscar/.julia/artifacts/fcc0f90ee62113a97e8e82c1b20a46265667d88d/bin/cbc file.lp logLevel=0`, ProcessExited(0))

odow avatar May 25 '21 23:05 odow

I renamed the issue because this affects more parameters than just logLevel. For example: https://github.com/jump-dev/Cbc.jl/issues/211.

odow avatar Dec 12 '22 17:12 odow