Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JuMP.value() Performance Issue #204

Closed
lucasprocessi opened this issue Sep 8, 2022 · 4 comments · Fixed by #205
Closed

JuMP.value() Performance Issue #204

lucasprocessi opened this issue Sep 8, 2022 · 4 comments · Fixed by #205

Comments

@lucasprocessi
Copy link

lucasprocessi commented Sep 8, 2022

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!

@odow
Copy link
Member

odow commented Sep 8, 2022

Profile shows it's here:
image

I'll take a look.

@odow
Copy link
Member

odow commented Sep 8, 2022

You can try a fix with ] add Cbc#od/cache-term-status, then restart Julia.

@odow odow closed this as completed in #205 Sep 8, 2022
@lucasprocessi
Copy link
Author

Thanks a lot @odow !

@odow
Copy link
Member

odow commented Sep 9, 2022

No problem. If you're solving large MIPs, you should also try out HiGHS.jl: https://github.com/jump-dev/HiGHS.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants