-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Broadcasting over multiple DenseAxisArrays #2267
Comments
See the set_start_value.(all_variables(model), value.(all_variables(model))) Unfortunately, broadcasting over multiple using JuMP
S = [:a, :b]
model = Model()
@variable(model, x[S], start = 0.0)
set_start_value.(x, start_value.(x))
ERROR: Broadcast operations with multiple DenseAxisArrays are not yet supported.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] broadcasted(::JuMP.Containers.DenseAxisArrayBroadcastStyle, ::Function, ::JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{Array{Symbol,1}},Tuple{Dict{Symbol,Int64}}}, ::JuMP.Containers.DenseAxisArray{Float64,1,Tuple{Array{Symbol,1}},Tuple{Dict{Symbol,Int64}}}) at /Users/oscar/.julia/packages/JuMP/YXK4e/src/Containers/DenseAxisArray.jl:249
[3] broadcasted(::Function, ::JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{Array{Symbol,1}},Tuple{Dict{Symbol,Int64}}}, ::JuMP.Containers.DenseAxisArray{Float64,1,Tuple{Array{Symbol,1}},Tuple{Dict{Symbol,Int64}}}) at ./broadcast.jl:1237
[4] top-level scope at REPL[21]:1 As a work-around, you can go using JuMP
S = [:a, :b]
model = Model()
@variable(model, x[S], start = 0.0)
for i in eachindex(x)
set_start_value(x[i], start_value(x[i]))
end |
Can the error message improved in this case? using JuMP
S = [:a, :b]
model = Model()
@variable(model, x[S], start = 0.0)
set_start_value.(x, [0.0 1.0]) If the error message for this case could mention broadcasting, it would be helpful.
|
This is a tricky one that we haven't really addressed: people want a At the very least, it deserves a better error message. |
While trying to set up the initial point for a problem, the following problem occur.
no method matching set_start_value(::JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{Array{String,1}},Tuple{Dict{String,Int64}}}, ::JuMP.Containers.DenseAxisArray{Float64,1,Tuple{Array{String,1}},Tuple{Dict{String,Int64}}})
In attach a sample of the code
report_error.txt
The text was updated successfully, but these errors were encountered: