API

OptimalControlProblems

OptimalControlProblems.metadataConstant

metadata::Dict()

Dictionary containing metadata for all available optimal control problems.

The following keys are valid:

  • name::String: the problem name.
  • N::Int: the default number of steps.
  • minimise::Bool: indicates whether the objective function is minimised (true) or maximised (false).
  • state_name::Vector{String}: names of the state components.
  • costate_name::Vector{String}: names of the differential constraints to obtain the costate (dual variables associated with the differential constraints).
  • control_name::Vector{String}: names of the control components.
  • variable_name::Union{Vector{String},Nothing}: names of the optimisation variables, or nothing if no such variable exists.
  • final_time::Tuple{Symbol, Union{Float64, Int}}: of the form (type, value_or_index), where:
    • type is either :fixed or :free.
    • value_or_index is the index in variable if the final time is free, or its value if it is fixed.

Example

julia> metadata[:my_problem][:name]
"My Problem"
source
OptimalControlProblems.JuMPBackendType
struct JuMPBackend <: OptimalControlProblems.AbstractModelBackend

Back-end for modelling optimal control problems using the JuMP optimisation framework.

source
CTModels.controlMethod
control(
    _::Symbol,
    model
) -> Union{JuMPModels.var"#608#610", JuMPModels.var"#609#611"}

