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

Refactor for compatibility with JuMP v0.21 #55

Closed
danielolsen opened this issue Jun 2, 2020 · 1 comment · Fixed by #62
Closed

Refactor for compatibility with JuMP v0.21 #55

danielolsen opened this issue Jun 2, 2020 · 1 comment · Fixed by #62
Assignees

Comments

@danielolsen
Copy link
Contributor

We thought we might have gotten this by getting rid of with_optimizer in #44, so we upgraded to requiring either v0.20 or v0.21 in #47, but we were still finding other incompatibilities with JuMP v0.21 so we undid this in #50.

We can stay at v0.20 for now, but we will slowly become more and more out of date with current JuMP capabilities and syntax. There are lots of little details to work out, like set_parameter vs. set_optimizer_attribute in #53 (see jump-dev/JuMP.jl#2149) that we will have to pay close attention to.

@danielolsen danielolsen self-assigned this Jun 2, 2020
@danielolsen
Copy link
Contributor Author

When @BainanXia was running into problems with JuMP v0.21.2, we saw the following StackTrace:

'RuntimeError: Julia exception: Index set for array is not one-based interval.',
'Stacktrace:',
' [1] error(::String) at ./error.jl:33',
' [2] _oneto(::Base.OneTo{Int64}) at /home/bxia/.julia/packages/JuMP/MnJQc/src/Containers/container.jl:76',
' [3] _broadcast_getindex_evalf at ./broadcast.jl:631 [inlined]',
' [4] _broadcast_getindex at ./broadcast.jl:604 [inlined]',
' [5] (::Base.Broadcast.var"#19#20"{Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(JuMP.Containers._oneto),Tuple{Tuple{Base.OneTo{Int64},UnitRange{Int64}}}}})(::Int64) at ./broadcast.jl:1024',
' [6] ntuple at ./ntuple.jl:42 [inlined]',
' [7] copy at ./broadcast.jl:1024 [inlined]',
' [8] materialize at ./broadcast.jl:820 [inlined]',
' [9] container(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64},UnitRange{Int64}}}, ::Type{Array}) at /home/bxia/.julia/packages/JuMP/MnJQc/src/Containers/container.jl:80',
' [10] macro expansion at /home/bxia/.julia/packages/JuMP/MnJQc/src/macros.jl:79 [inlined]',
' [11] _build_model(::JuMP.Model; case::REISE.Case, storage::REISE.Storage, start_index::Int64, interval_length::Int64, demand_scaling::Float64, load_shed_enabled::Bool, load_shed_penalty::Int64, trans_viol_enabled::Bool, trans_viol_penalty::Int64, initial_ramp_enabled::Bool, initial_ramp_g0::Array{Float64,1}, storage_e0::Array{Float64,1}) at /home/EGM/v2/REISE.jl/src/model.jl:199',
' [12] interval_loop(::Gurobi.Env, ::Dict{String,Any}, ::Dict{String,Int64}, ::Int64, ::Int64, ::Int64, ::String, ::String) at /home/EGM/v2/REISE.jl/src/loop.jl:38',
' [13] run_scenario(; num_segments::Int64, interval::Int64, n_interval::Int64, start_index::Int64, inputfolder::String, outputfolder::String) at /home/EGM/v2/REISE.jl/src/REISE.jl:56',
' [14] (::PyCall.var"#f_kw_closure#59"{typeof(REISE.run_scenario),Tuple{},Array{Tuple{Symbol,Any},1}})() at /home/bxia/.julia/packages/PyCall/zqDXB/src/callback.jl:36',
' [15] _pyjlwrap_call(::Function, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /home/bxia/.julia/packages/PyCall/zqDXB/src/callback.jl:37',
' [16] pyjlwrap_call(::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /home/bxia/.julia/packages/PyCall/zqDXB/src/callback.jl:49']

This seems similar to a PR that has been merged into JuMP v0.21.3 (jump-dev/JuMP.jl#2235), so we can try testing with this version. If it works, we could specify compatibility as "0.20, 0.21.3" which would match 0.20.x and 0.21.y (y>=3). See https://julialang.github.io/Pkg.jl/v1/compatibility/ for more details

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

Successfully merging a pull request may close this issue.

1 participant