Solve
Index
Documentation
CTDirect.available_methods
— Methodavailable_methods(
) -> Tuple{Tuple{Symbol, Symbol}, Tuple{Symbol, Symbol}, Tuple{Symbol, Symbol}}
Return the list of available methods to solve the optimal control problem.
CTDirect.direct_transcription
— Methoddirect_transcription(
ocp::CTModels.Model,
description...;
grid_size,
disc_method,
time_grid,
init,
adnlp_backend,
solver_backend,
show_time,
matrix_free
) -> Tuple{CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}, ADNLPModels.ADNLPModel{Float64, Vector{Float64}, Vector{Int64}}}
Discretize an optimal control problem into a nonlinear optimization problem (ie direct transcription)
Arguments
- ocp: optimal control problem as defined in
CTModels
- [description]: can specifiy for instance the NLP model and / or solver (:ipopt, :madnlp or :knitro)
Keyword arguments (optional)
grid_size
: number of time steps for the discretized problem ([250])disc_method
: discretization method ([:trapeze
],:euler
,:euler_implicit
,:midpoint
,gauss_legendre_2
,gauss_legendre_3
)time_grid
: explicit time grid (can be non uniform)init
: info for the starting guess (values as named tuple or existing solution)adnlp_backend
: backend for automatic differentiation in ADNLPModels ([:optimized
],:manual
,:default
)- show_time: (:true, [:false]) show timing details from ADNLPModels
CTDirect.set_initial_guess
— Methodset_initial_guess(docp::CTDirect.DOCP, nlp, init) -> Any
Set initial guess in the DOCP
CTDirect.solve
— Methodsolve(
ocp::CTModels.Model,
description::Symbol...;
display,
grid_size,
disc_method,
time_grid,
init,
adnlp_backend,
kwargs...
) -> CTModels.Solution{TimeGridModelType, TimesModelType, StateModelType, ControlModelType, VariableModelType, CostateModelType, Float64, DualModelType, CTModels.SolverInfos{Dict{Symbol, Any}}, ModelType} where {TimeGridModelType<:CTModels.TimeGridModel, TimesModelType<:CTModels.TimesModel, StateModelType<:Union{CTModels.StateModelSolution{TS} where TS<:CTModels.var"#114#136", CTModels.StateModelSolution{TS} where TS<:CTModels.var"#115#137"}, ControlModelType<:Union{CTModels.ControlModelSolution{TS} where TS<:CTModels.var"#116#138", CTModels.ControlModelSolution{TS} where TS<:CTModels.var"#117#139"}, VariableModelType<:Union{CTModels.VariableModelSolution{Vector{Float64}}, CTModels.VariableModelSolution{Float64}}, CostateModelType<:Union{CTModels.var"#118#140", CTModels.var"#119#141"}, DualModelType<:(CTModels.DualModel{PC_Dual, Vector{Float64}, SC_LB_Dual, SC_UB_Dual, CC_LB_Dual, CC_UB_Dual, Vector{Float64}, Vector{Float64}} where {PC_Dual<:Union{CTModels.var"#121#143"{CTModels.var"#120#142"}, CTModels.var"#122#144"{CTModels.var"#120#142"}}, SC_LB_Dual<:Union{CTModels.var"#124#146"{CTModels.var"#123#145"}, CTModels.var"#125#147"{CTModels.var"#123#145"}}, SC_UB_Dual<:Union{CTModels.var"#127#149"{CTModels.var"#126#148"}, CTModels.var"#128#150"{CTModels.var"#126#148"}}, CC_LB_Dual<:Union{CTModels.var"#130#152"{CTModels.var"#129#151"}, CTModels.var"#131#153"{CTModels.var"#129#151"}}, CC_UB_Dual<:Union{CTModels.var"#133#155"{CTModels.var"#132#154"}, CTModels.var"#134#156"{CTModels.var"#132#154"}}}), ModelType<:CTModels.Model}
Solve an OCP with a direct method
Arguments
- ocp: optimal control problem as defined in
CTBase
- [description]: can specifiy for instance the NLP model and / or solver (:ipopt, :madnlp or :knitro)
Keyword arguments (optional)
display
: ([true], false) will disable output if set to falsegrid_size
: number of time steps for the discretized problem ([250])disc_method
: discretization method ([:trapeze
],:midpoint
,gauss_legendre_2
)time_grid
: explicit time grid (can be non uniform)init
: info for the starting guess (values or existing solution)adnlp_backend
: backend for automatic differentiation in ADNLPModels ([:optimized
],:manual
,:default
)
All further keywords are passed to the inner call of solve_docp