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

Broken MOI interface #11

Closed
laurentbartholdi opened this issue May 13, 2021 · 1 comment · Fixed by #12
Closed

Broken MOI interface #11

laurentbartholdi opened this issue May 13, 2021 · 1 comment · Fixed by #12

Comments

@laurentbartholdi
Copy link

laurentbartholdi commented May 13, 2021

The interface with higher-level solvers seems to be broken: with Julia v1.7, DSDP v0.0.1, latest JuMP.jl and Convex.jl (all pulled from github)

julia> using DSDP, Convex
julia> #A is a list of matrices, b is a matrix, c is a vector
julia> A = [[1 0;0 1],[0 1;1 0]]; b = [2 3;4 5]; c = [6,7] # for example
julia> x = Variable(length(A));
julia> problem = minimize(sum(x[l]*v for (l,v) in enumerate(c)),[sum(x[l]*m for (l,m) in enumerate(A))+b in :SDP])
julia> solve!(problem,DSDP.Optimizer)
ERROR: MethodError: no method matching allocate_variables(::DSDP.Optimizer, ::Int64)
Closest candidates are:
  allocate_variables(::Union{MathOptInterface.Utilities.AbstractModelLike{T}, MathOptInterface.Utilities.AbstractOptimizer{T}} where T, ::Any) at /Users/laurent/.julia/packages/MathOptInterface/1EYfq/src/Utilities/model.jl:783
  allocate_variables(::MathOptInterface.Utilities.MockOptimizer, ::Any) at /Users/laurent/.julia/packages/MathOptInterface/1EYfq/src/Utilities/mockoptimizer.jl:767
Stacktrace:
  [1] copy_free_variables(dest::DSDP.Optimizer, idxmap::MathOptInterface.Utilities.IndexMap, vis_src::Vector{MathOptInterface.VariableIndex}, copy_variables::typeof(MathOptInterface.Utilities.allocate_variables))
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/1EYfq/src/Utilities/copy.jl:557
  [2] allocate_load(dest::DSDP.Optimizer, src::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}, copy_names::Bool, filter_constraints::Nothing)
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/1EYfq/src/Utilities/copy.jl:1067
  [3] #automatic_copy_to#127
    @ ~/.julia/packages/MathOptInterface/1EYfq/src/Utilities/copy.jl:26 [inlined]
  [4] #copy_to#3
    @ ~/.julia/packages/DSDP/x4iAt/src/MOI_wrapper.jl:201 [inlined]
  [5] attach_optimizer(model::MathOptInterface.Utilities.CachingOptimizer{DSDP.Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/1EYfq/src/Utilities/cachingoptimizer.jl:185
  [6] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{DSDP.Optimizer, MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.GenericModel{Float64, MathOptInterface.Utilities.ModelFunctionConstraints{Float64}}}})
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/1EYfq/src/Utilities/cachingoptimizer.jl:248
  [7] optimize!
    @ ~/.julia/packages/MathOptInterface/1EYfq/src/Bridges/bridge_optimizer.jl:293 [inlined]
  [8] solve!(problem::Problem{Float64}, optimizer::DSDP.Optimizer; check_vexity::Bool, verbose::Bool, warmstart::Bool, silent_solver::Bool)
    @ Convex ~/.julia/packages/Convex/LMZC7/src/solution.jl:243
  [9] solve!(problem::Problem{Float64}, optimizer::DSDP.Optimizer)
    @ Convex ~/.julia/packages/Convex/LMZC7/src/solution.jl:221
 [10] solve!(problem::Problem{Float64}, optimizer_factory::Type; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Convex ~/.julia/packages/Convex/LMZC7/src/solution.jl:192
 [11] solve!(problem::Problem{Float64}, optimizer_factory::Type)
    @ Convex ~/.julia/packages/Convex/LMZC7/src/solution.jl:191
 [12] top-level scope
    @ REPL[17]:1

I had the same problems with JuMP.

@odow
Copy link
Member

odow commented May 13, 2021

The interface with higher-level solvers seems to be broken

Potentially. DSDP.jl hasn't been updated in more than 1 year. Although...

Julia v1.7

Not that Julia 1.7 has not been released, so JuMP packages are not guaranteed to work.

latest JuMP.jl and Convex.jl (all pulled from github)

Note that the master branch of each package is not guaranteed to work with every package. Use the Julia package manager instead:

] add JuMP

Not

] add JuMP#master
] add https://github.com/jump-dev/JuMP.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