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

MethodError: no method matching getindex #39

Closed
Edenharder opened this issue Sep 17, 2020 · 6 comments
Closed

MethodError: no method matching getindex #39

Edenharder opened this issue Sep 17, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@Edenharder
Copy link

With Julia 1.5 and the newest Convex.jl, the test of the example fails.

Example:

using SDPAFamily, LinearAlgebra
using Convex
y = Semidefinite(3)
p = maximize(eigmin(y), tr(y) <= 5; numeric_type = BigFloat)
solve!(p, () -> SDPAFamily.Optimizer())
@show p.optval

Errors:

MethodError: no method matching getindex(::Nothing, ::Int64)

Stacktrace:
 [1] copy_free_variables(::SDPAFamily.Optimizer{BigFloat}, ::MathOptInterface.Utilities.IndexMap, ::Array{MathOptInterface.VariableIndex,1}, ::typeof(MathOptInterface.Utilities.allocate_variables)) at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Utilities/copy.jl:364
 [2] allocate_load(::SDPAFamily.Optimizer{BigFloat}, ::MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{BigFloat}}, ::Bool, ::Nothing) at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Utilities/copy.jl:745
 [3] #automatic_copy_to#113 at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Utilities/copy.jl:23 [inlined]
 [4] #copy_to#22 at /Users/Someone/.julia/packages/SDPAFamily/rG0xe/src/MOI_wrapper.jl:211 [inlined]
 [5] attach_optimizer(::MathOptInterface.Utilities.CachingOptimizer{SDPAFamily.Optimizer{BigFloat},MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{BigFloat}}}) at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Utilities/cachingoptimizer.jl:150
 [6] optimize!(::MathOptInterface.Utilities.CachingOptimizer{SDPAFamily.Optimizer{BigFloat},MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{BigFloat}}}) at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Utilities/cachingoptimizer.jl:211
 [7] optimize! at /Users/Someone/.julia/packages/MathOptInterface/8Mxwr/src/Bridges/bridge_optimizer.jl:264 [inlined]
 [8] solve!(::Problem{BigFloat}, ::SDPAFamily.Optimizer{BigFloat}; check_vexity::Bool, verbose::Bool, warmstart::Bool, silent_solver::Bool) at /Users/Someone/.julia/packages/Convex/aYxJA/src/solution.jl:245
 [9] solve! at /Users/Someone/.julia/packages/Convex/aYxJA/src/solution.jl:223 [inlined]
 [10] solve!(::Problem{BigFloat}, ::var"#21#22"; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/Someone/.julia/packages/Convex/aYxJA/src/solution.jl:192
 [11] solve!(::Problem{BigFloat}, ::Function) at /Users/Someone/.julia/packages/Convex/aYxJA/src/solution.jl:191
 [12] top-level scope at In[13]:5
 [13] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
@ericphanson
Copy link
Owner

Thanks very much for the report! I can reproduce it. It works on MathOptInterface 0.9.15, so I think it's an issue with the new 0.9.16 release; I'll try to see what went wrong there. In the meantime you can try it with the older release by doing ] add MathOptInterface@0.9.15 and then restarting the Julia session.

@ericphanson ericphanson added bug Something isn't working upstream? labels Sep 17, 2020
@Edenharder
Copy link
Author

Edenharder commented Sep 17, 2020

@ericphanson Thank you very much for the prompt reply and the suggestion. But the same error is still there even I have used ] add MathOptInterface@0.9.15 . Please let me know, what the extra information do I need to provide.
My operating system is MacOs 10.15.6

@ericphanson
Copy link
Owner

Hmm, what does using Pkg; Pkg.status() say?

@ericphanson
Copy link
Owner

ah, what happened is that I thought I released SDPAFamily 0.2 two weeks ago (which has some fixes for the latest MathOptInterface), but it never went through. It just got released now (JuliaRegistries/General#21550) so it should work if you do a Pkg.update() and restart your session (you should see that you get SDPAFamily 0.2, but if not you can try ] add SDPAFamily@0.2).

@Edenharder
Copy link
Author

@ericphanson Thank you so much! The problem is solved. It works for me now with MathOptInterface v0.9.16 and SDPAFamily 0.2.

@ericphanson
Copy link
Owner

Great! Thanks again for the report, I haven't been using the library myself recently so who knows how long it would've been to find out about this issue otherwise.

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