Skip to content

JuMP.value() Performance Issue #204

@lucasprocessi

Description

@lucasprocessi

When solving a big MIP using Cbc and JuMP, the time to retrieve the values of all variables seems to grow with the square of the problem size.

Probing the entire solution of the following mock problem takes 0.07s for M=1, 7.0s for M = 10 and 700s for M =100 in my laptop.

using Cbc
using JuMP

M = 1
N_int = 2M
N_float = 7_800M

m = JuMP.Model(Cbc.Optimizer)

@info "Create Empty Model"
@show m

@info "Create $N_int integer variables"
@variable(m, x[1:N_int], Int)
@info "Create $N_float continuous variables"
@variable(m, y[1:N_float])

@info "Optimize"
optimize!(m)

@info "Probe results"
@time for v in all_variables(m)
    value(v)
end

When M=1000, it takes 19 hours to get all primal values from this model. Just by comparison, the same operation takes only 62s when using Gurobi.jl as optimizer with M=1000 in the same machine.

Any insights on how can I tackle this problem, or any alternative ways to retrieve solution values in big models?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions