Hello,
Is there a way (a keyword argument to the solver or optimize!) to suppress the output of optimize!?
When I use the Cbc Solver to solve the following toy problem I get the following output:
julia> using JuMP, Cbc
julia> model = Model(with_optimizer(Cbc.Optimizer));
julia> @variable(model, 0 <= x <= 2);
julia> @variable(model, 0 <= y <= 30);
julia> @objective(model, Max, 5*x + 3*y);
julia> @constraint(model, 1x + 5y <= 3);
julia> optimize!(model);
Welcome to the CBC MILP Solver
Version: 2.9.9
Build Date: Dec 31 2018
command line - Cbc_C_Interface -solve -quit (default strategy 1)
Presolve 0 (-1) rows, 0 (-2) columns and 0 (-2) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value 10.6
After Postsolve, objective 10.6, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 10.6 - 0 iterations time 0.012, Presolve 0.01
Total time (CPU seconds): 0.02 (Wallclock seconds): 0.02
This is highly inconvenient when one uses the solver inside a loop.
When I use the GLPK solver instead I do not encounter the same problem.
Btw this was not an issue in Jump 0.18.
Any thoughts?
This is currently a solver-specific option, see https://github.com/JuliaOpt/MathOptInterface.jl/issues/663 for a proposal of solver-independent option. For Cbc, you need to do with_optimizer(Cbc.Optimizer, logLevel = 0)
Just a remark:
-- Maurice
These options are solver-specific. We will be implementing a JuMP option to set the log-level to 0 to avoid this.
You should be able to do MOI.set(model, MOI.Silent(), true) to silence a solver
Just two remarks:
"print_level".MOI.set(model, MOI.RawParameter("print_level"), 1)
If you are interested in catching the solver's output, see also this post
Hi
I have the opposite problem, I need the output of GLPK.. I don't how to make it appears... I need some help, please
Z_OP = Model(with_optimizer(GLPK.Optimizer))
@variable(Z_OP, x[l,m], Bin)
@constraint(Z_OP, e_pac*x .<= e_part)
@objective(Z_OP, Min, sum(B.*x))
optimize!(Z_OP)
X = value.(x)
Z = JuMP.objective_value(Z_OP)
@lausilvag See https://github.com/JuliaOpt/GLPK.jl/issues/132 for a reply to your question.
Hello,
Sorry for re-raising an old issue but I'm having trouble with this as well and can't work out what I'm doing wrong.
Here are the things I've tried, all of which do not appear to suppress output:
1)
model::Model = Model(with_optimizer(Clp.Optimizer, LogLevel=0))
2)
model = Model(Clp.Optimizer)
set_optimizer_attribute(model, "LogLevel", 0)
3)
model = Model(Clp.Optimizer)
set_silent(model)
4)
model = Model(Clp.Optimizer)
MOI.set(model, MOI.Silent(), true)
I re-run (via include()) for each attempt after restarting the REPL.
I am using JuMP v0.21.4
Use set_silent(model).
Note that some solvers still print output, even when their printing level option is set to the minimum. We won't be providing a work-around for this because there are general Julia ones: https://discourse.julialang.org/t/consistent-way-to-suppress-solver-output/20437/6?u=odow
Bonjour,
I have this problem too (only with Clp so I rename the subject).
Le 1 nov. 2020 à 22:38, Oscar Dowson notifications@github.com a écrit :
Use set_silent(model).
This was good enough for Clp, at least with version v0.7.1.
But not since recently after updating my packages.
[a076750e] CPLEX v0.7.2
[9961bab8] Cbc v0.7.1
[e2554f3b] Clp v0.8.2
[4076af6c] JuMP v0.21.5
I suppose some debug messages bypass the [Ll]og[Ll]evel system?
Here are some logs from a test:
Coin0506I Presolve 29 (-91) rows, 20 (-180) columns and 58 (-262) elements
Clp0006I 0 Obj 29128.996 Primal inf 126.12002 (11)
Clp0006I 22 Obj 30390
Clp0000I Optimal - objective value 30390
Coin0511I After Postsolve, objective 30390, infeasibilities - dual 0 (0), primal 0 (0)
Clp0032I Optimal objective 30390 - 22 iterations time 0.002, Presolve 0.00
Coin0506I Presolve 29 (-91) rows, 20 (-180) columns and 58 (-262) elements
Clp0006I 0 Obj -2751.002 Primal inf 270.75679 (19)
Clp0006I 24 Obj 700
Clp0000I Optimal - objective value 700
Coin0511I After Postsolve, objective 700, infeasibilities - dual 0 (0), primal 0 (0)
Clp0032I Optimal objective 700 - 24 iterations time 0.002, Presolve 0.00
Extract from another test:
Coin0506I Presolve 29 (-91) rows, 20 (-180) columns and 58 (-262) elements
Clp0006I 0 Obj 24128.996 Primal inf 178.14002 (12)
Clp0006I 21 Obj 25650
Clp0000I Optimal - objective value 25650
Coin0511I After Postsolve, objective 25650, infeasibilities - dual 0 (0), primal 0 (0)
Clp0032I Optimal objective 25650 - 21 iterations time 0.002, Presolve 0.00
Coin0506I Presolve 29 (-91) rows, 20 (-180) columns and 58 (-262) elements
Clp0006I 0 Obj 29128.996 Primal inf 126.12002 (11)
Clp0006I 22 Obj 30390
Clp0000I Optimal - objective value 30390
-- Maurice
Note that some solvers still print output, even when their printing level option is set to the minimum. We won't be providing a work-around for this because there are general Julia ones: https://discourse.julialang.org/t/consistent-way-to-suppress-solver-output/20437/6?u=odow
Hi @diam
As noted by @odow , they won't be providing a workaround as there are general Julia ones.
In my case, I'm doing these optimizations in a loop, and simply redirecting stdout (as is suggested in the link above) isn't a great workaround anyway as it makes using Clp slower than GLPK. So for now, I stick with GLPK. Not ideal but not much else I can do.
Thank you Takuya,
So I guess it's a bug with Coin-Clp solver (I was not sure about that)? Now I understand that the capture of stdout is the only workaround until Coin-Clp is fixed.
As working in a scholar institut (ENSTA Paris) I can use CPLEX, but I like showing to students that JuMP allow us to choose a different solver simply with a command line switch (e.g --xsolver cplex|glpk|clp) from our application.
-- Maurice
Le 2 nov. 2020 à 09:30, Takuya Iwanaga notifications@github.com a écrit :
Hi @diam
As noted by @odow , they won't be providing a workaround as there are general Julia ones.
In my case, I'm doing these optimizations in a loop, and simply redirecting stdout (as is suggested in the link above) isn't a great workaround anyway as it makes using Clp slower than GLPK. So for now, I stick with GLPK. Not ideal but not much else I can do.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
This may be a regression in Clp.jl. I will investigate.
Edit: it was a bug in Clp.jl: https://github.com/jump-dev/Clp.jl/pull/102
Most helpful comment
This is currently a solver-specific option, see https://github.com/JuliaOpt/MathOptInterface.jl/issues/663 for a proposal of solver-independent option. For
Cbc, you need to dowith_optimizer(Cbc.Optimizer, logLevel = 0)