OptimalControl.jl

The OptimalControl.jl package is part of the control-toolbox ecosystem.

flowchart TD O(<a href='https://control-toolbox.org/OptimalControl.jl/stable/api-optimalcontrol.html'>OptimalControl</a>) --> B(<a href='https://control-toolbox.org/OptimalControl.jl/stable/api-ctbase.html'>CTBase</a>) O --> D(<a href='https://control-toolbox.org/OptimalControl.jl/stable/api-ctdirect.html'>CTDirect</a>) O --> F(<a href='https://control-toolbox.org/OptimalControl.jl/stable/api-ctflows.html'>CTFlows</a>) F --> B D --> B style O fill:#FBF275

Index

For the developers, here are the private methods.

Available methods

using OptimalControl
available_methods()
(:direct, :adnlp, :ipopt)
(:direct, :adnlp, :madnlp)

Documentation

OptimalControl.OptimalControlModule
source
CommonSolve.solveMethod
solve(
    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.

Note

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))
Tip

For more information on how to provide the initial guess, see the tutorial on the initial guess.

source
OptimalControl.available_methodsMethod
available_methods(

) -> Tuple{Vararg{Tuple{Symbol, Symbol, Symbol}}}

Return the list of available methods that can be used to solve the optimal control problem.

source