CTDirect API
Index
CTDirect.available_methods
CTDirect.direct_solve
CTDirect.direct_transcription
CTDirect.is_solvable
CTDirect.set_initial_guess
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_solve
— Methoddirect_solve(
ocp::OptimalControlModel,
description::Symbol...;
display,
grid_size,
disc_method,
time_grid,
init,
adnlp_backend,
kwargs...
) -> OptimalControlSolution
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
CTDirect.direct_transcription
— Methoddirect_transcription(
ocp::OptimalControlModel,
description...;
grid_size,
disc_method,
time_grid,
init,
adnlp_backend,
solver_backend,
show_time,
matrix_free
) -> Tuple{CTDirect.DOCP, 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
CTBase
- [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.is_solvable
— Methodis_solvable(ocp) -> Bool
Check if an OCP is solvable by the method solve
.
CTDirect.set_initial_guess
— Methodset_initial_guess(docp::CTDirect.DOCP, nlp, init) -> Any
Set initial guess in the DOCP