Hi folks,
I’m having a strange problem with JuMP that I hope someone can identify…
The first formulation below results in a key error but the second doesn’t but both should, in theory involve evaluations on the same sets of keys…
It’s frustrating because in the second formulation that works, I can’t name the constraints nicely,
#results in key error on (u,ats)
@constraint(m,
q_unit_avail_timeseries[
(u,ats) in unit__avail_timeseries(),
(t,s) in T_S
],
+ v_ps[u,t,s]
<=
+ production_max(unit=u)*time_series_data(time_series=ats,t=t)
)
# works fine
for (u,ats) in unit__avail_timeseries(),(t,s) in T_S
@constraint(m,
+ v_ps[u,t,s]
<=
+ production_max(unit=u)*time_series_data(time_series=ats,t=t)
)
end
Edit: the error is as follows:
ERROR: LoadError: LoadError: KeyError: key (:NPV_1271_BAL_110, :PV_J) not found
Stacktrace:
[1] getindex at .\dict.jl:478 [inlined]
[2] lookup_index at .julia\packages\JuMP\jnmGG\src\Containers\DenseAxisArray.jl:120 [
inlined]
[3] _to_index_tuple(::Tuple{Tuple{Symbol,Symbol},Tuple{Int64,Int64}}, ::Tuple{Dict{Array{Symbol,1},
Int64},Dict{Any,Int64}}) at .julia\packages\JuMP\jnmGG\src\Containers\DenseAxisArray.j
l:129
[4] to_index at .julia\packages\JuMP\jnmGG\src\Containers\DenseAxisArray.jl:147 [inli
ned]
[5] setindex!(::JuMP.Containers.DenseAxisArray{ConstraintRef{Model,C,Shape} where Shape<:AbstractSh
ape where C,2,Tuple{Array{Array{Symbol,1},1},Array{Any,1}},Tuple{Dict{Array{Symbol,1},Int64},Dict{An
y,Int64}}}, ::ConstraintRef{Model,MathOptInterface.ConstraintIndex{MathOptInterface.ScalarAffineFunc
tion{Float64},MathOptInterface.LessThan{Float64}},ScalarShape}, ::Tuple{Symbol,Symbol}, ::Tuple{Int6
4,Int64}) at .julia\packages\JuMP\jnmGG\src\Containers\DenseAxisArray.jl:166
[6] top-level scope at .julia\packages\JuMP\jnmGG\src\macros.jl:621
[7] include at .\boot.jl:326 [inlined]
[8] include_relative(::Module, ::String) at .\loading.jl:1038
[9] include(::Module, ::String) at .\sysimg.jl:29
[10] include(::String) at .\client.jl:403
[11] top-level scope at *.jl:81
in expression starting at *constraints.jl:261
in expression starting at *.jl:67