This is a great idea. I tried to define another state like this
dx[5] = :(1.0)
But I get the following error:
MethodError: Cannot `convert` an object of type Float64 to an object of type Expr
This may have arisen from a call to the constructor Expr(...),
since type constructors fall back to convert methods.
Stacktrace:
[1] setindex!(::Array{Expr,1}, ::Float64, ::Int64) at ./array.jl:578
[2] include_string(::String, ::String) at ./loading.jl:522
I tried e.g. converting to an Abstract type
dx[5] = :(convert(Real, 1.0))
and this if fine, but then when I do configure
I get
julia> configure!(n;(:Nck=>[50]),(:finalTimeDV=>false), (:tf=>tplan))
Unrecognized function "convert" used in nonlinear expression.
Stacktrace:
[1] macro expansion at /Users/roi/.julia/v0.6/JuMP/src/parsenlp.jl:96 [inlined]
[2] macro expansion at /Users/roi/.julia/v0.6/JuMP/src/macros.jl:1412 [inlined]
[3] macro expansion at /Users/roi/.julia/v0.6/NLOptControl/src/diffeq.jl:87 [inlined]
[4] anonymous at ./<missing>:?
[5] NLExpr(::NLOptControl.NLOpt, ::Expr, ::Array{Any,2}, ::Vararg{Any,N} where N) at /Users/roi/.julia/v0.6/NLOptControl/src/diffeq.jl:89
[6] DiffEq(::NLOptControl.NLOpt, ::Array{Any,2}, ::Array{Any,2}, ::Int64, ::Int64) at /Users/roi/.julia/v0.6/NLOptControl/src/diffeq.jl:36
[7] OCPdef!(::NLOptControl.NLOpt) at /Users/roi/.julia/v0.6/NLOptControl/src/setup.jl:305
[8] #configure!#52(::Array{Any,1}, ::Function, ::NLOptControl.NLOpt) at /Users/roi/.julia/v0.6/NLOptControl/src/setup.jl:474
[9] (::NLOptControl.#kw##configure!)(::Array{Any,1}, ::NLOptControl.#configure!, ::NLOptControl.NLOpt) at ./<missing>:0
[10] anonymous at ./<missing>:?
[11] include_string(::String, ::String) at ./loading.jl:522
So I am not sure how to implement this.