Hello,
In continuation of the thread : Poor time performance in modifying parameters of JuMP models when using Gurobi - #10 by odow
Here is a code that show the behavior (it emulates the behavior of a column generation algorithm).
module pbgrb
using JuMP
using Gurobi
using HiGHS
function sc_gurobi(nbconstraint::Int, nbcolums::Int, nbiter::Int)
m = Model(Gurobi.Optimizer)
set_silent(m)
set_attribute(m, "Threads", 1)
@objective(m, Min, 0)
@constraint(m, constr[i=1:nbconstraint], 0 == 1)
x = Vector{VariableRef}()
for k in 1:nbiter
optimize!(m)
for i in 1:nbcolums
push!(x, @variable(m, lower_bound=0, upper_bound=1))
set_objective_coefficient(m, x[end], 1)
for i in 1:nbconstraint
set_normalized_coefficient(constr[i], x[end], 1)
end
end
end
end
function sc_highs(nbconstraint::Int, nbcolums::Int, nbiter::Int)
m = Model(HiGHS.Optimizer)
set_silent(m)
@objective(m, Min, 0)
@constraint(m, constr[i=1:nbconstraint], 0 == 1)
x = Vector{VariableRef}()
for k in 1:nbiter
optimize!(m)
for i in 1:nbcolums
push!(x, @variable(m, lower_bound = 0, upper_bound = 1))
set_objective_coefficient(m, x[end], 1)
for i in 1:nbconstraint
set_normalized_coefficient(constr[i], x[end], 1)
end
end
end
end
function main()
start = time()
sc_gurobi(100, 100, 20)
println("Time Gurobi: ", time() - start)
start = time()
sc_highs(100, 100, 20)
println("Time HiGHS: ", time() - start)
end
end # module pbgrb
On my computer, I obtain output such as
Time Gurobi: 11.41237497329712
Time HiGHS: 0.17132186889648438
I am using a macbook with M1 pro processor under macos 14.3.1, julia 1.10.1, JuMP 1.20.0, Gurobi.jl 1.2.1, HiGHS 1.9.0, Gurobi 11.0.1.
I am under the impression that I do follow the rules regarding the lazy update.
Thank you in advance,
Best regards,
Nicolas.