Private API
This page lists non-exported (internal) symbols of CTModels.Init.
From CTModels.Init
MergedTrajectory [Struct]
CTModels.Init.MergedTrajectory — Type
struct MergedTrajectory{F, C} <: FunctionCallable struct merging a block-level trajectory base with sparse component-level overrides comps: f(t) evaluates base(t), normalises to a vector, applies each component override, and returns a scalar (dim == 1) or a vector.
base::F is a concrete type parameter, replacing the former base_fun::Function abstract capture. comps::C stores the Dict{Int,Function} override map.
Component index bounds are validated at construction, not at call time, so the call method stays allocation-free beyond what base and the component functions allocate.
Replaces the anonymous closure t -> begin … end (57 lines) produced inside CTModels.Init._build_block_with_components in builders.jl.
Fields
base::F: Block-level trajectory function.comps::C: Component-level override map (Dict{Int,Function}).dim::Int: Total dimension.role::Symbol: Component role (:stateor:control).
Examples
using CTModels.Init
base = t -> [0.0, 0.0]
comps = Dict{Int,Function}(2 => t -> sin(t))
f = MergedTrajectory(base, comps, 2, :state)
f(0.5) # returns [0.0, sin(0.5)]_build_block_with_components [Function]
CTModels.Init._build_block_with_components — Function
_build_block_with_components(
ocp::CTModels.Models.AbstractModel,
role::Symbol,
block_data,
comp_data::Dict{Int64, Any}
) -> Any
Build an initialisation function combining block-level and component-level data.
Arguments
ocp::CTModels.Models.AbstractModel: The optimal control problem.role::Symbol: The component role (:stateor:control).block_data: Block-level initialisation data.comp_data::Dict{Int,Any}: Component-level initialisation data indexed by component.
Returns
Function: A combined initialisation function that merges block and component data.
Throws
CTBase.Exceptions.IncorrectArgument: If dimensions are incompatible or component indices are out of bounds.
See also: CTModels.Init.MergedTrajectory, CTModels.Init.initial_state, CTModels.Init.initial_control
_build_component_function [Function]
CTModels.Init._build_component_function — Function
_build_component_function(data) -> Function
Build a component-level initialisation function from data.
Arguments
data: The component data (time-dependent tuple or time-independent data).
Returns
Function: A component initialisation function.
See also: CTModels.Init._build_component_function_without_time, CTModels.Init._build_component_function_with_time
_build_component_function_with_time [Function]
CTModels.Init._build_component_function_with_time — Function
_build_component_function_with_time(
data,
time::AbstractVector
) -> Function
Build a component function from data with an associated time grid.
Arguments
data: The component data (function, scalar, or vector).time::AbstractVector: The time grid for interpolation.
Returns
Function: A component initialisation function with time interpolation.
Throws
CTBase.Exceptions.IncorrectArgument: If the data type is unsupported or time-grid mismatch occurs.
See also: CTModels.Components.ConstantInTime, CTBase.Interpolation.ctinterpolate
_build_component_function_without_time [Function]
CTModels.Init._build_component_function_without_time — Function
_build_component_function_without_time(data) -> Function
Build a component function from time-independent data (scalar, vector, or function).
Arguments
data: The time-independent data (function, scalar, or vector).
Returns
Function: A component initialisation function.
Throws
CTBase.Exceptions.IncorrectArgument: If the data type is unsupported or vector length is invalid.
See also: CTModels.Components.ConstantInTime
_build_time_dependent_init [Function]
CTModels.Init._build_time_dependent_init — Function
_build_time_dependent_init(
ocp::CTModels.Models.AbstractModel,
role::Symbol,
data,
time::AbstractVector
) -> Union{Nothing, Function}
Build a time-dependent initialisation function from data and a time grid.
Arguments
ocp::CTModels.Models.AbstractModel: The optimal control problem.role::Symbol: The component role (:stateor:control).data: The data to interpolate (function, vector, or vector-of-vectors).time::AbstractVector: The time grid.
Returns
Function: An interpolated initialisation functiont -> value(t).
Throws
CTBase.Exceptions.IncorrectArgument: If data type is unsupported or dimensions/time-grid mismatch occurs.
See also: CTBase.Interpolation.ctinterpolate, CTModels.Init.initial_state, CTModels.Init.initial_control
_format_init_data_for_grid [Function]
CTModels.Init._format_init_data_for_grid — Function
_format_init_data_for_grid(data) -> Any
Convert matrix data to vector-of-vectors format for time-grid interpolation.
Arguments
data: The data to format (matrix or other format).
Returns
Union{AbstractVector, Any}: The formatted data as vector-of-vectors, or the original data.
_format_time_grid [Function]
CTModels.Init._format_time_grid — Function
_format_time_grid(time_data) -> Any
Normalise time grid data to a vector format.
Arguments
time_data: The time grid data (vector, array, ornothing).
Returns
Union{Nothing, AbstractVector}: The normalised time grid as a vector, ornothing.
Throws
Exceptions.IncorrectArgument: If the time grid type is invalid.
_initial_guess_from_namedtuple [Function]
CTModels.Init._initial_guess_from_namedtuple — Function
_initial_guess_from_namedtuple(
ocp::CTModels.Models.AbstractModel,
init_data::NamedTuple
) -> CTModels.Init.InitialGuess
Build an initial guess from a NamedTuple.
Arguments
ocp::Models.AbstractModel: The optimal control problem.init_data::NamedTuple: The initial guess data with named fields.
Returns
InitialGuess: An initial guess constructed from the NamedTuple.
Throws
Exceptions.IncorrectArgument: If keys are invalid, dimensions mismatch, or specifications are duplicated.
_initial_guess_from_preinit [Function]
CTModels.Init._initial_guess_from_preinit — Function
_initial_guess_from_preinit(
ocp::CTModels.Models.AbstractModel,
pre::CTModels.Init.PreInitialGuess
) -> CTModels.Init.InitialGuess
Build an initial guess from a pre-initialisation object.
Arguments
ocp::Models.AbstractModel: The optimal control problem.pre::PreInitialGuess: The pre-initialisation container.
Returns
InitialGuess: An initial guess constructed from the pre-initialisation data.
_initial_guess_from_solution [Function]
CTModels.Init._initial_guess_from_solution — Function
_initial_guess_from_solution(
ocp::CTModels.Models.AbstractModel,
sol::CTModels.Solutions.AbstractSolution
) -> Union{CTModels.Init.InitialGuess{X, U, V} where {X<:Function, U<:Function, V<:Real}, CTModels.Init.InitialGuess{X, U, V} where {X<:Function, U<:Function, V<:(AbstractVector{<:Real})}}
Build an initial guess from a previous solution (warm start).
Arguments
ocp::Models.AbstractModel: The optimal control problem.sol::Solutions.AbstractSolution: The previous solution.
Returns
InitialGuess: An initial guess constructed from the solution.
Throws
Exceptions.IncorrectArgument: If dimensions do not match between the problem and solution.
_validate_initial_guess [Function]
CTModels.Init._validate_initial_guess — Function
_validate_initial_guess(
ocp::CTModels.Models.AbstractModel,
init::CTModels.Init.InitialGuess
) -> CTModels.Init.InitialGuess
Internal validation of an InitialGuess.
Arguments
ocp::Models.AbstractModel: The optimal control problem.init::InitialGuess: The initial guess to validate.
Returns
InitialGuess: The validated initial guess.
Throws
Exceptions.IncorrectArgument: If dimensions or types are incompatible.