Elimination of Errors in JuMP model

Give me suggestions for eliminating these errors please:

LoadError: MethodError: no method matching getindex(::Tuple{Pair{String,Tuple{String,String}},Pair{String,NTuple{11,String}},Pair{String,Tuple{String,String,String}},Pair{String,NTuple{6,String}},Pair{String,NTuple{5,String}},Pair{String,String},Pair{String,NTuple{7,String}},Pair{String,String},Pair{String,String},Pair{String,String},Pair{String,Tuple{String,String}},Pair{String,String},Pair{String,NTuple{8,String}},Pair{String,String}}, ::String)

Closest candidates are:

getindex(::Tuple, !Matched::Int64) at tuple.jl:24

getindex(::Tuple, !Matched::Real) at tuple.jl:25

getindex(::Tuple, !Matched::AbstractUnitRange{#s69} where #s69<:Real) at range.jl:290

in expression starting at C:\Users\mmill\AppData\Local\JuliaPro-1.0.5-2\problem3.jl:266

(::var"#248#254")(::String, ::String) at macro.jl:152

first_iterate(::Tuple{var"#248#254",var"#249#255",var"#250#256"}, ::Function, ::Tuple{String,String}, ::Tuple{Tuple{Array{String,1},Int64,String},Tuple{Array{String,1},Int64,String}}) at nested_iterator.jl:57

next_iterate(::Tuple{var"#247#253",var"#248#254",var"#249#255",var"#250#256"}, ::Function, ::Tuple{String}, ::Tuple{Tuple{Array{String,1},Int64,String}}, ::Array{String,1}, ::Tuple{String,Int64}) at nested_iterator.jl:41

first_iterate(::Tuple{var"#247#253",var"#248#254",var"#249#255",var"#250#256"}, ::Function, ::Tuple{String}, ::Tuple{Tuple{Array{String,1},Int64,String}}) at nested_iterator.jl:58

next_iterate(::Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"}, ::Function, ::Tuple{}, ::Tuple{}, ::Array{String,1}, ::Tuple{String,Int64}) at nested_iterator.jl:41

first_iterate(::Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"}, ::Function, ::Tuple{}, ::Tuple{}) at nested_iterator.jl:58

iterate at nested_iterator.jl:69 [inlined]

iterate at generator.jl:44 [inlined]

grow_to!(::JuMP.Containers.NoDuplicateDict{Any,Any}, ::Base.Generator{JuMP.Containers.NestedIterator{Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"},JuMP.Containers.var"#20#22"},JuMP.Containers.var"#30#31"{var"#245#251"}}) at dict.jl:139

dict_with_eltype at abstractdict.jl:549 [inlined]

JuMP.Containers.NoDuplicateDict(::Base.Generator{JuMP.Containers.NestedIterator{Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"},JuMP.Containers.var"#20#22"},JuMP.Containers.var"#30#31"{var"#245#251"}}) at no_duplicate_dict.jl:39

container(::Function, ::JuMP.Containers.NestedIterator{Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"},JuMP.Containers.var"#20#22"}, ::Type{JuMP.Containers.SparseAxisArray}) at container.jl:96

container(::Function, ::JuMP.Containers.NestedIterator{Tuple{var"#246#252",var"#247#253",var"#248#254",var"#249#255",var"#250#256"},JuMP.Containers.var"#20#22"}) at container.jl:65

top-level scope at macros.jl:79

Best,
Marco

The code would help here, at least the line mentioned by the error.

  1. The MethodError with getindex is probably because you are trying to index your Tuple with a String instead of a number. The message is hard do read because the type you are using is very complex.
  2. You did not post the error message for the second error, just the stacktrace?
  1. Thank you Henrique. You mean on this “The sequence of values stored in a tuple can be of any type, and they are indexed by integers.”?
  2. That is actually the only mistake I have.
  1. Yes. The tuple can store a sequence of different types (often a shorter sequence than yours), and the fields are often indexed by an integer, like arrays. getindex(a, b) is the method called by a[b], and it says you are calling it with a Tuple and a String, instead of a Tuple and an integer (or real, or range).
  2. Ah, ok, I thought that after the three dots you wanted to paste a second error, but it was only the continuation of the stacktrace then.

Excellent, much clearer now where the problem is. Thanks!