Public API
This page lists exported symbols of CTFlows.Configs.
From CTFlows.Configs
CTFlows.Configs [Module]
CTFlows.Configs — Module
ConfigsConfiguration types for integration problems in CTFlows.
This module provides the configuration type hierarchy that specifies integration scenarios including:
- Integration mode: point-to-point vs trajectory
- Dynamics type: state-only vs Hamiltonian (state + costate)
- Time dependence: autonomous vs non-autonomous
- Variable dependence: fixed vs non-fixed (for optimal control)
Configuration types encode these choices as type parameters for compile-time dispatch.
Main Types
AbstractConfig: Base configuration typeAbstractConfigWithMaC: Configuration with mode and content traitsStateEndPointConfig: Point-to-point state integrationStateTrajectoryConfig: Trajectory state integrationHamiltonianEndPointConfig: Point-to-point Hamiltonian integrationHamiltonianTrajectoryConfig: Trajectory Hamiltonian integrationAugmentedHamiltonianEndPointConfig: Augmented Hamiltonian for variable costate
Accessors
tspan: Time span(t0, tf)initial_state: Initial stateinitial_costate: Initial costate (Hamiltonian configs)initial_variable_costate: Initial variable costate (augmented configs)mode_trait: Integration mode traitdynamics_trait: Dynamics trait
See also: CTFlows.Flows.build_flow, CTFlows.Trajectories.build_trajectory.
AbstractAugmentedHamiltonianConfig [Abstract Type]
CTFlows.Configs.AbstractAugmentedHamiltonianConfig — Type
abstract type AbstractConfigWithMaC{X0, M, CTBase.Traits.AugmentedHamiltonianDynamics} <: CTFlows.Configs.AbstractConfig{X0}Type alias for augmented Hamiltonian configurations, which include state, costate, and augmented variable initial conditions.
Type Parameters
X0: Type of the initial condition (typically a vector concatenating state, costate, and augmented variable).M: Type of the mutability trait (InPlaceorOutOfPlace).
Notes
- Augmented Hamiltonian configurations are used for systems where the Hamiltonian depends on an additional variable (e.g., a control parameter or optimization variable).
- The initial condition typically has the form
vcat(x0, p0, pv0)wherex0is the initial state,p0is the initial costate, andpv0is the initial augmented variable. - Subtypes
CTFlows.Configs.AbstractConfigWithMaCwithCTBase.Traits.AugmentedHamiltonianDynamics. - Used in conjunction with
CTFlows.Systems.HamiltonianSystemfor automatic differentiation-based Hamiltonian integration.
See also: CTFlows.Configs.AbstractHamiltonianConfig, CTBase.Traits.AugmentedHamiltonianDynamics, CTFlows.Systems.HamiltonianSystem.
AbstractConfig [Abstract Type]
CTFlows.Configs.AbstractConfig — Type
abstract type AbstractConfig{X0}Abstract configuration type for integration problems.
Marker type for dispatch on configuration objects. Concrete subtypes define specific integration scenarios (e.g., point-to-point, trajectory, costate).
The type parameters encode:
X0: Type of the initial condition (scalarNumberor vectorAbstractVector)Mode: Integration mode (EndPointModeorTrajectoryMode)Dyn: Dynamics type (StateDynamicsorHamiltonianDynamics)
This enables compile-time dispatch on mode and content without runtime type tests.
Interface Requirements
All subtypes must implement:
tspan(config): Return the time span as a tuple(t0, tf).
Example
julia> using CTFlows.Configs
julia> StateEndPointConfig <: Configs.AbstractConfig
true
julia> StateEndPointConfig <: Configs.AbstractEndPointConfig
true
julia> StateEndPointConfig <: Configs.AbstractStateConfig
trueSee also: CTFlows.Configs.AbstractEndPointConfig, CTFlows.Configs.AbstractTrajectoryConfig, CTFlows.Configs.AbstractStateConfig, CTFlows.Configs.AbstractHamiltonianConfig.
AbstractConfigWithMaC [Abstract Type]
CTFlows.Configs.AbstractConfigWithMaC — Type
abstract type AbstractConfigWithMaC{X0, Mode<:CTBase.Traits.AbstractModeTrait, Dyn<:CTBase.Traits.AbstractDynamicsTrait} <: CTFlows.Configs.AbstractConfig{X0}Abstract configuration type with mode and content traits.
Extends AbstractConfig with additional type parameters for compile-time dispatch on integration mode (point vs trajectory) and content type (state, Hamiltonian, augmented Hamiltonian).
Type Parameters
X0: Type of the initial condition (scalarNumberor vectorAbstractVector)Mode <: AbstractModeTrait: Integration mode trait (EndPointModeorTrajectoryMode)Dyn <: AbstractDynamicsTrait: Dynamics trait (StateDynamics,HamiltonianDynamics, orAugmentedHamiltonianDynamics)
Interface Requirements
All subtypes must implement:
tspan(config): Return the time span as a tuple(t0, tf).
Example
julia> using CTFlows.Configs
julia> StateEndPointConfig <: Configs.AbstractConfigWithMaC
true
julia> HamiltonianEndPointConfig <: Configs.AbstractConfigWithMaC
trueSee also: CTFlows.Configs.AbstractConfig, CTFlows.Configs.AbstractEndPointConfig, CTFlows.Configs.AbstractTrajectoryConfig, CTFlows.Configs.AbstractStateConfig, CTFlows.Configs.AbstractHamiltonianConfig, CTFlows.Configs.AbstractAugmentedHamiltonianConfig.
AbstractEndPointConfig [Abstract Type]
CTFlows.Configs.AbstractEndPointConfig — Type
abstract type AbstractConfigWithMaC{X0, CTBase.Traits.EndPointMode, C} <: CTFlows.Configs.AbstractConfig{X0}Alias for point integration mode configurations.
Matches any AbstractConfig with EndPointMode as the mode parameter.
AbstractHamiltonianConfig [Abstract Type]
CTFlows.Configs.AbstractHamiltonianConfig — Type
abstract type AbstractConfigWithMaC{X0, M, CTBase.Traits.HamiltonianDynamics} <: CTFlows.Configs.AbstractConfig{X0}Alias for Hamiltonian content configurations.
Matches any AbstractConfig with HamiltonianDynamics as the dynamics parameter.
AbstractStateConfig [Abstract Type]
CTFlows.Configs.AbstractStateConfig — Type
abstract type AbstractConfigWithMaC{X0, M, CTBase.Traits.StateDynamics} <: CTFlows.Configs.AbstractConfig{X0}Alias for state content configurations.
Matches any AbstractConfig with StateDynamics as the dynamics parameter.
AbstractTrajectoryConfig [Abstract Type]
CTFlows.Configs.AbstractTrajectoryConfig — Type
abstract type AbstractConfigWithMaC{X0, CTBase.Traits.TrajectoryMode, C} <: CTFlows.Configs.AbstractConfig{X0}Alias for trajectory integration mode configurations.
Matches any AbstractConfig with TrajectoryMode as the mode parameter.
AugmentedHamiltonianEndPointConfig [Struct]
CTFlows.Configs.AugmentedHamiltonianEndPointConfig — Type
struct AugmentedHamiltonianEndPointConfig{T0<:Real, X0, P0, PV0, TF<:Real} <: CTFlows.Configs.AbstractConfigWithMaC{X0, CTBase.Traits.EndPointMode, CTBase.Traits.AugmentedHamiltonianDynamics}Configuration for an augmented Hamiltonian point-to-point integration problem.
Defines the initial and final time points along with the initial state, costate, and variable costate for integration from a single initial condition to a specific final time in the augmented Hamiltonian framework.
Fields
t0::T0: Initial timex0::X0: Initial state vectorp0::P0: Initial costate vectorpv0::PV0: Initial variable costate vector (typically zeros)tf::TF: Final time
Example
julia> using CTFlows.Configs
julia> config = AugmentedHamiltonianEndPointConfig(0.0, [1.0, 0.0], [0.5, 0.3], [0.0, 0.0], 1.0)
AugmentedHamiltonianEndPointConfig
t0: 0.0
x0: [1.0, 0.0]
p0: [0.5, 0.3]
pv0: [0.0, 0.0]
tf: 1.0See also: CTFlows.Configs.HamiltonianEndPointConfig, CTBase.Traits.AugmentedHamiltonianDynamics.
HamiltonianEndPointConfig [Struct]
CTFlows.Configs.HamiltonianEndPointConfig — Type
struct HamiltonianEndPointConfig{T0<:Real, X0, P0, TF<:Real} <: CTFlows.Configs.AbstractConfigWithMaC{X0, CTBase.Traits.EndPointMode, CTBase.Traits.HamiltonianDynamics}Configuration for a Hamiltonian point-to-point integration problem.
Defines the initial and final time points along with the initial state and costate for integration from a single initial condition to a specific final time in the Hamiltonian framework.
Fields
t0::T0: Initial timex0::X0: Initial state vectorp0::P0: Initial costate vectortf::TF: Final time
Example
julia> using CTFlows.Configs
julia> config = HamiltonianEndPointConfig(0.0, [1.0, 0.0], [0.5, 0.3], 1.0)
HamiltonianEndPointConfig
t0: 0.0
x0: [1.0, 0.0]
p0: [0.5, 0.3]
tf: 1.0See also: CTFlows.Configs.HamiltonianTrajectoryConfig, CTFlows.Configs.StateEndPointConfig.
HamiltonianTrajectoryConfig [Struct]
CTFlows.Configs.HamiltonianTrajectoryConfig — Type
struct HamiltonianTrajectoryConfig{TS<:(Tuple{var"#s11", var"#s9"} where {var"#s11"<:Real, var"#s9"<:Real}), X0, P0} <: CTFlows.Configs.AbstractConfigWithMaC{X0, CTBase.Traits.TrajectoryMode, CTBase.Traits.HamiltonianDynamics}Configuration for a Hamiltonian trajectory integration problem.
Defines a time span and initial state and costate for integration over a continuous time interval in the Hamiltonian framework, useful for generating full Hamiltonian trajectories.
Fields
tspan::TS: Time span as a tuple (t0, tf)x0::X0: Initial state vectorp0::P0: Initial costate vector
Example
julia> using CTFlows.Configs
julia> config = HamiltonianTrajectoryConfig((0.0, 1.0), [1.0, 0.0], [0.5, 0.3])
HamiltonianTrajectoryConfig
tspan: (0.0, 1.0)
x0: [1.0, 0.0]
p0: [0.5, 0.3]See also: CTFlows.Configs.HamiltonianEndPointConfig, CTFlows.Configs.StateTrajectoryConfig.
StateEndPointConfig [Struct]
CTFlows.Configs.StateEndPointConfig — Type
struct StateEndPointConfig{T0<:Real, X0, TF<:Real} <: CTFlows.Configs.AbstractConfigWithMaC{X0, CTBase.Traits.EndPointMode, CTBase.Traits.StateDynamics}Configuration for a point-to-point integration problem.
Defines the initial and final time points along with the initial state for integration from a single initial condition to a specific final time.
Fields
t0::T0: Initial timex0::X0: Initial state vectortf::TF: Final time
Example
julia> using CTFlows.Configs
julia> config = StateEndPointConfig(0.0, [1.0, 0.0], 1.0)
StateEndPointConfig
t0: 0.0
x0: [1.0, 0.0]
tf: 1.0See also: CTFlows.Configs.StateTrajectoryConfig
StateTrajectoryConfig [Struct]
CTFlows.Configs.StateTrajectoryConfig — Type
struct StateTrajectoryConfig{TS<:(Tuple{var"#s8", var"#s7"} where {var"#s8"<:Real, var"#s7"<:Real}), X0} <: CTFlows.Configs.AbstractConfigWithMaC{X0, CTBase.Traits.TrajectoryMode, CTBase.Traits.StateDynamics}Configuration for a trajectory integration problem.
Defines a time span and initial state for integration over a continuous time interval, useful for generating full trajectories.
Fields
tspan::TS: Time span as a tuple (t0, tf)x0::X0: Initial state vector
Example
julia> using CTFlows.Configs
julia> config = StateTrajectoryConfig((0.0, 1.0), [1.0, 0.0])
StateTrajectoryConfig
tspan: (0.0, 1.0)
x0: [1.0, 0.0]See also: CTFlows.Configs.StateEndPointConfig
dynamics_trait [Function]
CTFlows.Configs.dynamics_trait — Function
dynamics_trait(
_::CTFlows.Configs.AbstractConfigWithMaC{X0, Mode, Dyn}
) -> Any
Return the dynamics trait type of a configuration.
Extracts the Dyn type parameter from the configuration's parametric type, enabling trait-based dispatch on the integration dynamics (state, Hamiltonian, augmented Hamiltonian).
Arguments
::AbstractConfigWithMaC{X0, Mode, Dyn}: Any concrete configuration subtype.
Returns
Type{Dyn}: The dynamics trait type (e.g.,StateDynamics,HamiltonianDynamics, orAugmentedHamiltonianDynamics).
Example
config = Configs.HamiltonianEndPointConfig(0.0, [1.0], [0.5], 1.0)
Configs.dynamics_trait(config) === Traits.HamiltonianDynamics # trueSee also: CTFlows.Configs.AbstractConfigWithMaC, CTBase.Traits.StateDynamics, CTBase.Traits.HamiltonianDynamics, CTBase.Traits.AugmentedHamiltonianDynamics, CTFlows.Configs.mode_trait.
final_time [Function]
CTFlows.Configs.final_time — Function
final_time(c::CTFlows.Configs.AbstractConfig) -> Real
Return the final time for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific final time.
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig, CTFlows.Configs.initial_time.
final_time(
c::CTFlows.Configs.AbstractEndPointConfig
) -> Real
Return the final time for point configurations.
For point configurations, returns the stored tf field directly.
Arguments
c::AbstractEndPointConfig: The point configuration.
Returns
Real: Final time tf.
See also: CTFlows.Configs.AbstractEndPointConfig, CTFlows.Configs.final_time.
final_time(
c::CTFlows.Configs.AbstractTrajectoryConfig
) -> Real
Return the final time for trajectory configurations.
For trajectory configurations, returns the second element of the stored tspan field.
Arguments
c::AbstractTrajectoryConfig: The trajectory configuration.
Returns
Real: Final time tf.
See also: CTFlows.Configs.AbstractTrajectoryConfig, CTFlows.Configs.final_time.
initial_condition [Function]
CTFlows.Configs.initial_condition — Function
initial_condition(
c::CTFlows.Configs.AbstractConfig
) -> Vector
Return the initial condition for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific initial condition format.
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig.
initial_condition(
c::CTFlows.Configs.AbstractConfigWithMaC{<:Number, M, CTBase.Traits.StateDynamics}
) -> Vector
Return the initial condition as a vector for scalar state configurations.
For scalar initial conditions, wraps the scalar in a length-1 vector to maintain consistent vector-based ODE problem construction.
Arguments
c::AbstractStateConfig{<:Number, M}: The state configuration with scalar initial state.
Returns
Vector{<:Number}: Length-1 vector containing the scalar initial state.
See also: CTFlows.Configs.AbstractStateConfig, CTFlows.Configs.initial_condition.
initial_condition(
c::CTFlows.Configs.AbstractStateConfig
) -> Vector
Return the initial condition for state configurations.
For vector initial conditions, returns the state vector directly.
Arguments
c::AbstractStateConfig: The state configuration.
Returns
- The initial state vector.
See also: CTFlows.Configs.AbstractStateConfig.
initial_condition(
c::CTFlows.Configs.AbstractHamiltonianConfig
) -> Any
Return the initial condition for Hamiltonian configurations.
For Hamiltonian systems, the initial condition is the concatenation of the initial state and initial costate: vcat(x0, p0).
Arguments
c::AbstractHamiltonianConfig: The Hamiltonian configuration.
Returns
- Concatenated vector
[x0; p0].
See also: CTFlows.Configs.AbstractHamiltonianConfig, CTFlows.Configs.initial_state, CTFlows.Configs.initial_costate.
initial_condition(
c::CTFlows.Configs.AugmentedHamiltonianEndPointConfig
) -> Any
Return the initial condition for augmented Hamiltonian configurations.
For augmented Hamiltonian systems, the initial condition is the concatenation of the initial state, initial costate, and initial variable costate: vcat(x0, p0, pv0).
Arguments
c::AugmentedHamiltonianEndPointConfig: The augmented Hamiltonian configuration.
Returns
- Concatenated vector
[x0; p0; pv0].
See also: CTFlows.Configs.AugmentedHamiltonianEndPointConfig, CTFlows.Configs.initial_state, CTFlows.Configs.initial_costate, CTFlows.Configs.initial_variable_costate.
initial_costate [Function]
CTFlows.Configs.initial_costate — Function
initial_costate(c::CTFlows.Configs.AbstractConfig)
Return the initial costate for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific initial costate (if applicable).
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig.
initial_costate(c::CTFlows.Configs.AbstractStateConfig)
Return the initial costate for state configurations (error stub).
State configurations do not have a costate field. This method throws a PreconditionError to enforce the contract that initial_costate is only defined for Hamiltonian configurations.
Arguments
c::AbstractStateConfig: The state configuration.
Throws
Exceptions.PreconditionError: Always thrown for state configurations.
See also: CTFlows.Configs.AbstractStateConfig, CTFlows.Configs.AbstractHamiltonianConfig, CTFlows.Configs.initial_costate.
initial_costate(
c::CTFlows.Configs.AbstractHamiltonianConfig
) -> Any
Return the initial costate for Hamiltonian configurations.
Extracts the initial costate field from the Hamiltonian configuration.
Arguments
c::AbstractHamiltonianConfig: The Hamiltonian configuration.
Returns
- The initial costate vector.
See also: CTFlows.Configs.AbstractHamiltonianConfig.
initial_costate(
c::CTFlows.Configs.AugmentedHamiltonianEndPointConfig
) -> Any
Return the initial costate for augmented Hamiltonian configurations.
Extracts the initial costate field from the augmented Hamiltonian configuration.
Arguments
c::AugmentedHamiltonianEndPointConfig: The augmented Hamiltonian configuration.
Returns
- The initial costate vector.
See also: CTFlows.Configs.AugmentedHamiltonianEndPointConfig.
initial_state [Function]
CTFlows.Configs.initial_state — Function
initial_state(c::CTFlows.Configs.AbstractConfig) -> Any
Return the initial state for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific initial state.
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig.
initial_state(
c::CTFlows.Configs.AbstractConfigWithMaC
) -> Any
Return the initial state from a configuration.
Extracts the initial state field from the configuration.
Arguments
c::AbstractConfigWithMaC: The configuration with mode and content traits.
Returns
- The initial state vector.
See also: CTFlows.Configs.AbstractConfigWithMaC.
initial_time [Function]
CTFlows.Configs.initial_time — Function
initial_time(c::CTFlows.Configs.AbstractConfig) -> Real
Return the initial time for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific initial time.
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig, CTFlows.Configs.final_time.
initial_time(
c::CTFlows.Configs.AbstractEndPointConfig
) -> Real
Return the initial time for point configurations.
For point configurations, returns the stored t0 field directly.
Arguments
c::AbstractEndPointConfig: The point configuration.
Returns
Real: Initial time t0.
See also: CTFlows.Configs.AbstractEndPointConfig, CTFlows.Configs.initial_time.
initial_time(
c::CTFlows.Configs.AbstractTrajectoryConfig
) -> Real
Return the initial time for trajectory configurations.
For trajectory configurations, returns the first element of the stored tspan field.
Arguments
c::AbstractTrajectoryConfig: The trajectory configuration.
Returns
Real: Initial time t0.
See also: CTFlows.Configs.AbstractTrajectoryConfig, CTFlows.Configs.initial_time.
initial_variable_costate [Function]
CTFlows.Configs.initial_variable_costate — Function
initial_variable_costate(
c::CTFlows.Configs.AbstractConfig
) -> Any
Return the initial variable costate for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific initial variable costate (if applicable).
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig.
initial_variable_costate(
c::CTFlows.Configs.AugmentedHamiltonianEndPointConfig
) -> Any
Return the initial variable costate for augmented Hamiltonian configurations.
Extracts the initial variable costate field from the augmented Hamiltonian configuration.
Arguments
c::AugmentedHamiltonianEndPointConfig: The augmented Hamiltonian configuration.
Returns
- The initial variable costate vector.
See also: CTFlows.Configs.AugmentedHamiltonianEndPointConfig.
mode_trait [Function]
CTFlows.Configs.mode_trait — Function
mode_trait(
_::CTFlows.Configs.AbstractConfigWithMaC{X0, Mode, Dyn}
) -> Any
Return the mode trait type of a configuration.
Extracts the Mode type parameter from the configuration's parametric type, enabling trait-based dispatch on the integration mode (point vs trajectory).
Arguments
::AbstractConfigWithMaC{X0, Mode, Content}: Any concrete configuration subtype.
Returns
Type{Mode}: The mode trait type (e.g.,EndPointModeorTrajectoryMode).
Example
config = Configs.HamiltonianEndPointConfig(0.0, [1.0], [0.5], 1.0)
Configs.mode_trait(config) === Traits.EndPointMode # trueSee also: CTFlows.Configs.AbstractConfigWithMaC, CTBase.Traits.EndPointMode, CTBase.Traits.TrajectoryMode, CTFlows.Configs.dynamics_trait.
tspan [Function]
CTFlows.Configs.tspan — Function
tspan(
c::CTFlows.Configs.AbstractConfig
) -> Tuple{Real, Real}
Return the time span for a configuration (stub method).
This is a stub method on the base AbstractConfig type that throws NotImplemented. Concrete subtypes should implement this method to return their specific time span format.
Arguments
c::AbstractConfig: The configuration.
Throws
Exceptions.NotImplemented: Always thrown for the base abstract type.
See also: CTFlows.Configs.AbstractConfig.
tspan(
c::CTFlows.Configs.AbstractEndPointConfig
) -> Tuple{Real, Real}
Return the time span as a tuple for point configurations.
For point configurations, extracts the initial and final times from the t0 and tf fields.
Arguments
c::AbstractEndPointConfig: The point configuration.
Returns
Tuple{Real, Real}: Time span as (t0, tf).
See also: CTFlows.Configs.AbstractEndPointConfig, CTFlows.Configs.tspan.
tspan(
c::CTFlows.Configs.AbstractTrajectoryConfig
) -> Tuple{Real, Real}
Return the time span for trajectory configurations.
For trajectory configurations, returns the stored tspan field directly.
Arguments
c::AbstractTrajectoryConfig: The trajectory configuration.
Returns
Tuple{Real, Real}: Time span as (t0, tf).
See also: CTFlows.Configs.AbstractTrajectoryConfig, CTFlows.Configs.tspan.