Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.8k views
in Technique[技术] by (71.8m points)

julia - Why GLPK Solver doesn't verbose anything in JuMP?

I create this simple code as a demonstration:

using GLPK
using JuMP
m = Model(GLPK.Optimizer)
@variable(m, y[i=1:100], Bin)
@objective(m, Min, sum(y))
@constraint(m, [j=5:50], sum([y[i] for i in j:j+10]) >= 5)
optimize!(m)

Please note this integer program doesn't represent anything, it's only for example. The previous code doesn't output anything while I remembered using Gurobi or even GLPK and Julia JuMP used to output datas about where it is in the current solving process. How many nodes already treated, how long the algorithm has been running, current best bound and so on. Note that it is not related to the size of my integer program as it doesn't output anything too on a bigger program I run with more constraints and variables.

I also tried:

julia> get_optimizer_attribute(m, MOI.Silent())
false

Which is coherent with the following not changing anything:

julia> unset_silent(m)
false

Am I missing something?

I am running Julia 1.5.2, JuMP v0.21.5 and GLPK v0.14.4.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Set the logging level:

julia> set_optimizer_attribute(m, "msg_lev", GLPK.GLP_MSG_ALL)
3

julia> optimize!(m)
GLPK Simplex Optimizer, v4.64
46 rows, 100 columns, 506 non-zeros
     67: obj =  2.500000000e+001 inf =  2.000e+001 (5)
     74: obj =  2.600000000e+001 inf =  0.000e+000 (0)
*    77: obj =  2.500000000e+001 inf =  0.000e+000 (0)
OPTIMAL LP SOLUTION FOUND
GLPK Integer Optimizer, v4.64
46 rows, 100 columns, 506 non-zeros
100 integer variables, all of which are binary
Integer optimization begins...
+    77: mip =     not found yet >=              -inf        (1; 0)
+    77: >>>>>  2.500000000e+001 >=  2.500000000e+001   0.0% (1; 0)
+    77: mip =  2.500000000e+001 >=     tree is empty   0.0% (0; 1)
INTEGER OPTIMAL SOLUTION FOUND

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
...