OptimalControl.jl
The OptimalControl.jl package is part of the control-toolbox ecosystem.
Index
For the developers, here are the private methods.
Available methods
using OptimalControl
available_methods()
(:direct, :adnlp, :ipopt)
(:direct, :adnlp, :madnlp)
Documentation
OptimalControl.OptimalControl
— ModuleOptimalControl
module.
Lists all the imported modules and packages:
Base
CTBase
CTDirect
CTFlows
Core
DocStringExtensions
List of all the exported names:
*
Autonomous
Fixed
Flow
Hamiltonian
HamiltonianLift
HamiltonianVectorField
@Lie
Lie
Lift
Model
NonAutonomous
NonFixed
OptimalControlModel
OptimalControlSolution
ParsingError
Poisson
VectorField
__OCPModel
available_methods
constraint
constraint!
control
control!
costate
ct_repl
ct_repl_update_model
@def
direct_transcription
dynamics!
export_ocp_solution
import_ocp_solution
infos
iterations
load
message
objective
objective!
remove_constraint!
save
set_initial_guess
solve
state
state!
stopping
time!
time_grid
variable
variable!
∂ₜ
⋅
CommonSolve.solve
— Methodsolve(
ocp::OptimalControlModel,
description::Symbol...;
kwargs...
)
Solve the the optimal control problem ocp
by the method given by the (optional) description. The available methods are given by available_methods()
. The higher in the list, the higher is the priority. The keyword arguments are specific to the chosen method and represent the options of the solver.
See the tutorial on solving optimal control problems for more information.
Arguments
ocp::OptimalControlModel
: the optimal control problem to solve.description::Symbol...
: the description of the method to use to solve the problem.kwargs...
: the options of the solver.
Examples
The simplest way to solve the optimal control problem is to call the function without any argument.
julia> sol = solve(ocp)
The method can be specified by passing the description as a Symbol. You can provide a partial description, the function will find the best match.
julia> sol = solve(ocp, :direct)
The method can be specified by passing the full description as a list of Symbols.
julia> sol = solve(ocp, :direct, :adnlp, :ipopt)
The keyword arguments are specific to the chosen method and represent the options of the solver. For example, the keyword display
is used to display the information of the solver. The default value is true
.
julia> sol = solve(ocp, :direct, :ipopt, display=false)
The initial guess can be provided by the keyword init
. You can provide the initial guess for the state, control, and variable.
julia> sol = solve(ocp, init=(state=[-0.5, 0.2], control=0.5))
For more information on how to provide the initial guess, see the tutorial on the initial guess.
OptimalControl.available_methods
— Methodavailable_methods(
) -> Tuple{Vararg{Tuple{Symbol, Symbol, Symbol}}}
Return the list of available methods that can be used to solve the optimal control problem.