Private API
This page lists non-exported (internal) symbols of OptimalControlProblems.Catalogue, OptimalControlProblems, OptimalControlProblems.Metadata, OptimalControlProblems.References, OptimalControlModels, ModelingToolkitModels, JuMPModels, OptimalControlProblems.Modelings, OptimalControlProblems.Problems.
From OptimalControlProblems.Catalogue
_fingerprint [Function]
OptimalControlProblems.Catalogue._fingerprint Function
Fingerprint of problem (#314): the SHA-256 of the files that define it (metadata, description, model files), recorded with each result and compared by the documentation to tell whether a result is up to date. The same on every platform: paths are relative to the package and written with /, and line endings are read as ``.
From OptimalControlProblems.Metadata
MODELING_TOOLKIT_GRID_SIZE [Constant]
OptimalControlProblems.Metadata.MODELING_TOOLKIT_GRID_SIZE Constant
The default number of steps of a ModelingToolkit problem: it is solved by direct shooting (Corleone), one integration per control interval, which needs a coarser grid than a collocation (#435). At most the grid of the problem.
sourceFrom OptimalControlProblems.References
_default_scheme [Function]
OptimalControlProblems.References._default_scheme Function
The default discretization of a solve in the modeling of a backend, the one of its references: the trapezoidal rule, but for ModelingToolkit, solved by single shooting.
source_relative_gap [Function]
OptimalControlProblems.References._relative_gap Function
Relative gap of a to b (absolute when b is zero).
From JuMPModels
ButcherTableau [Struct]
JuMPModels.ButcherTableau Type
struct ButcherTableauA Runge–Kutta scheme given by its Butcher tableau (A, b, c), with s stages.
Component [Struct]
JuMPModels.Component Type
struct ComponentA component of the state, the control or the variable: its name (also the name of the JuMP container) and bounds. A bound is a number, or for the state and the control a vector over the nodes 0:N; nothing leaves it unset. The start values come from the initial guess of the problem (#377), not from the components.
ProblemData [Struct]
JuMPModels.ProblemData Type
struct ProblemDataThe data of an optimal control problem, written once for every scheme.
The functions receive, at one node, the vectors x (state), u (control), v (variable) of JuMP variables and the time t; x0, xf are the state at the first and last nodes.
times(v): the initial and final times, numbers or expressions ofv.dynamics(x, u, v, t): the vectorẋ.lagrange(x, u, v, t): the integrand of the cost, ornothing.cost(I, x0, xf, v): the objective, given the discretized integralIof the Lagrange cost (0without one).path:(lower, f, upper)withf(x, u, v, t), imposed at every node.boundary:(lower, f, upper)withf(x0, xf, v).
_costate_times [Function]
JuMPModels._costate_times Function
_costate_times(T) -> AnyReturn the time stamps of the dynamics multipliers: the multiplier of a step approximates the costate at the middle of the step (the discrete adjoint of the scheme, CTDirect.jl#640), so the values are stamped at the midpoints t_i + h_i/2 of the steps, not at the nodes.
Evaluations outside [τ_1, τ_N] return the first / last value (ctinterpolate extrapolates flat), i.e. the multiplier of the first / last step.
Arguments
T: The node time gridt_0, …, t_N(length(T) == N + 1).
Returns
Vector{Float64}: TheNstep midpoints(T[i] + T[i + 1]) / 2.
_interpolate_costate [Function]
JuMPModels._interpolate_costate Function
_interpolate_costate(
T,
P,
dim_x::Int64
) -> Union{JuMPModels.var"#_interpolate_costate##2#_interpolate_costate##3", JuMPModels.var"#_interpolate_costate##4#_interpolate_costate##5"}Interpolate the costate matrix P (sampled at step midpoints _costate_times(T)) into a function of continuous time, coercing to scalar when dim_x == 1.
Arguments
T: The node time gridt_0, …, t_N.P: TheN × dim_xmatrix of step multipliers.dim_x::Int: The state dimension.
Returns
Function: A function of continuous time returning the interpolated costate (scalar whendim_x == 1, vector otherwise).
_multiplier [Function]
JuMPModels._multiplier Function
_multiplier(ref) -> AnyReturn the signed multiplier y = μU - μL of the constraint ref in the convention of rules/signs.md (ct-conventions, SGN1, SGN3): the multiplier y of a row c(x) ∈ S satisfies ∇F_min + Jᵀy = 0, with F_min the objective of the equivalent minimization (F for a minimization, -F for a maximization).
JuMP.dual returns the MOI ConstraintDual, a convention fixed by MathOptInterface, independent of the solver and of the objective sense — it is the one of the equivalent minimization, ∇F_min - Jᵀy_MOI = 0. The signed multiplier is hence -JuMP.dual, for a Min and a Max model alike (SGN1: min f and max -f have the same multipliers).
See https://jump.dev/MathOptInterface.jl/stable/background/duality/.
Arguments
ref: A JuMP constraint reference.
Returns
Float64: The signed multiplier-JuMP.dual(ref).
_stage_values [Function]
JuMPModels._stage_values Function
_stage_values(
_::JuMPModels.FirstSameAsLast,
g,
tab,
θ,
x,
u,
v,
t,
Δt
) -> AnyValues of g(x, u, v, t) at the stages of every step: G[i + 1][j] for stage j of step i. With FSAL, the stages are nodes and g is evaluated once per node.
_start! [Function]
JuMPModels._start! Function
Set the start values from the initial guess init ((state=…, control=…, variable=…), any of them may be missing), as CTDirect does: the state at the N+1 nodes, the control at the nodes of its M values, the variable once; the time grid is the one of the initial guess of the variable when the final time is free.
build [Function]
JuMPModels.build Function
build(
data::JuMPModels.ProblemData,
grid_size::Int64,
scheme::Symbol,
ordering::Symbol,
args...;
init,
kwargs...
) -> ModelBuild the JuMP model of data discretized on grid_size steps by scheme (:trapeze, :euler, :euler_implicit or :midpoint), with the variables and constraints in the order ordering (:interleaved or :blocks), with the start values of the initial guess init (see _start!). args and kwargs are passed to JuMP.Model.
Throws
CTBase.Exceptions.IncorrectArgument: Ifschemeororderingis not one of them.
control_at_node [Function]
JuMPModels.control_at_node Function
control_at_node(
tab::JuMPModels.ButcherTableau,
k::Int64,
N::Int64
) -> Int64The control (0-based) used at the node k of a grid of N steps, by the path constraints. At the nodes for a tableau with final control; otherwise the control of the step that starts at the node, the last node taking the last one, except when the only stage is at the end of the step (implicit Euler): the control of the step that ends at the node, the first node taking the first one (CTDirect's conventions).
control_at_stage [Function]
control_count [Function]
costate_components [Function]
JuMPModels.costate_components Function
costate_components(model::GenericModel) -> AnyReturn the list of costate component names stored in a JuMP model.
Arguments
model::JuMP.GenericModel: A JuMP model that contains the key:costate_components.
Returns
Vector{String}: The names of the costate components.
Example
julia> costate_components(model)
["∂x", "∂v", "∂θ", "∂ω"]has_explicit_first_stage [Function]
JuMPModels.has_explicit_first_stage Function
First row of A zero and c_1 = 0: the first stage is the node X_i.
has_final_control [Function]
JuMPModels.has_final_control Function
The controls of a FSAL tableau live at the nodes, shared by neighbouring steps: one more control than steps (CTDirect's _final_control).
is_explicit [Function]
JuMPModels.is_explicit Function
A strictly lower triangular: each stage depends on the previous ones only.
is_fsal [Function]
JuMPModels.is_fsal Function
First Same As Last: the last stage of a step is the first stage of the next one.
sourceis_stiffly_accurate [Function]
JuMPModels.is_stiffly_accurate Function
Last row of A equal to b and c_s = 1: the last stage is the next node X_{i+1}.
stage_positions [Function]
JuMPModels.stage_positions Function
stage_positions(
tab::JuMPModels.ButcherTableau
) -> Vector{Float64}The position θ_j of each stage in the step, Z_j = X_i + θ_j (X_{i+1} - X_i).
Throws
CTBase.Exceptions.NotImplemented: If a stage is not of this form (an interior stage of a tableau of several stages): it needs stage unknowns, which the JuMP models do not have.
tableau [Function]
JuMPModels.tableau Function
tableau(scheme::Symbol) -> JuMPModels.ButcherTableauThe tableau of scheme, one of the keys of TABLEAUX.
Throws
CTBase.Exceptions.IncorrectArgument: Ifschemeis not one of them.