Closed codercahol closed 4 months ago
If you update to JuMP v1.20, the second example works:
julia> model = Model();
julia> a = Vector{NonlinearExpr}(undef, 3)
3-element Vector{NonlinearExpr}:
#undef
#undef
#undef
julia> a[1] = @expression(model, 0.0)
0.0
julia> a
3-element Vector{NonlinearExpr}:
+(0.0)
#undef
#undef
I fixed this a few weeks ago: https://github.com/jump-dev/JuMP.jl/pull/3672
But the Vector{Any}
is probably a good choice, unless you have evidence showing that it is slow.
p.s., you can ask questions like this on the forum: https://jump.dev/forum
Closing as fixed. If you have follow-up questions, please use the forum and we can chat there :smile:
ok thanks!
I have an array of nonlinear differentials (
a
, in the example below) that I use as part of an Euler integration step in finding an optimal trajectory. In some cases, one of the differentials is 0, but I haven't been able to figure out how to add it to the vectorCode for reproducing:
I've also tried
and
I have it working with
a = Vector{Any}
, but I expect there is a better solution