OptimalControl API
Index
Available methods
using OptimalControl
available_methods()(:direct, :adnlp, :ipopt)
Documentation
OptimalControl.OptimalControl — ModuleOptimalControl module.
Lists all the imported modules and packages:
BaseCTBaseCTDirectCTFlowsCTProblemsCoreDocStringExtensions
List of all the exported names:
*AutonomousControlConstraintControlLawFeedbackControlFixedFlowHamiltonianHamiltonianLiftHamiltonianVectorFieldIndex@LieLieLiftMixedConstraintModelMultiplierNonAutonomousNonFixedParsingErrorPoissonProblem@ProblemsProblems@ProblemsDescriptionsProblemsDescriptionsStateConstraintVectorFieldavailable_methodsconstraintconstraint!control!ct_repl@defdynamics!is_maxis_minis_time_dependentis_time_independentis_variable_dependentis_variable_independentobjective!plotplot!remove_constraint!solvestate!time!variable!∂ₜ⋅
OptimalControl.available_methods — Methodavailable_methods() -> Tuple{Tuple{Vararg{Symbol}}}
Return the list of available methods to solve the optimal control problem.
OptimalControl.solve — Methodsolve(
ocp::OptimalControlModel,
description::Symbol...;
display,
init,
kwargs...
) -> Union{Nothing, OptimalControlSolution}
Solve the the optimal control problem ocp by the method given by the (optional) description.
The (optional) description
You can pass a partial description. If you give a partial description, then, if several complete descriptions contains the partial one, then, the method with the highest priority is chosen. The higher in the list, the higher is the priority.
Keyword arguments:
display: print or not information during the resolutioninit: an initial condition for the solver
There is only one available method for the moment: a direct method which transforms the optimal control problem into a nonlinear programming problem (NLP) solved by Ipopt, thanks to the package ADNLPModels. The direct method comes from the CTDirect package.
- To see the list of available methods, simply call
available_methods(). - You can pass any other option by a pair
keyword=valueaccording to the chosen method.
Examples
julia> sol = solve(ocp)
julia> sol = solve(ocp, :direct)
julia> sol = solve(ocp, :direct, :ipopt)
julia> sol = solve(ocp, :direct, :ipopt, display=false)
julia> sol = solve(ocp, :direct, :ipopt, display=false, init=sol)
julia> sol = solve(ocp, init=(state=[-0.5, 0.2],))
julia> sol = solve(ocp, init=(state=[-0.5, 0.2], control=0.5))
julia> sol = solve(ocp, init=(state=[-0.5, 0.2], control=0.5, variable=[1, 2]))
julia> sol = solve(ocp, init=(state=[-0.5, 0.2], control=t->6-12*t))
julia> sol = solve(ocp, init=(state=t->[-1+t, t*(t-1)], control=0.5))
julia> sol = solve(ocp, init=(state=t->[-1+t, t*(t-1)], control=t->6-12*t))