OptimalControl.jl
The OptimalControl.jl package is part of the control-toolbox ecosystem.
Index
Available methods
using OptimalControl
available_methods()
(:direct, :adnlp, :ipopt)
(:direct, :adnlp, :madnlp)
(:direct, :adnlp, :knitro)
Documentation
Public
OptimalControl.OptimalControl
— ModuleOptimalControl
module.
Lists all the imported modules and packages:
Base
Core
DocStringExtensions
List of all the exported names:
*
Flow
Hamiltonian
HamiltonianLift
HamiltonianVectorField
@Lie
Lie
Lift
Model
ParsingError
Poisson
VectorField
available_methods
build_OCP_solution
constraint
control
control_components
control_dimension
control_name
costate
criterion
@def
direct_transcription
dynamics
export_ocp_solution
final_time
import_ocp_solution
infos
initial_time
iterations
lagrange
mayer
message
objective
set_initial_guess
solve
state
state_components
state_dimension
state_name
stopping
time_grid
time_name
variable
variable_components
variable_dimension
variable_name
⋅
CommonSolve.solve
— Methodsolve(ocp::Model, 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.
Private
OptimalControl.clean
— Methodclean(d::Tuple{Vararg{Symbol}}) -> Tuple{Vararg{Symbol}}
When calling the function solve
, the user can provide a description of the method to use to solve the optimal control problem. The description can be a partial description or a full description. The function solve
will find the best match from the available methods, thanks to the function getFullDescription
. Then, the description is cleaned by the function clean
to remove the Symbols that are specific to OptimalControl.jl and so must not be passed to the solver. For instance, the Symbol :direct
is specific to OptimalControl.jl and must be removed. It must not be passed to the CTDirect.jl solver.