Skip to content

Guided tour ​

What the collection holds, and what each problem comes with.

julia
using OptimalControlProblems

The problems ​

problems() lists the problems that are valid in at least one modeling. Given a backend, it lists those of that modeling; given several, those valid in all of them, which are the ones to use to compare modelings.

julia
problems()
22-element Vector{Symbol}:
 :balanced_field
 :beam
 :bioreactor
 :brachistochrone
 :bryson_denham
 :cart_pendulum
 :chain
 :dielectrophoretic_particle
 :double_oscillator
 :ducted_fan
 ⋮
 :jackson
 :moonlander
 :mountain_car
 :robbins
 :robot
 :rocket
 :space_shuttle
 :steering
 :vanderpol
julia
problems(JuMPBackend(), OptimalControlBackend())
22-element Vector{Symbol}:
 :balanced_field
 :beam
 :bioreactor
 :brachistochrone
 :bryson_denham
 :cart_pendulum
 :chain
 :dielectrophoretic_particle
 :double_oscillator
 :ducted_fan
 ⋮
 :jackson
 :moonlander
 :mountain_car
 :robbins
 :robot
 :rocket
 :space_shuttle
 :steering
 :vanderpol

A problem is valid in a modeling once it is checked there, draft before. Drafts are listed with status=:all:

julia
setdiff(problems(; status=:all), problems())
Symbol[]
julia
OptimalControlProblems.status(:bryson_denham)
(OptimalControl = :valid, OptimalControlScalarized = :valid, JuMP = :valid, ModelingToolkit = :valid)

The availability of a problem in a modeling is the presence of its file, so this list is never written by hand. The Status page shows it for every problem.

The metadata ​

Every problem has metadata, read without building it:

julia
problem_metadata(:beam)[:grid_size]
500
julia
parameters_data(:beam)
(t0 = 0, tf = 1, x₁_l = 0, x₁_u = 0.1, x₁_t0 = 0, x₂_t0 = 1, x₁_tf = 0, x₂_tf = -1)
julia
OptimalControlProblems.initial_guess_data(:beam)
(state = [0.05, 0.1], control = 0.1)
julia
OptimalControlProblems.reference_objective(:beam, OptimalControlBackend())
8.889281808581256

The reference objective depends on the modeling, the scheme and the grid: it is the objective of the discretized problem. When the continuous problem has a known solution, it is in the metadata too:

julia
OptimalControlProblems.reference_solution_data(:beam).objective
8.88888888888889

The features ​

The features of a problem are computed from its OptimalControl model, which needs the OptimalControl extension:

julia
using OptimalControl
OptimalControlProblems.features(:beam)
(state_dimension = 2, control_dimension = 1, variable_dimension = 0, cost = :lagrange, initial_time = :fixed, final_time = :fixed, constraints = (state_box = 1, control_box = 0, variable_box = 0, path = 0, boundary = 4))

The table of all the problems filters them by these features.

The modelings ​

A problem is written in one or more modelings, and each modeling returns the most abstract object it can represent. OptimalControl returns the continuous problem: the discretization is chosen when solving. JuMP returns a model already discretized: the scheme and the grid are chosen when the problem is built.

julia
using JuMP
pb = beam(OptimalControlBackend())
nlp = beam(JuMPBackend(); grid_size=100, scheme=:trapeze)
num_variables(nlp)
303

On each problem page, a tab bar at the top switches between the problem, its modelings and their comparison.