Public API
This page lists exported symbols of CTFlows.Flows.
From CTFlows.Flows
CTFlows.Flows [Module]
CTFlows.Flows Module
FlowsFlow types and contracts for CTFlows.
This module defines the AbstractFlow type and its required methods:
(flow)(t0, x0, tf): callable interface for state integration(flow)(t0, x0, p0, tf): callable interface for state + costate integrationsystem: returns the system associated with the flowintegrator: returns the integrator used by the flow
AbstractFlow [Abstract Type]
CTFlows.Flows.AbstractFlow Type
abstract type AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}Abstract type for all flows in CTFlows.
An AbstractFlow is a callable object that combines an AbstractSystem with an AbstractIntegrator. It carries no business logic of its own — its job is to expose the integration protocol.
Interface Requirements
All subtypes must implement:
system(flow::AbstractFlow): Return the associatedAbstractSystem.integrator(flow::AbstractFlow): Return the associatedAbstractIntegrator.
Traits
All AbstractFlow subtypes automatically support time-dependence and variable-dependence trait queries encoded in their type parameters:
time_dependence(flow): Returns the time-dependence trait type.variable_dependence(flow): Returns the variable-dependence trait type.is_autonomous(flow),is_nonautonomous(flow): Time-dependence predicates.is_variable(flow),is_nonvariable(flow),has_variable(flow): Variable-dependence predicates.
Example
julia> using CTFlows.Flows
julia> MyFlow <: Flows.AbstractFlow
trueSee also: CTFlows.Flows.Flow, CTFlows.Systems.AbstractSystem, CTSolvers.Integrators.AbstractIntegrator.
AbstractHamiltonianFlow [Abstract Type]
CTFlows.Flows.AbstractHamiltonianFlow Type
abstract type AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics}Alias for Hamiltonian flows.
Matches any AbstractFlow with HamiltonianDynamics as the dynamics parameter.
Type Parameters
TD <: TimeDependence: Time dependence trait (Autonomous or NonAutonomous)VD <: VariableDependence: Variable dependence trait (Fixed or NonFixed)
Example
julia> using CTFlows.Flows
julia> Flow(hvf) isa Flows.AbstractHamiltonianFlow
trueSee also: CTFlows.Flows.AbstractFlow, CTFlows.Flows.AbstractStateFlow.
AbstractStateFlow [Abstract Type]
CTFlows.Flows.AbstractStateFlow Type
abstract type AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics}Alias for state flows.
Matches any AbstractFlow with StateDynamics as the dynamics parameter.
Type Parameters
TD <: TimeDependence: Time dependence trait (Autonomous or NonAutonomous)VD <: VariableDependence: Variable dependence trait (Fixed or NonFixed)
Example
julia> using CTFlows.Flows
julia> Flow(vf) isa Flows.AbstractStateFlow
trueSee also: CTFlows.Flows.AbstractFlow, CTFlows.Flows.AbstractHamiltonianFlow.
ControlledFlow [Struct]
CTFlows.Flows.ControlledFlow Type
struct ControlledFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, IF, M, L} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics}State flow of a controlled dynamical system with an OpenLoop or ClosedLoop control law, built by CTFlows.Flows.Flow from Flow(ocp, law) or Flow(fc, law).
Unlike an CTFlows.Flows.OptimalControlFlow (Hamiltonian, with a costate), this is a state flow: point evaluation is f(t0, x0, tf; variable) (no costate) and a trajectory call returns a CTFlows.Trajectories.StateFlowTrajectory.
Type Parameters
TD,VD: time/variable dependence, inherited from the inner flow.IF: type of the inner state flow.M: type of the OCP model, orNothing(forFlow(fc, law)).L: type of the control law.
Fields
flow::IF: the inner state flow integratingẋ = g(t, x, v).ocp::M: the OCP model (for the objective), ornothing.law::L: the control law, used to reconstructu(t).
See also: CTFlows.Trajectories.StateFlowTrajectory, CTFlows.Flows.Flow.
Flow [Struct]
CTFlows.Flows.Flow Type
struct Flow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait, S<:CTFlows.Systems.AbstractSystem{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}, I<:CTSolvers.Integrators.AbstractIntegrator} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}Concrete flow combining an AbstractSystem with an AbstractIntegrator.
The dynamics axis is encoded in the type parameter D:
D = StateDynamics→ state flow (access viaStateFlowalias)D = HamiltonianDynamics→ Hamiltonian flow (access viaHamiltonianFlowalias)
Type Parameters
TD <: TimeDependence: Time dependence trait (Autonomous or NonAutonomous)VD <: VariableDependence: Variable dependence trait (Fixed or NonFixed)D <: AbstractDynamicsTrait: Dynamics trait (StateDynamicsorHamiltonianDynamics)S <: AbstractSystem{TD, VD, D}: The system typeI <: AbstractIntegrator: The integrator type
Fields
system::S: The system to integrateintegrator::I: The integrator to use for integration
Example
julia> using CTFlows.Flows, CTFlows.Systems, CTFlows.Integrators
julia> system = VectorFieldSystem(VectorField(x -> -x))
julia> integrator = SciML()
julia> flow = StateFlow(system, integrator)
StateFlow{...}See also: CTFlows.Flows.AbstractFlow, CTFlows.Flows.StateFlow, CTFlows.Flows.HamiltonianFlow.
HamiltonianFlow [Struct]
CTFlows.Flows.HamiltonianFlow Type
struct Flow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics, S<:CTFlows.Systems.AbstractSystem{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics}, I<:CTSolvers.Integrators.AbstractIntegrator} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics}Alias for Hamiltonian flows: Flow{TD, VD, HamiltonianDynamics, S, I}.
See also: CTFlows.Flows.Flow, CTFlows.Flows.StateFlow.
OptimalControlFlow [Struct]
CTFlows.Flows.OptimalControlFlow Type
struct OptimalControlFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, IF, M, CL, SF} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.HamiltonianDynamics}Flow of the Hamiltonian system associated with a (control-free) optimal control problem, built by CTFlows.Flows.Flow from a CTModels.Models.Model.
It is a thin CTFlows.Flows.AbstractFlow wrapper around an inner HamiltonianFlow: point evaluation delegates to the inner flow (returning the final state–costate pair), while a trajectory call integrates the system and rebuilds a full CTModels.Solutions.Solution from the problem.
Type Parameters
TD <: TimeDependence: time-dependence trait, inherited from the problem.VD <: VariableDependence: variable-dependence trait, inherited from the problem.IF: type of the innerHamiltonianFlow.M: type of the wrapped optimal control problem model.CL: type of the control law (Nothingfor a control-free OCP, aCTBase.Data.ControlLawwhen the flow was built from an OCP and a control law).SF: type of the inner control-free state flow (Nothingunless the OCP is control-free — seestate_flow).
Fields
flow::IF: the inner Hamiltonian flow doing the integration.ocp::M: the optimal control problem, kept so trajectory calls can build a solution.law::CL: the control law, used to reconstructu(t)along the trajectory (ornothingfor control-free problems).state_flow::SF: inner state flow ofẋ = f(t,x,∅,v), built only for a control-free OCP (Flow(ocp), no law);nothingotherwise. Backs the basic (no-costate) call aritiesf(t0,x0,tf)/f((t0,tf),x0)— seeCTFlows.Flows._ocp_state_vector_field.
See also: CTFlows.Flows.Flow, CTModels.Solutions.Solution.
StateFlow [Struct]
CTFlows.Flows.StateFlow Type
struct Flow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics, S<:CTFlows.Systems.AbstractSystem{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics}, I<:CTSolvers.Integrators.AbstractIntegrator} <: CTFlows.Flows.AbstractFlow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, CTBase.Traits.StateDynamics}Alias for state flows: Flow{TD, VD, StateDynamics, S, I}.
See also: CTFlows.Flows.Flow, CTFlows.Flows.HamiltonianFlow.
__unsafe [Function]
CTFlows.Flows.__unsafe Function
__unsafe() -> BoolDefault value for unsafe flag in integration functions.
Returns false by default, meaning ODE solver retcodes are checked and failures throw exceptions unless explicitly bypassed.
__variable [Function]
CTFlows.Flows.__variable Function
__variable() -> CTBase.Core.NotProvidedTypeDefault value for variable parameter in user-facing API calls.
Returns CTBase.Core.NotProvided by default, meaning the variable parameter is optional unless required by the system's trait (e.g., NonFixed systems).
See also: CTBase.Traits.VariableDependence, CTBase.Traits.Fixed, CTBase.Traits.NonFixed.
__variable_costate [Function]
CTFlows.Flows.__variable_costate Function
__variable_costate() -> BoolDefault value for variable_costate flag in Hamiltonian flow calls.
Returns false by default, meaning the flow does not integrate the augmented variable costate equation ṗᵥ = -∂H/∂v unless explicitly requested.
Returns
Bool: The default value for thevariable_costateparameter.
See also: CTFlows.Configs.AugmentedHamiltonianEndPointConfig.
build_flow [Function]
CTFlows.Flows.build_flow Function
build_flow(
system::CTFlows.Systems.AbstractSystem,
integrator::CTSolvers.Integrators.AbstractIntegrator
) -> CTFlows.Flows.FlowBuild a Flow from a system and an integrator.
See also: CTFlows.Flows.Flow.
flow_registry [Function]
CTFlows.Flows.flow_registry Function
flow_registry() -> CTBase.Strategies.StrategyRegistryReturn the strategy registry for flow construction.
The registry maps abstract strategy families to their concrete implementations for automatic differentiation backends and ODE integrators.
Returns
CTBase.Strategies.StrategyRegistry: Registry with:di(DifferentiationInterface) and:sciml(SciML) strategies registered.
Notes
This registry is used by
CTFlows.Flows._route_flow_optionsto resolve and build concrete strategy instances from keyword arguments.The registry is precomputed and cached in
_FLOW_REGISTRYfor performance.
See also: CTFlows.Flows._route_flow_options, CTFlows.Flows._build_flow_components, CTBase.Strategies.create_registry
integrator [Function]
CTFlows.Flows.integrator Function
integrator(
flow::CTFlows.Flows.AbstractFlow
) -> CTSolvers.Integrators.AbstractIntegratorReturn the associated AbstractIntegrator for the flow.
Throws
CTBase.Exceptions.NotImplemented: If not implemented by the concrete type.
See also: CTFlows.Flows.AbstractFlow, CTSolvers.Integrators.AbstractIntegrator.
integrator(
f::CTFlows.Flows.Flow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait, S<:CTFlows.Systems.AbstractSystem{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}, I<:CTSolvers.Integrators.AbstractIntegrator}
) -> CTSolvers.Integrators.AbstractIntegratorReturn the integrator associated with a Flow.
See also: CTFlows.Flows.Flow, CTFlows.Flows.system.
integrator(F::CTFlows.Flows.ControlledFlow) -> AnyReturn the underlying CTSolvers.Integrators.AbstractIntegrator of the inner state flow.
integrator(mpsf::CTFlows.MultiPhase.MultiPhaseFlow) -> AnyReturn the integrators associated with a multi-phase flow as a tuple.
See also: CTFlows.Flows.integrator.
system [Function]
CTFlows.Flows.system Function
system(flow::CTFlows.Flows.AbstractFlow)Return the associated AbstractSystem for the flow.
Throws
CTBase.Exceptions.NotImplemented: If not implemented by the concrete type.
See also: CTFlows.Flows.AbstractFlow, CTFlows.Systems.AbstractSystem.
system(
f::CTFlows.Flows.Flow{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait, S<:CTFlows.Systems.AbstractSystem{TD<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence, D<:CTBase.Traits.AbstractDynamicsTrait}, I<:CTSolvers.Integrators.AbstractIntegrator}
) -> AnyReturn the system associated with a Flow.
See also: CTFlows.Flows.Flow, CTFlows.Flows.integrator.
system(F::CTFlows.Flows.ControlledFlow) -> AnyReturn the underlying CTFlows.Systems.AbstractSystem of the inner state flow.
system(mpsf::CTFlows.MultiPhase.MultiPhaseFlow) -> AnyReturn the systems associated with a multi-phase flow as a tuple.
See also: CTFlows.Flows.system.