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

Large slowdown in MOI problem construction from JuMP #131

Closed
angeris opened this issue Feb 4, 2021 · 0 comments
Closed

Large slowdown in MOI problem construction from JuMP #131

angeris opened this issue Feb 4, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@angeris
Copy link

angeris commented Feb 4, 2021

This was prompted by #130. My current package versions are

  [1e616198] COSMO v0.7.9
  [4076af6c] JuMP v0.21.4

Here is a simple problem construction which has a sparsity structure very similar to some SDPs I'm solving:

using COSMO, SparseArrays, JuMP, LinearAlgebra, Random

Random.seed!(1234)

# Makes a subblock of size 3 w.p. ~ 98% and of size 201 otherwise
function block(i, n)
    A = spzeros(n, n)
    block_size = randn() > -2 ? 2 : 200
    A[i:min(i+block_size,n), i:min(i+block_size,n)] .= 1
    return A
end

n = 400

m = Model(COSMO.Optimizer)

A = spzeros(GenericAffExpr{Float64, VariableRef}, n, n)

@variable(m, u[1:n])

for i=1:n
    Q = block(i, n)
    for (j, k, v)  zip(findnz(Q)...)
        A[j,k] = 0.0001
        add_to_expression!(A[j, k], u[i], v)
    end
end

@show nnz(A)

@constraint(m, A - sparse(I(n))  PSDCone())

@info "Finished adding constraints"

@objective(m, Min, 0)

optimize!(m)

In particular, note that the time spent "canonicalizing" the problem is rather large, even though the per-iteration cost for solving is decidedly not. I'm not sure what can be done to improve this? Perhaps a second also important question that I'm not sure about is: what's the best way of writing a standard dual form SDP in JuMP?

I will take a quick stab at profiling this, but I don't know much about COSMO.jl per se, so it's very likely I won't be particularly useful here :)

Anyways, thank you again for all of your work!

@angeris angeris added the bug Something isn't working label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants