API Reference
Corleone
Corleone.Trajectory — Type
struct Trajectory{S, U, P, T, SH}The solution to an optimal control problem.
Fields
sys: The symbolic system used for SymbolicIndexingInterfaceu: The state trajectoryp: The parameter valuest: The timepointsshooting: The shooting valuesshooting_indices: The shooting indices
Note
If present, shooting_points contains a list of Tuples (timeseries_index, last_shooting_point).
Corleone.ControlParameter — Type
struct ControlParameter{T, C, B}Implements a piecewise constant control discretization.
Fields
name: The name of the controlt: The timepoints at which discretized variables are introducedcontrols: The initial values for the controls. Either a vector or a function (rng,t,bounds) -> ubounds: The bounds as a tuple
Corleone.SingleShootingLayer — Type
struct SingleShootingLayer{P, A, C, B, PB, SI, PI} <: LuxCore.AbstractLuxLayerDefines a callable layer that integrates the AbstractDEProblem problem using the specified algorithm. Controls are assumed to impact differential equation via its parameters problem.p at the positions indicated via control_indices and are itself specified via controls. Moreover, initial conditions problem.u0 that are degrees of freedom to be optimized can be specified by their indices via tunable_ic along with their upper and lower bounds via bounds_ic.
Fields
problem: The underlying differential equation problemalgorithm: The algorithm with whichproblemis integrated.control_indices: Indices in parameters ofprobcorresponding to controlscontrols: The controlstunable_ic: Indices ofprob.u0which are degrees of freedombounds_ic: Bounds on the tunable initial conditions of the problemstate_initialization: Initialization of utunable_p: Indices ofprob.pwhich are degrees of freedom. This is derived from control_indices!bounds_p: Bounds on the tunable parameters of the problemparameter_initialization: Initialization of pquadrature_indices: Indices of differential states that are quadratures, i.e. they do not enter into the right hand side ofproblem
Note: The orders of both controls and control_indices, and bounds_ic and tunable_ic are assumed to be identical!
Corleone.MultipleShootingLayer — Type
struct MultipleShootingLayer{L, I, E, Z} <: LuxCore.AbstractLuxWrapperLayer{:layer}Defines a callable layer that integrates a differential equation using multiple shooting, i.e., the problem is lifted and integration is decoupled on disjunct time intervals given in shooting_intervals. Initial conditions on the shooting_intervals are degrees of freedom (except perhaps for the first layer), for which the initialization scheme initialization provides initial values. Parallelization is integration is possible, for which a suitable EnsembleAlgorithm can be specified with ensemble_alg.
Fields
layer: The original layershooting_intervals: The shooting intervalsensemble_alg: The ensemble algorithminitialization: The initialization scheme
Corleone.default_initialization — Function
default_initialization
Initializes all shooting nodes with their default value, i.e., their initial value in the underlying problem.
Corleone.random_initialization — Function
random_initialization(rng, shooting; ps, kwargs...)
Initializes all shooting nodes with random values.
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layer
Keyworded Arguments
psthe default parameters of theshootinglayer.
Corleone.forward_initialization — Function
forward_initialization(
rng,
shooting;
ps,
fixed_indices,
kwargs...
)
Initializes the problem using a forward solve of the problem. This results in a continuous trajectory.
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layer
Keyworded Arguments
psthe default parameters of theshootinglayer.
Corleone.linear_initialization — Function
linear_initialization(
rng,
shooting;
ps,
u_infinity,
kwargs...
)
Linearly interpolates u0 and u_inf for t with tspan[1] < t < tspan[2].
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layer
Keyworded Arguments
psthe default parameters of theshootinglayer.u_infinity::AbstractArraythe value at the last timepoint for all states.
Corleone.custom_initialization — Function
custom_initialization(rng, shooting; ps, u0s, kwargs...)
Initializes all shooting nodes with user-provided values. Initial values are given as an iterable collection of AbstractArrays, Dicts, or a vector of Pairs. The variable indices are interpreted depending on the passed value
AbstractArrayjust sets the initial condition with the provided value. This assumes equal dimensionality.Dictassumes the keys represent indices of the initial condition.- A
VectororTupleofPairs assumes the first value represents an index of the initial condition.
Other options simply skip the corresponding interval.
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layer
Keyworded Arguments
psthe default parameters of theshootinglayer.u0sthe collection of initial conditions.
Example
# Assumes a shooting layer with 3 intervals
# Skips the first interval
# Sets the first index of the second interval to 3.0
# Sets the second index of the third interval to 5.0 and the 5th index to -1.0
custom_initialization(rng, shooting, u0s = [nothing, Dict(1 => 3.0), (2 => 5.0, 5 => -1.0)])Corleone.constant_initialization — Function
constant_initialization(rng, shooting; ps, u0, kwargs...)
Initializes all shooting nodes with user-provided value. The variable indices are interpreted depending on the passed value
AbstractArrayjust sets the initial condition with the provided value. This assumes equal dimensionality.Dictassumes the keys represent indices of the initial condition.- A
VectororTupleofPairs assumes the first value represents an index of the initial condition.
Other options simply skip the corresponding interval.
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layer
Keyworded Arguments
psthe default parameters of theshootinglayer.u0the initial condition.
Example
# Assumes a shooting layer with 3 intervals
# Sets the first index of all intervals to 3.0
constant_initialization(rng, shooting, u0 = Dict(1 => 3.0))
constant_initialization(rng, shooting, u0 = (1 => 3.0,))
# Set the initial condition to the given vector
constant_initialization(rng, shooting, u0 = [1., 2., 4.])Corleone.hybrid_initialization — Function
hybrid_initialization(rng, shooting, f; ps, kwargs...)
Initializes the shooting nodes in a hybrid method by applying the provided methods and indices f sequentially. Here we assume the structure interval => method for the initialization.
Arguments
rng::Random.AbstractRNGa random number generatorshooting::MultipleShootingLayera shooting layerf::Pairs of the interval index and applied method
Keyworded Arguments
psthe default parameters of theshootinglayer.
All other keyworded arguments are passed on to the functions below.
Corleone.CorleoneDynamicOptProblem — Type
struct CorleoneDynamicOptProblem{L, G, O, C, CB}A struct for capturing the internal definition of a dynamic optimization problem.
Fields
layer: The resulting layer for the problemgetters: The getters which return the values of the trajectoryobjective: The objective functionconstraints: The constraint functionlcons: Lower bounds for the constraintsucons: Upper bounds for the constraints
Developer interface
These hooks are the contract used by CorleoneOED and by extensions that add new shooting-layer wrappers. They are documented for package developers; ordinary users should prefer the exported constructors and layer methods above.
Corleone.get_block_structure — Function
get_block_structure(layer; kwargs...)Return cumulative parameter boundaries for a Corleone layer. The first entry is zero and the final entry is the number of optimization parameters. Layer wrappers should extend this method when their parameter blocks have additional structure.
get_block_structure(layer)
get_block_structure(layer, tspan, kwargs)
Compute the block structure of the hessian of the Lagrangian of an optimal control problem. As this is a SingleShootingLayer, this hessian is dense. See also $MultipleShootingLayer$.
get_block_structure(mslayer)
Compute the block structure of the hessian of the Lagrangian of an optimal control problem as specified via the shooting_intervals of the MultipleShootingLayer. Note: Constraints other than the matching conditions of the multiple shooting approach are not considered here and might alter the block structure.
get_block_structure(layer)
Computes the block structure as defined by the MultiExperimentLayer, which may come from two levels: 1) the different experiments, and 2) multiple shooting discretizations on the experiment level.
Corleone.get_bounds — Function
get_bounds(layer; kwargs...)Return lower and upper bounds for the optimization variables of layer as a tuple (lower, upper). A layer extension must preserve the same structure in both values.
get_bounds(parameters; tspan, kwargs...)
Returns bounds of discretized controls restricted to given tspan.
get_bounds(mslayer)
Extracts lower and upper bounds of all optimization variables in the MultipleShootingLayer.
Corleone.get_controls — Function
get_controls(, parameters; raw, tspan, kwargs...)
Returns discretized controls of ControlParameter params restricted to given tspan.
get_controls(layer::SingleShootingLayer)Return (controls, control_indices), where controls are the control parameter objects and control_indices identify their positions in the problem parameter vector.
Corleone.get_number_of_shooting_constraints — Function
get_number_of_shooting_constraints(layer)Return the number of matching constraints generated by layer. Single shooting has no matching constraints; multiple shooting counts state, parameter, and control continuity constraints in that order.
Corleone.get_problem — Function
get_problem(layer::SingleShootingLayer)Return the differential-equation problem integrated by layer.
Corleone.get_timegrid — Function
get_timegrid(parameters::ControlParameter, tspan = (-Inf, Inf))Return the control time points inside tspan. The returned points retain the order of the control parameter grid and exclude the right endpoint of a finite interval.
Corleone.get_tspan — Function
get_tspan(layer::SingleShootingLayer)Return the time span of the underlying differential-equation problem.
Corleone.get_tunable — Function
get_tunable(layer::SingleShootingLayer)Return the indices of tunable initial-condition entries.
Corleone.shooting_constraints — Function
shooting_constraints(traj)
Returns the shooting violations sorted by states - parameters - controls and per-kind sorted by shooting-stage.
Corleone.shooting_constraints! — Function
shooting_constraints!(res, traj)
In-place version of shooting_constraints.
CorleoneOED
CorleoneOED.OEDLayer — Type
struct OEDLayer{DISCRETE, SAMPLED, FIXED, L, O} <: LuxCore.AbstractLuxWrapperLayer{:layer}Wraps a Corleone shooting layer with the augmented dynamics needed for optimal experimental design. The DISCRETE type parameter selects discrete or continuous information accumulation, and optional measurement controls can restrict where observations are collected.
Fields
layer: The underlying layerobserved: The observed functionssampling_indices: The sampling indices
CorleoneOED.fisher_information — Function
fisher_information(oed, x, ps, st; add_initial)
Computes the Fisher information matrix for an OEDLayer at parameters ps and state st.
Arguments
oed: Optimal experimental design layer.x: External input passed through the Lux layer interface.ps: Layer parameters, typically fromLuxCore.initialparametersorLuxCore.setup.st: Layer state, typically fromLuxCore.initialstatesorLuxCore.setup.
Keywords
add_initial: Include previously accumulated information stored inst.
Returns
A tuple (F, st) containing the Fisher information matrix and updated layer state.
CorleoneOED.observed_equations — Function
observed_equations(oed, traj)
Evaluates the observation equations associated with an OEDLayer.
Returns
For trajectory inputs, observed values are returned directly. For layer inputs, the return value is (observed, st) with the updated layer state.
CorleoneOED.sensitivities — Function
sensitivities(oed, traj)
Returns the parameter sensitivities of the observed outputs for an OED trajectory.
Returns
For trajectory inputs, the sensitivity arrays are returned directly. For layer inputs, the return value is (sensitivities, st) with the updated layer state.
CorleoneOED.local_information_gain — Function
local_information_gain(oed, x, ps, st)
Computes local information gain contributions from each observed quantity along the OED trajectory.
Returns
A tuple (gains, st) containing per-observation information matrices and the updated layer state.
CorleoneOED.global_information_gain — Function
global_information_gain(oed, x, ps, st)
Computes global information gain contributions scaled by the inverse final Fisher information matrix.
Returns
A tuple (gains, st) containing per-observation information matrices and the updated layer state.
CorleoneOED.MultiExperimentLayer — Type
struct MultiExperimentLayer{DISCRETE, FIXED, SPLIT, SHOOTING, L, P} <: LuxCore.AbstractLuxLayerGeneralization of OEDLayer to multiple experiments that can be jointly optimized.
Fields
layers: Layers defining multiexperimentsn_exp: Number of experimentsparams: Parameters considered in the different experiments
CorleoneOED.AbstractCriterion — Type
abstract type AbstractCriterionInterface for an optimal-design criterion.
Concrete criteria must implement (::MyCriterion)(F::Symmetric) and return a scalar objective from a Fisher information matrix. The generic layer method calls fisher_information(layer, x, ps, st) and returns (value, st) while preserving the updated layer state. Criteria are pure with respect to the matrix input and must not mutate the layer state.
Example
struct TraceCriterion <: AbstractCriterion end
(::TraceCriterion)(F::Symmetric) = tr(F)CorleoneOED.ACriterion — Type
struct ACriterion <: CorleoneOED.AbstractCriterionMinimizes $\operatorname{tr}(F^{-1})$. This is an A-optimality criterion and is defined for a nonsingular symmetric Fisher information matrix.
CorleoneOED.DCriterion — Type
struct DCriterion <: CorleoneOED.AbstractCriterionMinimizes $\det(F^{-1})$ for a nonsingular symmetric Fisher information matrix.
CorleoneOED.ECriterion — Type
struct ECriterion <: CorleoneOED.AbstractCriterionMinimizes the largest eigenvalue of $F^{-1}$ for a symmetric Fisher information matrix.
CorleoneOED.FisherACriterion — Type
struct FisherACriterion <: CorleoneOED.AbstractCriterionMaximizes $\operatorname{tr}(F)$ by minimizing its negative.
CorleoneOED.FisherECriterion — Type
struct FisherECriterion <: CorleoneOED.AbstractCriterionMaximizes the smallest eigenvalue of F by minimizing its negative.
CorleoneOED.FisherDCriterion — Type
struct FisherDCriterion <: CorleoneOED.AbstractCriterionMaximizes $\det(F)$ by minimizing its negative.
OptimalControlBenchmarks
OptimalControlBenchmarks.load_benchmarks — Function
load_benchmarks()Loads all benchmark problem constructors from the problems directory.
Returns
A vector of benchmark constructor functions. Each function accepts a benchmark grid configuration and returns the corresponding optimal control problem data.
OptimalControlBenchmarks.run_all — Function
run_all(benchmarks, optimizer, grids)Runs each benchmark problem with the Corleone benchmark solver.
Arguments
benchmarks: Iterable of benchmark constructor functions, such as the result ofload_benchmarks().optimizer: Optimization solver passed tosolve_with_corleone.grids: Grid configuration passed to each benchmark constructor.
Returns
A vector of named tuples containing each benchmark name and measured runtime placeholder.
OptimalControlBenchmarks.OptimalControlBenchmark — Type
struct OptimalControlBenchmarkDescription of one benchmark problem registered by load_benchmarks.
Fields
name: Stable identifier used in benchmark output.description: Human-readable description of the problem.make_problem: Callable acceptingBenchmarkGridsand returning benchmark problem data.
This is a developer type. Benchmark packages should provide a constructor with the same callable contract as make_problem rather than depending on implementation details of the benchmark registry.
OptimalControlBenchmarks.BenchmarkGrids — Type
struct BenchmarkGridsThe grids used by an optimal-control benchmark constructor.
Fields
control_grid: Control discretization points.shooting_grid: Multiple-shooting points.constraint_grid: Points at which path or terminal constraints are evaluated.
Usage contract
Each grid contains the time points used for the corresponding discretization. A benchmark constructor accepts a BenchmarkGrids value and returns the problem data consumed by run_all.