Retrieve the control trajectory from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> control(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
CTModels.costateMethod
costate(
    _::Symbol,
    model
) -> Union{JuMPModels.var"#613#616", JuMPModels.var"#614#617"}

Retrieve the costate (adjoint variables) from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> costate(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
CTModels.iterationsMethod
iterations(_::Symbol, model) -> Any

Retrieve the number of iterations from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> iterations(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
CTModels.stateMethod
state(
    _::Symbol,
    model
) -> Union{JuMPModels.var"#604#606", JuMPModels.var"#605#607"}

Retrieve the state trajectory from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> state(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
CTModels.time_gridMethod
time_grid(_::Symbol, model) -> Any

Retrieve the discretised time grid from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> time_grid(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
ExaModels.objectiveMethod
objective(_::Symbol, model) -> Any

Retrieve objective value from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> objective(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
ExaModels.variableMethod
variable(_::Symbol, model) -> Any

Retrieve optimisation variables from a JuMP model.

Arguments

  • ::Symbol: Problem name.
  • model: JuMP model object.

Returns

  • Throws ExtensionError(:JuMP) since JuMP support must be extended.

Example

julia> variable(:problem1, model)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.beamMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem beam for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> beam(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.bioreactorMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem bioreactor for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> bioreactor(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.cart_pendulumMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem cart_pendulum for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> cart_pendulum(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.chainMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem chain for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> chain(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.dielectrophoretic_particleMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem dielectrophoretic_particle for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> dielectrophoretic_particle(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.double_oscillatorMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem double_oscillator for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> double_oscillator(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.ducted_fanMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem ducted_fan for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> ducted_fan(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.electric_vehicleMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem electric_vehicle for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> electric_vehicle(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.final_time_dataMethod
final_time_data(problem::Symbol) -> Any

Return the fixed final time, from the metadata, associated with a given optimal control problem.

Arguments

  • problem::Symbol: The name of the problem, used as a key in the global metadata dictionary.

Returns

  • Float64: The fixed final time of the specified problem.

Example

julia> final_time_data(:beam)
10.0
source
OptimalControlProblems.gliderMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem glider for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> glider(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.insuranceMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem insurance for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> insurance(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.jacksonMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem jackson for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> jackson(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.moonlanderMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem moonlander for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> moonlander(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.problemsMethod
problems() -> Vector{Symbol}

Returns the list of available optimal control problems.

Returns

  • Vector{Symbol}: A vector of problem names as symbols.

Example

julia> OptimalControlProblems.problems()
[:problem1, :problem2, :problem3]
source
OptimalControlProblems.robbinsMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem robbins for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> robbins(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.robotMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem robot for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> robot(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.rocketMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem rocket for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> rocket(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.space_shuttleMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem space_shuttle for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> space_shuttle(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.steeringMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem steering for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> steering(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.steps_number_dataMethod
steps_number_data(problem::Symbol) -> Any

Return the number of discretisation steps, from the metadata, for a given optimal control problem.

Arguments

  • problem::Symbol: The name of the problem, used as a key in the global metadata dictionary.

Returns

  • Int: The number of discretisation steps (N) of the specified problem.

Example

julia> steps_number_data(:beam)
500
source
OptimalControlProblems.truck_trailerMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem truck_trailer for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> truck_trailer(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source
OptimalControlProblems.vanderpolMethod

DocStringExtensions.TypedMethodSignatures()

Defines the optimal control problem vanderpol for a given back-end.

Arguments

  • model_backend::T: The modelling back-end, subtype of AbstractModelBackend.
  • N::Int=0: Number of discretisation steps (optional).

Returns

  • Throws an ExtensionError if the required back-end is not available.

Example

julia> vanderpol(JuMPBackend(); N=20)
ERROR: ExtensionError(:JuMP)
source

OptimalControlModels

    OptimalControlProblems.beamMethod
    beam(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing the Beam problem using the OptimalControl backend. The function sets up the state and control variables, boundary conditions, dynamics, path constraints, and the objective functional. It then performs direct transcription to generate a discrete optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type to specify the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object, representing the discretised problem.
    • nlp: The corresponding nonlinear programming model generated from the DOCP, ready for solver input.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.beam(OptimalControlBackend(); N=100);

    References

    • BOCOP repository: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.bioreactorMethod
    bioreactor(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing the Bioreactor problem. The function defines the state and control variables, boundary conditions, path constraints, growth and light dynamics, and an objective functional. It performs direct transcription to create a discretised optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the discretised Bioreactor problem.
    • nlp: The corresponding nonlinear programming model generated from the DOCP, ready for solver input.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.bioreactor(OptimalControlBackend(); N=100);

    References

    • BOCOP repository: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.cart_pendulumMethod
    cart_pendulum(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing the Cart-Pendulum system. The function defines state and control variables, boundary conditions, path constraints, and system dynamics, with the objective of swinging the pendulum from the downward position to the upright position in minimum time. It performs direct transcription to produce a discretised optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the discretised Cart-Pendulum problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.cart_pendulum(OptimalControlBackend(); N=100);

    References

    • Formulation inspired by OptimalControl approach for swing-up control problems.
    source
    OptimalControlProblems.chainMethod
    chain(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing the Hanging Chain problem. The function defines state and control variables, boundary conditions, and system dynamics, with the objective of minimising the vertical displacement of the chain's midpoint. It performs direct transcription to produce a discretised optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the discretised Hanging Chain problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.chain(OptimalControlBackend(); N=100);

    References

    • Formulation inspired by OptimalControl approach to variational problems and chain equilibrium.
    • Original problem source: BOCOP repository
    source
    OptimalControlProblems.dielectrophoretic_particleMethod
    dielectrophoretic_particle(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing a dielectrophoretic particle system. The function defines state and control variables, boundary conditions, and system dynamics, aiming to minimise the travel time of the particle between two points. It performs direct transcription to produce a discretised optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the dielectrophoretic particle problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.dielectrophoretic_particle(OptimalControlBackend(); N=100);

    References

    • Chang, D. E., Petit, N., & Rouchon, P. (2006). Time-optimal control of a particle in a dielectrophoretic system. IEEE Transactions on Automatic Control, 51(7), 1100-1114. [CPR2006]
    • Formulation inspired by OptimalControl approach to time-optimal trajectory problems.
    source
    OptimalControlProblems.double_oscillatorMethod
    double_oscillator(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem representing a double oscillator system. The function defines state and control variables, system dynamics, boundary conditions, and an objective functional to be minimised. It uses direct transcription to produce a discretised optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the double oscillator system.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.double_oscillator(OptimalControlBackend(); N=100);

    References

    • Coudurier, C., Lepreux, O., & Petit, N. (2018). Optimal bang-bang control of a mechanical double oscillator using averaging methods. IFAC-PapersOnLine, 51(2), 49-54. [CLP2018]
    • Formulation follows OptimalControl approach to mechanical oscillator trajectory optimisation.
    source
    OptimalControlProblems.ducted_fanMethod
    ducted_fan(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for a planar ducted fan system. The function defines state and control variables, system dynamics, boundary conditions, and a cost functional combining control effort and final time. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=250: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the planar ducted fan.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.ducted_fan(OptimalControlBackend(); N=250);

    References

    • Graichen, K., & Petit, N. (2009). Incorporating a class of constraints into the dynamics of optimal control problems. Optimal Control Applications and Methods, 30(6), 537-561. [GP2009]
    • Problem instance follows OptimalControl formulation for ducted fan trajectory optimisation.
    source
    OptimalControlProblems.electric_vehicleMethod
    electric_vehicle(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for an electric vehicle trajectory. The function defines state and control variables, vehicle dynamics, boundary conditions, and a cost functional representing energy and control effort. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the electric vehicle trajectory optimisation.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.electric_vehicle(OptimalControlBackend(); N=500);

    References

    • Nicolas Petit and Antonio Sciarretta. "Optimal drive of electric vehicles using an inversion-based trajectory generation approach." IFAC Proceedings Volumes 44, no. 1 (2011): 14519-14526. [PS2011]
    • Problem instance follows OptimalControl formulation for electric vehicle trajectory optimisation.
    source
    OptimalControlProblems.gliderMethod
    glider(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for a hang glider trajectory. The function defines state and control variables, glider dynamics in a thermal updraft, boundary conditions, and a cost functional aiming to maximise the final horizontal position. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the hang glider trajectory optimisation.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.glider(OptimalControlBackend(); N=500);

    References

    • Original formulation from MadNLP/COPSBenchmark.
    • Problem inspired by glider dynamics with thermal updraft and lift modelling.
    source
    OptimalControlProblems.insuranceMethod
    insurance(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for an insurance system optimisation. The function defines state and control variables, system dynamics, constraints on insurance, expenses, revenue, health, utility, and auxiliary variables, and sets up a cost functional aimed at maximising expected utility over time. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the insurance optimisation problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.insurance(OptimalControlBackend(); N=500);

    References

    source
    OptimalControlProblems.jacksonMethod
    jackson(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Jackson benchmark model. The function sets up state and control variables, system dynamics, bounds, initial and final conditions, and a cost functional aimed at minimising the third state variable at final time. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Jackson problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.jackson(OptimalControlBackend(); N=500);

    References

    source
    OptimalControlProblems.moonlanderMethod
    moonlander(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Moonlander benchmark model. The function defines the state and control variables, system dynamics, bounds, initial and final conditions, and the cost functional, which minimises the landing time of a moonlander to a specified target. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Moonlander problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.moonlander(OptimalControlBackend(); N=500);
    source
    OptimalControlProblems.robbinsMethod
    robbins(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Robbins benchmark model. This function defines the state and control variables, system dynamics, initial and final conditions, and the cost functional, which minimises a weighted sum of the state and control contributions. It returns both a discretised direct optimal control problem (DOCP) and the corresponding nonlinear programming (NLP) model. Reference: Robbins Problem on BOCOP

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Robbins problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.robbins(OptimalControlBackend(); N=500);
    source
    OptimalControlProblems.robotMethod
    robot(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for a robotic arm moving between two points. This function defines the state and control variables, system dynamics, initial and final conditions, and the cost functional, which minimises the total time taken to perform the motion. Reference: Robot arm problem on BOCOP here

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=250: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the robot arm problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.robot(OptimalControlBackend(); N=250);
    source
    OptimalControlProblems.rocketMethod
    rocket(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Goddard rocket. This function defines the state variables (altitude, velocity, mass), the control variable (thrust), system dynamics, constraints, initial and final conditions, and the cost functional, which maximises the final altitude. Reference: Goddard Rocket Problem here

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Goddard rocket problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.rocket(OptimalControlBackend(); N=500);
    source
    OptimalControlProblems.space_shuttleMethod
    space_shuttle(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Space Shuttle reentry trajectory. This function defines the state variables (altitude, longitude, latitude, velocity, flight path angle, azimuth), the control variables (angle of attack, bank angle), system dynamics, constraints, initial and terminal conditions, and the cost functional, which maximises the latitude (cross range) at the terminal point. Reference: Original JuMP model formulation here. Note: No heating limit path constraint is included.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Space Shuttle reentry trajectory.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.space_shuttle(OptimalControlBackend(); N=500);
    source
    OptimalControlProblems.steeringMethod
    steering(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for steering a particle along a trajectory. The objective is to minimise the total time taken to reach a specified terminal state, subject to control limits and particle dynamics. The state vector has four components, and the control is a single scalar input.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the particle steering problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.steering(OptimalControlBackend(); N=500);
    source
    OptimalControlProblems.truck_trailerMethod
    truck_trailer(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for a truck with two trailers, starting horizontally aligned. The objective is to minimise the total time required to park the truck and trailers such that they are aligned vertically at a specified target location, while respecting vehicle dynamics and control constraints. The problem includes path constraints for articulation angles between the trailers.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=200: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the truck-trailer parking problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.truck_trailer(OptimalControlBackend(); N=200);
    source
    OptimalControlProblems.vanderpolMethod
    vanderpol(
        ::OptimalControlBackend,
        description::Symbol...;
        N,
        kwargs...
    ) -> CTDirect.DOCP{_A, CTModels.Model{TD, TimesModelType, StateModelType, ControlModelType, VariableModelType, DynamicsModelType, ObjectiveModelType, ConstraintsModelType, BuildExaModelType}} where {_A<:CTDirect.Discretization, TD<:CTModels.TimeDependence, TimesModelType<:CTModels.AbstractTimesModel, StateModelType<:CTModels.AbstractStateModel, ControlModelType<:CTModels.AbstractControlModel, VariableModelType<:CTModels.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.AbstractObjectiveModel, ConstraintsModelType<:CTModels.AbstractConstraintsModel, BuildExaModelType<:Union{Nothing, Function}}
    

    Constructs an OptimalControl problem for the Van der Pol oscillator with a control input. The objective is to minimise a quadratic cost composed of the state and control effort over a fixed time horizon. The problem formulation can be found here.

    Arguments

    • ::OptimalControlBackend: Placeholder type specifying the OptimalControl backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation points for the direct transcription grid.

    Returns

    • docp: The direct optimal control problem object representing the Van der Pol problem.
    • nlp: The corresponding nonlinear programming model obtained from the DOCP, suitable for numerical optimisation.

    Example

    julia> using OptimalControlProblems
    
    julia> docp = OptimalControlProblems.vanderpol(OptimalControlBackend(); N=500);
    source

    JuMPModels

    CTModels.controlMethod
    control(
        problem::Symbol,
        model::GenericModel
    ) -> Union{JuMPModels.var"#608#610", JuMPModels.var"#609#611"}
    

    Extract and interpolate the control trajectory from a JuMP model of an optimal control problem.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Returns

    • fu::Function: A function of continuous time returning the interpolated control. If the control is scalar, the function returns a scalar; otherwise, a vector.

    Example

    julia> u = OptimalControlProblems.control(:my_problem, model)
    julia> u(0.25)
    0.42
    source
    CTModels.costateMethod
    costate(
        problem::Symbol,
        model::GenericModel
    ) -> Union{JuMPModels.var"#613#616", JuMPModels.var"#614#617"}
    

    Extract and interpolate the costate trajectory (dual variables associated with states) from a JuMP model of an optimal control problem.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Returns

    • fp::Function: A function of continuous time returning the interpolated costate. If the costate is scalar, the function returns a scalar; otherwise, a vector.

    Example

    julia> p = OptimalControlProblems.costate(:my_problem, model)
    julia> p(0.75)
    [-0.12, 0.05]
    source
    CTModels.iterationsMethod
    iterations(_::Symbol, model::GenericModel) -> Any
    

    Get the number of iterations from a JuMP model.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Example

    julia> OptimalControlProblems.iterations(:my_problem, model)
    20
    source
    CTModels.stateMethod
    state(
        problem::Symbol,
        model::GenericModel
    ) -> Union{JuMPModels.var"#604#606", JuMPModels.var"#605#607"}
    

    Extract and interpolate the state trajectory from a JuMP model of an optimal control problem.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Returns

    • fx::Function: A function of continuous time returning the interpolated state. If the state is scalar, the function returns a scalar; otherwise, a vector.

    Example

    julia> x = OptimalControlProblems.state(:my_problem, model)
    julia> x(0.5)
    [0.23, 0.71]
    source
    CTModels.time_gridMethod
    time_grid(problem::Symbol, model::GenericModel) -> Any
    

    Compute the discretised time grid for a given optimal control problem solved with JuMP.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Returns

    • t_jp::AbstractVector{Float64}: A vector of time points spanning from initial time t0 = 0 to the final time tf.

    Example

    julia> tgrid = OptimalControlProblems.time_grid(:my_problem, model)
    0.0:0.1:1.0
    source
    ExaModels.objectiveMethod
    objective(_::Symbol, model::GenericModel) -> Any
    

    Get the objective value from a JuMP model.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Example

    julia> OptimalControlProblems.objective(:my_problem, model)
    1.5
    source
    ExaModels.variableMethod
    variable(problem::Symbol, model::GenericModel) -> Any
    

    Extract scalar or vector decision variables (such as final time when free) from a JuMP model of an optimal control problem.

    Arguments

    • problem::Symbol: The name of the problem as defined in metadata.
    • model::JuMP.GenericModel: The JuMP model containing the problem solution.

    Returns

    • var::Union{Nothing,Float64,Vector{Float64}}:
      • nothing if the problem defines no additional variables.
      • A scalar if there is one variable.
      • A vector if multiple variables exist.

    Example

    julia> v = OptimalControlProblems.variable(:my_problem, model)
    1.5
    source
    OptimalControlProblems.beamMethod
    beam(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs a JuMP model representing the Beam optimal control problem. The objective is to minimise the control effort while satisfying boundary conditions and the linear beam dynamics. The problem is formulated as in the BOCOP repository.

    Arguments

    • ::JuMPBackend: Placeholder type to specify the JuMP backend or solver interface.
    • N::Int=500: (Keyword) Number of discretisation steps for the time grid.

    Returns

    • model::JuMP.Model: A JuMP model containing the decision variables, dynamics constraints, boundary conditions, and the quadratic objective function.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.beam(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.bioreactorMethod
    bioreactor(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Bioreactor Optimal Control Problem. The problem formulation follows the version provided in the control-toolbox/bocop repository.

    The model includes state variables for biomass (y), substrate (s), and bacteria (b), with control variable u, subject to nonlinear dynamics and constraints. The objective is to minimise a cost function derived from the system dynamics.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the bioreactor optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.bioreactor(JuMPBackend(); N=100)

    References

    source
    OptimalControlProblems.cart_pendulumMethod
    cart_pendulum(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Cart–Pendulum Optimal Control Problem. The objective is to swing a pendulum attached to a cart from the downward position to the upright position in the shortest possible time. The system dynamics, constraints, and objective are discretised over N steps.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the cart–pendulum optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.cart_pendulum(JuMPBackend(); N=200)

    References

    source
    OptimalControlProblems.chainMethod
    chain(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Hanging Chain Problem. The goal is to determine the equilibrium shape of a chain of fixed length L hanging between two fixed points a and b, by minimising its potential energy. The formulation follows a standard optimal control approach with discretised dynamics and constraints.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the hanging chain optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.chain(JuMPBackend(); N=300)

    References

    source
    OptimalControlProblems.dielectrophoretic_particleMethod
    dielectrophoretic_particle(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Dielectrophoretic Particle Optimal Control Problem. The goal is to determine the time–optimal trajectory of a particle in a dielectrophoretic system, moving it from an initial point to a target point. The system dynamics are discretised over N steps, with the final time optimised.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the dielectrophoretic particle optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.dielectrophoretic_particle(JuMPBackend(); N=200)

    References

    • [CPR2006] Chang, D. E., Petit, N., & Rouchon, P. (2006). Time-optimal control of a particle in a dielectrophoretic system. IEEE Transactions on Automatic Control, 51(7), 1100–1114.
    source
    OptimalControlProblems.double_oscillatorMethod
    double_oscillator(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Double Oscillator Optimal Control Problem. The objective is to compute an optimal control trajectory for a mechanical double oscillator system, minimising a quadratic cost on positions and control. The system dynamics are discretised over N steps, with collocation constraints enforcing the dynamics.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the double oscillator optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.double_oscillator(JuMPBackend(); N=200)

    References

    • [CLP2018] Coudurier, C., Lepreux, O., & Petit, N. (2018). Optimal bang-bang control of a mechanical double oscillator using averaging methods. IFAC-PapersOnLine, 51(2), 49–54.
    source
    OptimalControlProblems.ducted_fanMethod
    ducted_fan(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Planar Ducted Fan Optimal Control Problem. The objective is to determine the optimal control inputs for a planar ducted fan to move from a given initial state to a desired final state, minimising a combination of control effort and final time. The system is discretised over N steps, with collocation constraints enforcing the dynamics.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=250: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the planar ducted fan optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.ducted_fan(JuMPBackend(); N=100)

    References

    • Graichen, K., & Petit, N. (2009). Incorporating a class of constraints into the dynamics of optimal control problems. Optimal Control Applications and Methods, 30(6), 537–561. [GP2009]
    source
    OptimalControlProblems.electric_vehicleMethod
    electric_vehicle(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Electric Vehicle Optimal Control Problem. The objective is to compute the optimal control trajectory for an electric vehicle to travel a fixed distance while minimising a combination of energy consumption and control effort. The system dynamics are discretised over N steps, and collocation constraints are used to enforce the vehicle's kinematic and dynamic equations.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the electric vehicle optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.electric_vehicle(JuMPBackend(); N=100)

    References

    • Petit, N., & Sciarretta, A. (2011). Optimal drive of electric vehicles using an inversion-based trajectory generation approach. IFAC Proceedings Volumes, 44(1), 14519–14526. [PS2011]
    source
    OptimalControlProblems.gliderMethod
    glider(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Hang Glider Optimal Control Problem. The objective is to compute the optimal trajectory of a hang glider that maximises the final horizontal position while accounting for aerodynamic forces and a thermal updraft. The system dynamics are discretised over N steps, and collocation constraints enforce the kinematic and dynamic equations of the glider.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the hang glider optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.glider(JuMPBackend(); N=100)

    References

    • Hang Glider Problem formulation as in: https://www.mcs.anl.gov/~more/cops/
    source
    OptimalControlProblems.insuranceMethod
    insurance(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Insurance Optimal Control Problem. The model represents a simplified insurance management scenario where the objective is to optimise the utility function U over time, subject to capital accumulation dynamics and other constraints. The system is discretised using N steps, and collocation constraints enforce the dynamics of the states I, m, and x₃.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the insurance optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.insurance(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.jacksonMethod
    jackson(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Jackson Optimal Control Problem. The model represents a dynamic system with three state variables a, b, and x3 and a control variable u. The objective is to maximise the final value of x3 by optimising the control u over the time horizon [0, tf]. The dynamics are discretised using N steps with trapezoidal collocation.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the Jackson optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.jackson(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.moonlanderMethod
    moonlander(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Moonlander Optimal Control Problem. The model represents the dynamics of a moonlander with two translational and one rotational degrees of freedom. The objective is to minimise the final landing time (tf) while ensuring the lander reaches the target position with zero velocity. The dynamics include translational acceleration, rotation, and thrust allocation, discretised with N steps using trapezoidal collocation.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps in the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the Moonlander optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.moonlander(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://arxiv.org/pdf/2303.16746
    source
    OptimalControlProblems.robbinsMethod
    robbins(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Robbins Optimal Control Problem. The model represents a three-dimensional state system controlled by a single input u. The objective is to minimise a cost functional that combines linear and quadratic terms of the state and control over a fixed time horizon.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps for the time grid.

    Returns

    • model::JuMP.Model: A JuMP model representing the Robbins optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.robbins(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/control-toolbox/bocop/tree/main/bocop
    source
    OptimalControlProblems.robotMethod
    robot(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Robot Arm Optimal Control Problem. The model represents a robot arm with three states (ρ, θ, ϕ) controlled by three inputs (uρ, uθ, uϕ). The objective is to minimise the final time required for the robot arm to move between specified initial and final positions while respecting dynamic and boundary constraints.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=250: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the robot arm optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.robot(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/MadNLP/COPSBenchmark.jl/blob/main/src/robot.jl
    source
    OptimalControlProblems.rocketMethod
    rocket(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Goddard Rocket Optimal Control Problem. The model represents the dynamics of a Goddard rocket with three states (altitude h, velocity v, and mass m) and one control input (T for thrust). The objective is to maximise the final altitude of the rocket while satisfying boundary conditions and dynamic constraints.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the Goddard rocket optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.rocket(JuMPBackend(); N=200)

    References

    • Problem formulation available at: https://github.com/MadNLP/COPSBenchmark.jl/blob/main/src/rocket.jl
    source
    OptimalControlProblems.space_shuttleMethod
    space_shuttle(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Space Shuttle Reentry Trajectory Problem. The model represents the dynamics of a space shuttle reentry with multiple states (altitude h, longitude ϕ, latitude θ, velocity v, flight path angle γ, azimuth ψ) and control inputs (angle of attack α and bank angle β). The objective is to maximise the terminal latitude (cross-range) while satisfying boundary conditions and vehicle dynamics. Note: no heating limit path constraint is included in this formulation.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the space shuttle reentry optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.space_shuttle(JuMPBackend(); N=200)

    References

    • Problem formulation and tutorial available at: https://jump.dev/JuMP.jl/stable/tutorials/nonlinear/spaceshuttlereentry_trajectory/
    source
    OptimalControlProblems.steeringMethod
    steering(::JuMPBackend, args...; N, kwargs...) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Particle Steering Problem. The model represents the dynamics of a particle with four state variables (x1, x2, x3, x4) and a control input u. The objective is to minimise the final time required for the particle to reach a specified altitude and terminal velocity while satisfying the system dynamics and boundary conditions.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the particle steering optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.steering(JuMPBackend(); N=200)

    References

    • Problem formulation available at: https://github.com/MadNLP/COPSBenchmark.jl/blob/main/src/steering.jl
    source
    OptimalControlProblems.truck_trailerMethod
    truck_trailer(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Truck Trailer Problem. The model represents the dynamics of a truck with two trailers, including the truck's velocity, steering angles, and articulation angles between the truck and trailers. The objective is to minimise the total time taken to park the truck and trailers aligned vertically at a specified target location while maintaining the physical constraints and vehicle kinematics.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=200: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the truck trailer optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.truck_trailer(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://arxiv.org/pdf/2303.16746
    source
    OptimalControlProblems.vanderpolMethod
    vanderpol(
        ::JuMPBackend,
        args...;
        N,
        kwargs...
    ) -> JuMP.Model
    

    Constructs and returns a JuMP model for the Van der Pol Problem, a classic nonlinear oscillator system. The model represents the dynamics of the Van der Pol oscillator with control input u and seeks to minimise the quadratic cost over the states and control.

    Arguments

    • ::JuMPBackend: Specifies the backend for building the JuMP model.
    • N::Int=500: (Keyword) Number of discretisation steps for the time horizon.

    Returns

    • model::JuMP.Model: A JuMP model representing the Van der Pol optimal control problem.

    Example

    julia> using OptimalControlProblems
    julia> using JuMP
    
    julia> model = OptimalControlProblems.vanderpol(JuMPBackend(); N=100)

    References

    • Problem formulation available at: https://github.com/control-toolbox/bocop/tree/main/bocop
    source