Todo:
- use new functional primitives from CTModels.jl, most notably
constraint! with (only five types, see here):
:state for linear / range constraints on state
:control for linear / range constraints on control
:variable for linear / range constraints on variable
:boundary for noninear / function boundary constraints
:path for nonlinear / function path constraints
function constraint!(
ocp::PreModel,
type::Symbol;
rg::Union{OrdinalRange{<:Int},Nothing}=nothing,
f::Union{Function,Nothing}=nothing,
lb::Union{ctVector,Nothing}=nothing,
ub::Union{ctVector,Nothing}=nothing,
label::Symbol=__constraint_label(),
)
# set some constraints
f_path(r, t, x, u, v) = r .= x .+ u .+ v .+ t
f_boundary(r, x0, xf, v) = r .= x0 .+ v .* (xf .- x0)
f_variable(r, t, v) = r .= v .+ t
CTModels.constraint!(pre_ocp, :path; f=f_path, lb=[0, 1], ub=[1, 2], label=:path)
CTModels.constraint!(pre_ocp, :boundary; f=f_boundary, lb=[0, 1], ub=[1, 2], label=:boundary)
CTModels.constraint!(pre_ocp, :state; rg=1:2, lb=[0, 1], ub=[1, 2], label=:state_rg)
CTModels.constraint!(pre_ocp, :control; rg=1:2, lb=[0, 1], ub=[1, 2], label=:control_rg)
CTModels.constraint!(pre_ocp, :variable; rg=1:2, lb=[0, 1], ub=[1, 2], label=:variable_rg)
- check new interface of
time! (no more Index type):
julia> time!(ocp, t0=0, tf=1 ) # Fixed t0 and fixed tf
julia> time!(ocp, t0=0, indf=2) # Fixed t0 and free tf
julia> time!(ocp, ind0=2, tf=1 ) # Free t0 and fixed tf
julia> time!(ocp, ind0=2, indf=3) # Free t0 and free tf
- check this test for a complete example
- go fully
inplace
- what about scalar state / control declaration in the abstract form?
- prefix by
OptimalControl generated code (should allow import only!); can be CTModels during dev / test
@ocots feel free to add some caveat's
Todo:
constraint!with (only five types, see here)::statefor linear / range constraints on state:controlfor linear / range constraints on control:variablefor linear / range constraints on variable:boundaryfor noninear / function boundary constraints:pathfor nonlinear / function path constraintstime!(no moreIndextype):inplaceOptimalControlgenerated code (should allowimportonly!); can beCTModelsduring dev / test@ocots feel free to add some caveat's