You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user contacted me with the following "feature." It's not clear what we should do, or how hard it would be to fix, but the error message is very unhelpful.
Potentially, the macros could look at the indices and compare against the model symbol?
model =Model()
@variable(model, x[model =1:10] >=1)
# results in
ERROR: MethodError: no method matching add_variable(::Int64, ::ScalarVariable{Int64,Float64,Float64,Float64}, ::String)
Closest candidates are:add_variable(::Model, ::ScalarVariable, ::String) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/variables.jl:792add_variable(::Model, ::ScalarVariable) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/variables.jl:792add_variable(::Model, ::VariableConstrainedOnCreation, ::String) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/variables.jl:857...
Stacktrace:
[1] (::getfield(Main, Symbol("##13#14")))(::Int64) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/Containers/macro.jl:183
[2] (::getfield(JuMP.Containers, Symbol("##26#27")){getfield(Main, Symbol("##13#14"))})(::Tuple{Int64}) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/Containers/container.jl:70
[3] iterate at ./generator.jl:47 [inlined]
[4] collect(::Base.Generator{JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}},getfield(JuMP.Containers, Symbol("##26#27")){getfield(Main, Symbol("##13#14"))}}) at ./array.jl:606
[5] map(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}}) at ./abstractarray.jl:2044
[6] container at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/Containers/container.jl:70 [inlined]
[7] container(::Function, ::JuMP.Containers.VectorizedProductIterator{Tuple{Base.OneTo{Int64}}}) at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/Containers/container.jl:65
[8] top-level scope at /Users/oscar/.julia/packages/JuMP/CZ8vV/src/macros.jl:79
This is also a problem in constraints as well
model =Model()
@variable(model, x[1:10])
@constraint(model, [model =1:10], x[model] <=1)
The text was updated successfully, but these errors were encountered:
A user contacted me with the following "feature." It's not clear what we should do, or how hard it would be to fix, but the error message is very unhelpful.
Potentially, the macros could look at the indices and compare against the model symbol?
This is also a problem in constraints as well
The text was updated successfully, but these errors were encountered: