Skip to content

Public API

This page lists exported symbols of CTBase.Traits.


From CTBase.Traits

CTBase.Traits [Module]

CTBase.Traits Module
julia
Traits

Compile-time trait types and trait-based dispatch utilities.

Traits are abstract or empty concrete types used as type parameters or returned by accessor functions. Behaviour is selected by dispatch at compile time, with no runtime cost.

Organization

  • abstract.jl: Root abstract type AbstractTrait and family abstractions

  • time_dependence.jl: Time-dependence traits and the opt-in contract

  • variable_dependence.jl: Variable-dependence traits and the opt-in contract

  • control_dependence.jl: Control-dependence traits and the opt-in contract

  • feedback.jl: Feedback traits (OpenLoopFeedback, ClosedLoopFeedback, DynClosedLoopFeedback)

  • constraint_kind.jl: Constraint-kind traits (StateConstraintKind, ControlConstraintKind, MixedConstraintKind)

  • mutability.jl: Mutability traits and the opt-in contract

  • mode.jl: Integration-mode traits (EndPointMode, TrajectoryMode)

  • dynamics.jl: Dynamics-type traits (StateDynamics, HamiltonianDynamics, AugmentedHamiltonianDynamics)

  • ad.jl: Automatic-differentiation traits (WithAD, WithoutAD)

  • variable_costate.jl: Variable-costate traits (SupportsVariableCostate, NoVariableCostate)

  • helpers.jl: Internal utility (_caller_function_name)

Public API

Trait families

  • Time dependence: TimeDependence, Autonomous, NonAutonomous

  • Variable dependence: VariableDependence, Fixed, NonFixed

  • Control dependence: ControlDependence, ControlFree, WithControl

  • Feedback: AbstractFeedback, OpenLoopFeedback, ClosedLoopFeedback, DynClosedLoopFeedback

  • Constraint kind: AbstractConstraintKind, StateConstraintKind, ControlConstraintKind, MixedConstraintKind

  • Mutability: InPlace, OutOfPlace

  • Integration mode: EndPointMode, TrajectoryMode

  • Dynamics: StateDynamics, HamiltonianDynamics, AugmentedHamiltonianDynamics

  • Automatic differentiation: WithAD, WithoutAD

  • Variable costate: SupportsVariableCostate, NoVariableCostate

Trait contracts — two templates

Trait families follow one of two contracts. The choice is dictated by a single question: does a safe default value exist?

1. Strict opt-in (no safe default). Time-dependence, variable-dependence, control-dependence, and mutability. Guessing a value silently would be a correctness bug (an object is either autonomous or not), so there is no default: a type must opt in by implementing two methods — has_<family>_trait returning true, and an accessor (time_dependence, variable_dependence, control_dependence, mutability) returning the trait type. The fallbacks throw loudly (CTBase.Exceptions.IncorrectArgument / CTBase.Exceptions.NotImplemented) via the shared helpers _throw_missing_trait / _throw_trait_not_implemented. Boolean predicates (is_autonomous, is_variable, is_control_free, is_inplace, …) are derived generically.

2. Default-valued capability (safe default exists). Automatic differentiation (ad_trait(::Any) = WithoutAD) and variable-costate (variable_costate_trait(::Any) = NoVariableCostate). These are capabilities: a conservative "no" is always safe, so the extractor returns a default for any object and concrete types override it. No has_<family>_trait guard, no derived predicates.

The remaining families (EndPointMode, StateDynamics) are used as type parameters only (read from a concrete type's parameters, e.g. AbstractSystem{TD,VD,D}) and use neither contract.

AbstractADTrait [Abstract Type]

CTBase.Traits.AbstractADTrait Type
julia
abstract type AbstractADTrait <: CTBase.Traits.AbstractTrait

Abstract base type for automatic differentiation capability traits.

AD traits encode whether a system supports automatic differentiation for gradient computation. This distinction enables compile-time dispatch for cache preparation, derivative computation, and other AD-related operations.

Common use cases include:

  • Hamiltonian systems: distinguishing between scalar Hamiltonians with AD backends and pre-computed Hamiltonian vector fields

  • General optimization: marking systems that can compute gradients via AD vs. those with manual derivative implementations

  • Cache preparation: enabling static dispatch for AD-specific cache initialization

Example

julia
julia> using CTBase.Traits

julia> WithAD() isa Traits.AbstractADTrait
true

julia> WithoutAD() isa Traits.AbstractADTrait
true

Notes

  • AD traits are used as type parameters in system types to enable static dispatch

  • WithAD indicates the system carries differentiable functions and an AD backend

  • WithoutAD indicates the system uses pre-computed derivatives or manual implementations

  • The specific meaning depends on the system type and context

See also: CTBase.Traits.WithAD, CTBase.Traits.WithoutAD, CTBase.Core.AbstractCache.

AbstractConstraintKind [Abstract Type]

CTBase.Traits.AbstractConstraintKind Type
julia
abstract type AbstractConstraintKind <: CTBase.Traits.AbstractTrait

Abstract base type for constraint-kind traits.

Constraint-kind traits encode, at the type level, which primal variables a path constraint g(...) depends on. They distinguish between pure state constraints, pure control constraints, and mixed state–control constraints.

Trait Pattern

This trait follows the type-parameter-only contract (like CTBase.Traits.AbstractFeedback): the trait value is read from a type parameter of the concrete data type (e.g. PathConstraint{F,K,TD,VD}) by the constraint_kind accessor. No has_constraint_kind_trait guard is provided; calling constraint_kind on a type that does not implement it yields a standard MethodError.

See also: CTBase.Traits.StateConstraintKind, CTBase.Traits.ControlConstraintKind, CTBase.Traits.MixedConstraintKind, CTBase.Traits.constraint_kind.

AbstractDynamicsTrait [Abstract Type]

CTBase.Traits.AbstractDynamicsTrait Type
julia
abstract type AbstractDynamicsTrait <: CTBase.Traits.AbstractTrait

Abstract base type for dynamics traits (State vs Hamiltonian).

Dynamics traits encode the dynamics type in configuration types, distinguishing between state-only configurations (no costate) and Hamiltonian configurations (state + costate).

Example

julia
julia> using CTBase.Traits

julia> StateDynamics <: Traits.AbstractDynamicsTrait
true

julia> HamiltonianDynamics <: Traits.AbstractDynamicsTrait
true

Notes

  • State dynamics indicates configurations with only state variables (no costate)

  • Hamiltonian dynamics indicates configurations with both state and costate variables

See also: CTBase.Traits.StateDynamics, CTBase.Traits.HamiltonianDynamics.

AbstractFeedback [Abstract Type]

CTBase.Traits.AbstractFeedback Type
julia
abstract type AbstractFeedback <: CTBase.Traits.AbstractTrait

Abstract base type for feedback traits.

Feedback traits encode, at the type level, the kind of control law used to close the loop in an optimal control flow. They distinguish between open-loop control (time-only dependence), closed-loop control (state dependence), and dynamic closed-loop control (state and costate dependence).

Trait Pattern

This trait follows the type-parameter-only contract (like CTBase.Traits.AbstractDynamicsTrait): the trait value is read from a type parameter of the concrete data type (e.g. ControlLaw{F,FB,TD,VD}) by the feedback accessor. No has_feedback_trait guard is provided; calling feedback on a type that does not implement it yields a standard MethodError.

See also: CTBase.Traits.OpenLoopFeedback, CTBase.Traits.ClosedLoopFeedback, CTBase.Traits.DynClosedLoopFeedback, CTBase.Traits.feedback.

AbstractModeTrait [Abstract Type]

CTBase.Traits.AbstractModeTrait Type
julia
abstract type AbstractModeTrait <: CTBase.Traits.AbstractTrait

Abstract base type for mode traits (Point vs Trajectory).

Mode traits encode the integration mode in configuration types, distinguishing between point-to-point integration (single endpoint evaluation) and trajectory integration (full time evolution).

Example

julia
julia> using CTBase.Traits

julia> EndPointMode <: Traits.AbstractModeTrait
true

julia> TrajectoryMode <: Traits.AbstractModeTrait
true

Notes

  • Point mode indicates integration from a single initial condition to a specific final time

  • Trajectory mode indicates integration over a continuous time interval

See also: CTBase.Traits.EndPointMode, CTBase.Traits.TrajectoryMode.

AbstractMutabilityTrait [Abstract Type]

CTBase.Traits.AbstractMutabilityTrait Type
julia
abstract type AbstractMutabilityTrait <: CTBase.Traits.AbstractTrait

Abstract trait for mutability characteristics of function evaluation.

Distinguishes between in-place functions (which modify a pre-allocated buffer) and out-of-place functions (which allocate and return new results).

Subtypes must implement:

  • InPlace: For functions that write to a mutable buffer

  • OutOfPlace: For functions that return newly allocated results

Example

julia
julia> using CTBase.Traits

julia> InPlace() isa AbstractMutabilityTrait
true

julia> OutOfPlace() isa AbstractMutabilityTrait
true

See also: CTBase.Traits.InPlace, CTBase.Traits.OutOfPlace.

AbstractTrait [Abstract Type]

CTBase.Traits.AbstractTrait Type
julia
abstract type AbstractTrait

Abstract base type for all trait markers.

Traits are empty marker types used as type parameters to encode properties at compile time. Unlike tags (which mark extension implementations), traits encode semantic properties of an object (e.g., integration mode, dynamics type, mutability). All concrete trait types are empty structs with no fields, making them zero-cost at runtime.

Interface Requirements

Concrete trait subtypes should:

  • Be empty structs with no fields (pure markers)

  • Subtype an intermediate abstract trait category (e.g., AbstractModeTrait)

  • Be used as type parameters or returned by accessor functions

Example

julia
julia> using CTBase.Traits

julia> EndPointMode <: Traits.AbstractTrait
true

julia> EndPointMode <: Traits.AbstractModeTrait
true

Notes

  • Traits are distinct from tags: tags mark extension implementations (e.g., SciMLTag), while traits encode configuration semantics (e.g., EndPointMode)

  • All trait types have zero runtime overhead (empty structs)

  • The trait pattern enables static dispatch on configuration properties

See also: CTBase.Traits.VariableDependence, CTBase.Traits.AbstractModeTrait, CTBase.Traits.AbstractDynamicsTrait, CTBase.Traits.AbstractMutabilityTrait.

AbstractVariableCostateCapability [Abstract Type]

CTBase.Traits.AbstractVariableCostateCapability Type
julia
abstract type AbstractVariableCostateCapability <: CTBase.Traits.AbstractTrait

Abstract base type for variable costate capability traits.

Variable costate capability traits encode whether a system or flow can integrate augmented variables (e.g., parameters, controls) and compute their associated costates. This capability is used for trait-based dispatch in augmented integration.

Common use cases include:

  • Hamiltonian systems: computing the costate of an augmented variable (∂H/∂v integration)

  • Optimal control: integrating control variables with their adjoint equations

  • Parameter estimation: treating parameters as dynamic variables with derivatives

Example

julia
julia> using CTBase.Traits

julia> SupportsVariableCostate() isa Traits.AbstractVariableCostateCapability
true

julia> NoVariableCostate() isa Traits.AbstractVariableCostateCapability
true

Notes

  • SupportsVariableCostate indicates the system can compute derivatives with respect to augmented variables

  • NoVariableCostate indicates the system cannot compute such derivatives

  • This trait is used for dispatch to determine whether augmented integration is possible

  • The specific operations enabled depend on the system type and context

See also: CTBase.Traits.SupportsVariableCostate, CTBase.Traits.NoVariableCostate.

AugmentedHamiltonianDynamics [Struct]

CTBase.Traits.AugmentedHamiltonianDynamics Type
julia
struct AugmentedHamiltonianDynamics <: CTBase.Traits.AbstractDynamicsTrait

Trait marker for augmented Hamiltonian dynamics, where the Hamiltonian includes an augmented variable (e.g., a parameter or control variable) in addition to state and costate variables.

Notes

See also: CTBase.Traits.HamiltonianDynamics, CTBase.Traits.AbstractDynamicsTrait.

Autonomous [Abstract Type]

CTBase.Traits.Autonomous Type
julia
abstract type Autonomous <: CTBase.Traits.TimeDependence

Type tag indicating that the dynamics and other functions do not explicitly depend on time. For autonomous systems, the dynamics have the form ẋ = f(x, u) rather than ẋ = f(t, x, u).

See also: CTBase.Traits.TimeDependence, CTBase.Traits.NonAutonomous.

ClosedLoopFeedback [Struct]

CTBase.Traits.ClosedLoopFeedback Type
julia
struct ClosedLoopFeedback <: CTBase.Traits.AbstractFeedback

Trait indicating closed-loop feedback: the control depends on the state (and optionally time and variable), but not on the costate.

A closed-loop control law has the form u(t, x) (or u(t, x, v) for variable problems). The control is a function of the current state, providing static state feedback without costate information.

See also: CTBase.Traits.OpenLoopFeedback, CTBase.Traits.DynClosedLoopFeedback, CTBase.Traits.AbstractFeedback.

ControlConstraintKind [Struct]

CTBase.Traits.ControlConstraintKind Type
julia
struct ControlConstraintKind <: CTBase.Traits.AbstractConstraintKind

Trait indicating a pure control path constraint: g depends on the control (and optionally time and variable), but not on the state.

A control constraint has the form g(u) (or g(t, u), g(u, v), g(t, u, v)).

See also: CTBase.Traits.StateConstraintKind, CTBase.Traits.MixedConstraintKind, CTBase.Traits.AbstractConstraintKind.

ControlDependence [Abstract Type]

CTBase.Traits.ControlDependence Type
julia
abstract type ControlDependence <: CTBase.Traits.AbstractTrait

Abstract supertype for control-dependence traits.

Encodes, at the type level, whether an optimal control problem (or any object that opts into the trait) carries a control input.

Trait Pattern

Objects that have a control-dependence trait must implement two methods:

  • has_control_dependence_trait(obj::MyType) = true: Indicates the type has this trait

  • control_dependence(obj::MyType): Returns the specific trait value (ControlFree or WithControl)

Once these are implemented, the object automatically gains:

  • is_control_free(obj): Returns true if control_dependence(obj) is ControlFree

  • has_control(obj): Returns true if control_dependence(obj) is WithControl

If has_control_dependence_trait is not implemented or returns false, calling is_control_free, has_control, or control_dependence will throw an error indicating the object does not support control-dependence queries.

See also: CTBase.Traits.ControlFree, CTBase.Traits.WithControl.

ControlFree [Struct]

CTBase.Traits.ControlFree Type
julia
struct ControlFree <: CTBase.Traits.ControlDependence

Trait indicating the problem has no control input (control-free).

A control-free optimal control problem has dynamics ẋ = f(t, x, v) with no control argument; the trajectory is determined by the state (and costate) equations alone, without a control law.

See also: CTBase.Traits.WithControl, CTBase.Traits.ControlDependence.

DynClosedLoopFeedback [Struct]

CTBase.Traits.DynClosedLoopFeedback Type
julia
struct DynClosedLoopFeedback <: CTBase.Traits.AbstractFeedback

Trait indicating dynamic closed-loop feedback: the control depends on both the state and the costate (and optionally time and variable).

A dynamic closed-loop control law has the form u(t, x, p) (or u(t, x, p, v) for variable problems). The control is a function of the full Hamiltonian state, providing dynamic feedback that uses costate information — typically derived from the pseudo-Hamiltonian maximisation condition.

See also: CTBase.Traits.OpenLoopFeedback, CTBase.Traits.ClosedLoopFeedback, CTBase.Traits.AbstractFeedback.

EndPointMode [Struct]

CTBase.Traits.EndPointMode Type
julia
struct EndPointMode <: CTBase.Traits.AbstractModeTrait

Trait for point integration mode (single endpoint evaluation).

Used as a type parameter in AbstractConfig to indicate point integration, which computes the solution at a specific final time from a single initial condition.

Example

julia
julia> using CTBase.Traits

julia> pt = EndPointMode()
EndPointMode()

julia> pt isa Traits.AbstractModeTrait
true

Notes

  • Point mode configurations store t0 and tf as separate fields

  • This mode is suitable for boundary value problems and shooting methods

  • The tspan accessor returns (c.t0, c.tf) for point configurations

See also: CTBase.Traits.TrajectoryMode, CTBase.Traits.AbstractModeTrait.

Fixed [Struct]

CTBase.Traits.Fixed Type
julia
struct Fixed <: CTBase.Traits.VariableDependence

Trait indicating the system or function has no variable parameters.

Indicates that the system operates with fixed parameters only, without additional variable arguments that can be treated as dynamic variables during integration.

Common use cases include:

  • Functions with fixed parameters only

  • Systems with constant parameters that are not integrated

  • Configurations where all parameters are known at compile time

See also: CTBase.Traits.NonFixed, CTBase.Traits.VariableDependence.

HamiltonianDynamics [Struct]

CTBase.Traits.HamiltonianDynamics Type
julia
struct HamiltonianDynamics <: CTBase.Traits.AbstractDynamicsTrait

Trait for Hamiltonian dynamics (state + costate).

Used as a type parameter in AbstractConfig to indicate Hamiltonian configurations, which contain both state variables and associated costate (adjoint) variables.

Example

julia
julia> using CTBase.Traits

julia> ham = HamiltonianDynamics()
HamiltonianDynamics()

julia> ham isa Traits.AbstractDynamicsTrait
true

Notes

  • Hamiltonian configurations store both x0 (initial state) and p0 (initial costate)

  • The initial_condition accessor returns vcat(x0, p0) for Hamiltonian configurations

  • This mode is suitable for optimal control problems with Pontryagin's maximum principle

See also: CTBase.Traits.StateDynamics, CTBase.Traits.AbstractDynamicsTrait.

InPlace [Struct]

CTBase.Traits.InPlace Type
julia
struct InPlace <: CTBase.Traits.AbstractMutabilityTrait

Trait for in-place function evaluation.

Indicates that a function modifies a pre-allocated buffer passed as an argument, rather than allocating and returning a new result. This pattern is used for performance-critical code where avoiding allocations is important.

Example

julia
julia> using CTBase.Traits

julia> ip = InPlace()
InPlace()

julia> ip isa AbstractMutabilityTrait
true

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.OutOfPlace.

MixedConstraintKind [Struct]

CTBase.Traits.MixedConstraintKind Type
julia
struct MixedConstraintKind <: CTBase.Traits.AbstractConstraintKind

Trait indicating a mixed state–control path constraint: g depends on both the state and the control (and optionally time and variable).

A mixed constraint has the form g(x, u) (or g(t, x, u), g(x, u, v), g(t, x, u, v)).

See also: CTBase.Traits.StateConstraintKind, CTBase.Traits.ControlConstraintKind, CTBase.Traits.AbstractConstraintKind.

NoVariableCostate [Struct]

CTBase.Traits.NoVariableCostate Type
julia
struct NoVariableCostate <: CTBase.Traits.AbstractVariableCostateCapability

Trait for systems/flows that do not support augmented variable integration.

Indicates that the system or flow cannot compute derivatives with respect to augmented variables or integrate their associated costates. This is the default for most systems, including those with pre-computed derivatives or fixed parameters.

Common use cases include:

  • Hamiltonian systems: pre-computed Hamiltonian vector fields without AD

  • Fixed systems: systems with parameters that are not treated as dynamic variables

  • General systems: any system where augmented variable integration is not applicable

Example

julia
julia> using CTBase.Traits

julia> nvc = NoVariableCostate()
NoVariableCostate()

julia> nvc isa Traits.AbstractVariableCostateCapability
true

Notes

  • Default return value from variable_costate_trait for most systems and flows

  • Systems without AD support or with fixed variable dependence typically return this

  • Attempting augmented integration operations on such systems will throw an error

  • The specific constraints depend on the system type

See also: CTBase.Traits.AbstractVariableCostateCapability, CTBase.Traits.SupportsVariableCostate, CTBase.Traits.variable_costate_trait.

NonAutonomous [Abstract Type]

CTBase.Traits.NonAutonomous Type
julia
abstract type NonAutonomous <: CTBase.Traits.TimeDependence

Type tag indicating that the dynamics and other functions explicitly depend on time. For non-autonomous systems, the dynamics have the form ẋ = f(t, x, u).

See also: CTBase.Traits.TimeDependence, CTBase.Traits.Autonomous.

NonFixed [Struct]

CTBase.Traits.NonFixed Type
julia
struct NonFixed <: CTBase.Traits.VariableDependence

Trait indicating the system or function depends on variable parameters.

Indicates that the system operates with additional variable parameters that can be treated as dynamic variables during integration or optimization. These variables may be integrated alongside state variables or used for sensitivity analysis.

Common use cases include:

  • Functions with an extra variable argument v

  • Systems with parameters that vary during integration

  • Configurations where parameters are treated as control variables

  • Sensitivity analysis and parameter estimation

See also: CTBase.Traits.Fixed, CTBase.Traits.VariableDependence.

OpenLoopFeedback [Struct]

CTBase.Traits.OpenLoopFeedback Type
julia
struct OpenLoopFeedback <: CTBase.Traits.AbstractFeedback

Trait indicating open-loop feedback: the control depends only on time (and optionally the variable), not on the state or costate.

An open-loop control law has the form u(t) (or u(t, v) for variable problems). The trajectory is determined entirely by the pre-specified control function, without feedback from the current state.

See also: CTBase.Traits.ClosedLoopFeedback, CTBase.Traits.DynClosedLoopFeedback, CTBase.Traits.AbstractFeedback.

OutOfPlace [Struct]

CTBase.Traits.OutOfPlace Type
julia
struct OutOfPlace <: CTBase.Traits.AbstractMutabilityTrait

Trait for out-of-place function evaluation.

Indicates that a function allocates and returns a new result, rather than modifying a pre-allocated buffer. This is the default pattern in Julia and is suitable for most use cases.

Example

julia
julia> using CTBase.Traits

julia> oop = OutOfPlace()
OutOfPlace()

julia> oop isa AbstractMutabilityTrait
true

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.InPlace.

StateConstraintKind [Struct]

CTBase.Traits.StateConstraintKind Type
julia
struct StateConstraintKind <: CTBase.Traits.AbstractConstraintKind

Trait indicating a pure state path constraint: g depends on the state (and optionally time and variable), but not on the control.

A state constraint has the form g(x) (or g(t, x), g(x, v), g(t, x, v)).

See also: CTBase.Traits.ControlConstraintKind, CTBase.Traits.MixedConstraintKind, CTBase.Traits.AbstractConstraintKind.

StateDynamics [Struct]

CTBase.Traits.StateDynamics Type
julia
struct StateDynamics <: CTBase.Traits.AbstractDynamicsTrait

Trait for state dynamics (no costate).

Used as a type parameter in AbstractConfig to indicate state-only configurations, which contain only state variables without associated costate variables.

Example

julia
julia> using CTBase.Traits

julia> st = StateDynamics()
StateDynamics()

julia> st isa Traits.AbstractDynamicsTrait
true

Notes

  • State configurations store only x0 (initial state)

  • The initial_costate accessor throws a PreconditionError for state configurations

  • This mode is suitable for standard ODE integration without adjoint variables

See also: CTBase.Traits.HamiltonianDynamics, CTBase.Traits.AbstractDynamicsTrait.

SupportsVariableCostate [Struct]

CTBase.Traits.SupportsVariableCostate Type
julia
struct SupportsVariableCostate <: CTBase.Traits.AbstractVariableCostateCapability

Trait for systems/flows that support augmented variable integration.

Indicates that the system or flow can compute derivatives with respect to augmented variables (e.g., parameters, controls) and integrate their associated costates. This typically requires automatic differentiation support and variable dependence.

Common use cases include:

  • Hamiltonian systems: computing ∂H/∂v via AD from a scalar Hamiltonian

  • Optimal control: integrating control variables with their adjoint equations

  • General systems: any system where augmented variables need derivative computation

Example

julia
julia> using CTBase.Traits

julia> svc = SupportsVariableCostate()
SupportsVariableCostate()

julia> svc isa Traits.AbstractVariableCostateCapability
true

Notes

  • Used as a return value from variable_costate_trait for systems that support augmented variable integration

  • Typically requires AD support and variable dependence in the system

  • This trait enables augmented integration operations in flow calls

  • The specific implementation depends on the system type and AD backend

See also: CTBase.Traits.AbstractVariableCostateCapability, CTBase.Traits.NoVariableCostate, CTBase.Traits.variable_costate_trait.

TimeDependence [Abstract Type]

CTBase.Traits.TimeDependence Type
julia
abstract type TimeDependence

Abstract base type representing time dependence of an object (e.g. an optimal control problem, a vector field, a Hamiltonian).

Used as a type parameter to distinguish between autonomous and non-autonomous objects at the type level, enabling dispatch and compile-time optimisations.

See also: CTBase.Traits.Autonomous, CTBase.Traits.NonAutonomous.

TrajectoryMode [Struct]

CTBase.Traits.TrajectoryMode Type
julia
struct TrajectoryMode <: CTBase.Traits.AbstractModeTrait

Trait for trajectory integration mode (full time evolution).

Used as a type parameter in AbstractConfig to indicate trajectory integration, which computes the full solution trajectory over a continuous time interval.

Example

julia
julia> using CTBase.Traits

julia> traj = TrajectoryMode()
TrajectoryMode()

julia> traj isa Traits.AbstractModeTrait
true

Notes

  • Trajectory mode configurations store tspan as a tuple field

  • This mode is suitable for generating full time evolution and visualization

  • The tspan accessor returns c.tspan directly for trajectory configurations

See also: CTBase.Traits.EndPointMode, CTBase.Traits.AbstractModeTrait.

VariableDependence [Abstract Type]

CTBase.Traits.VariableDependence Type
julia
abstract type VariableDependence <: CTBase.Traits.AbstractTrait

Abstract supertype for variable-dependence traits.

Trait Pattern

Objects that have a variable-dependence trait must implement two methods:

  • has_variable_dependence_trait(obj::MyType) = true: Indicates the type has this trait

  • variable_dependence(obj::MyType): Returns the specific trait value (Fixed or NonFixed)

Once these are implemented, the object automatically gains:

  • is_variable(obj): Returns true if variable_dependence(obj) is NonFixed

  • is_nonvariable(obj): Returns true if variable_dependence(obj) is Fixed

  • has_variable(obj): Alias for is_variable (CTModels compatibility)

If has_variable_dependence_trait is not implemented or returns false, calling is_variable, is_nonvariable, has_variable, or variable_dependence will throw an error indicating the object does not support variable-dependence queries.

WithAD [Struct]

CTBase.Traits.WithAD Type
julia
struct WithAD <: CTBase.Traits.AbstractADTrait

Trait for systems with automatic differentiation support.

Indicates that a system carries differentiable functions and an AD backend, enabling automatic computation of derivatives. Such systems typically require cache preparation before operations that need gradients or Jacobians.

Common use cases include:

  • Hamiltonian systems: scalar Hamiltonians where the vector field is computed via AD

  • Optimization: objective functions where gradients are computed via AD

  • General systems: any differentiable function that benefits from automatic gradient computation

Example

julia
julia> using CTBase.Traits

julia> with = WithAD()
WithAD()

julia> with isa Traits.AbstractADTrait
true

Notes

  • Used as a type parameter in system types to enable AD-based derivative computation

  • Systems with WithAD typically require cache preparation via the backend's prepare_cache method

  • The cache is passed through parameters during integration or evaluation

  • The specific operations enabled depend on the system type and AD backend

See also: CTBase.Traits.AbstractADTrait, CTBase.Traits.WithoutAD, CTBase.Core.AbstractCache.

WithControl [Struct]

CTBase.Traits.WithControl Type
julia
struct WithControl <: CTBase.Traits.ControlDependence

Trait indicating the problem has a control input.

A problem with control has dynamics ẋ = f(t, x, u, v) depending on a control u; closing the loop (e.g. for a flow) requires a control law u(t, x, p).

See also: CTBase.Traits.ControlFree, CTBase.Traits.ControlDependence.

WithoutAD [Struct]

CTBase.Traits.WithoutAD Type
julia
struct WithoutAD <: CTBase.Traits.AbstractADTrait

Trait for systems without automatic differentiation support.

Indicates that a system uses pre-computed derivatives or manual implementations, without requiring AD or cache preparation. This is the traditional mode where derivatives are provided explicitly by the user or computed offline.

Common use cases include:

  • Hamiltonian systems: pre-computed Hamiltonian vector fields provided manually

  • Optimization: manually implemented gradient functions

  • General systems: any system where derivatives are known analytically or computed externally

Example

julia
julia> using CTBase.Traits

julia> without = WithoutAD()
WithoutAD()

julia> without isa Traits.AbstractADTrait
true

Notes

  • Used as a type parameter in system types for derivative-based systems without AD

  • No cache preparation is required for WithoutAD systems

  • This is the default mode for systems with pre-computed derivatives

  • The specific derivative implementations depend on the system type

See also: CTBase.Traits.AbstractADTrait, CTBase.Traits.WithAD.

ad_trait [Function]

CTBase.Traits.ad_trait Function
julia
ad_trait(_) -> Type{CTBase.Traits.WithoutAD}

Return the automatic differentiation capability trait of a system or flow.

Arguments

  • obj: Any object (default implementation returns WithoutAD).

Returns

  • Type{<:AbstractADTrait}: The AD capability trait, either WithAD or WithoutAD.

Notes

  • Default implementation returns WithoutAD for all objects

  • Specialized implementations on system types return the appropriate trait based on the system's AD support

  • Used for dispatch in cache preparation, derivative computation, and augmented integration

  • The specific operations enabled by the trait depend on the system type

See also: CTBase.Traits.AbstractADTrait, CTBase.Traits.WithAD, CTBase.Traits.WithoutAD.

constraint_kind [Function]

CTBase.Traits.constraint_kind Function

Return the constraint-kind trait of x.

Methods are defined on concrete types in Data (e.g. AbstractPathConstraint). The trait value is one of CTBase.Traits.StateConstraintKind, CTBase.Traits.ControlConstraintKind, or CTBase.Traits.MixedConstraintKind.

See also: CTBase.Traits.AbstractConstraintKind, CTBase.Traits.StateConstraintKind, CTBase.Traits.ControlConstraintKind, CTBase.Traits.MixedConstraintKind.

control_dependence [Function]

CTBase.Traits.control_dependence Function
julia
control_dependence(obj)

Return the control-dependence trait value for the object.

This fallback method throws an error indicating the method is not implemented. Concrete types that have the trait should implement control_dependence(obj::MyType) to return the specific trait value (ControlFree or WithControl).

Arguments

  • obj::Any: The object to query.

Throws

See also: CTBase.Traits.ControlDependence, CTBase.Traits.has_control_dependence_trait.

dynamics_trait [Function]

CTBase.Traits.dynamics_trait Function
julia
dynamics_trait(x)

Return the dynamics trait of x.

Methods are defined on concrete types in Systems and Configs.

See also: CTBase.Traits.AbstractDynamicsTrait, CTBase.Traits.StateDynamics, CTBase.Traits.HamiltonianDynamics.

feedback [Function]

CTBase.Traits.feedback Function

Return the feedback trait of x.

Methods are defined on concrete types in Data (e.g. AbstractControlLaw). The trait value is one of CTBase.Traits.OpenLoopFeedback, CTBase.Traits.ClosedLoopFeedback, or CTBase.Traits.DynClosedLoopFeedback.

See also: CTBase.Traits.AbstractFeedback, CTBase.Traits.OpenLoopFeedback, CTBase.Traits.ClosedLoopFeedback, CTBase.Traits.DynClosedLoopFeedback.

has_control [Function]

CTBase.Traits.has_control Function
julia
has_control(obj)

Return true if the object has a control input.

Checks that the object has the control-dependence trait, then returns true if control_dependence(obj) is WithControl.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object has a control input.

Throws

See also: CTBase.Traits.ControlDependence, CTBase.Traits.is_control_free.

has_control_dependence_trait [Function]

CTBase.Traits.has_control_dependence_trait Function
julia
has_control_dependence_trait(obj)

Check if the object has the control-dependence trait.

This fallback method throws an error indicating the object does not support control-dependence queries. Concrete types that have the trait should implement has_control_dependence_trait(obj::MyType) = true.

The calling function name is automatically detected from the stacktrace for better error messages.

Arguments

  • obj::Any: The object to check.

Throws

See also: CTBase.Traits.ControlDependence, CTBase.Traits.control_dependence.

has_mutability_trait [Function]

CTBase.Traits.has_mutability_trait Function
julia
has_mutability_trait(obj) -> Bool

Check if the object has the mutability trait.

This fallback method throws an error indicating the object does not support mutability queries. Concrete types that have the trait should implement has_mutability_trait(obj::MyType) = true.

The calling function name is automatically detected from the stacktrace for better error messages.

Arguments

  • obj::Any: The object to check.

Throws

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.mutability.

julia
has_mutability_trait(
    _::CTBase.Data.AbstractVectorField
) -> Bool

Indicate that AbstractVectorField has the mutability trait.

This implementation declares that all vector fields support mutability queries. Concrete AbstractVectorField instances have their mutability encoded in the type parameter MD.

See also: CTBase.Traits.mutability, CTBase.Data.AbstractVectorField.

has_time_dependence_trait [Function]

CTBase.Traits.has_time_dependence_trait Function
julia
has_time_dependence_trait(obj) -> Bool

Check if the object has the time-dependence trait.

This fallback method throws an error indicating the object does not support time-dependence queries. Concrete types that have the trait should implement has_time_dependence_trait(obj::MyType) = true.

The calling function name is automatically detected from the stacktrace for better error messages.

Arguments

  • obj::Any: The object to check.

Throws

See also: CTBase.Traits.TimeDependence, CTBase.Traits.time_dependence.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractVectorField
) -> Bool

Indicate that AbstractVectorField has the time-dependence trait.

This implementation declares that all vector fields support time-dependence queries. Concrete AbstractVectorField instances have their time dependence encoded in the type parameter TD.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractVectorField.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractHamiltonian
) -> Bool

Indicates that all AbstractHamiltonian types support time-dependence queries.

Returns

  • true: Always returns true for Hamiltonian types.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractHamiltonian.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractControlLaw
) -> Bool

Indicates that all AbstractControlLaw types support time-dependence queries.

Returns

  • true: Always returns true for control law types.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractControlLaw.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractPathConstraint
) -> Bool

Indicates that all AbstractPathConstraint types support time-dependence queries.

Returns

  • true: Always returns true for path constraint types.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractPathConstraint.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractMultiplier
) -> Bool

Indicates that all AbstractMultiplier types support time-dependence queries.

Returns

  • true: Always returns true for multiplier types.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractMultiplier.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractPseudoHamiltonian
) -> Bool

Indicates that all AbstractPseudoHamiltonian types support time-dependence queries.

Returns

  • true: Always returns true for pseudo-Hamiltonian types.

See also: CTBase.Traits.time_dependence, CTBase.Data.AbstractPseudoHamiltonian.

julia
has_time_dependence_trait(
    _::CTBase.Data.AbstractControlledVectorField
) -> Bool

Indicate that all AbstractControlledVectorField types support time-dependence queries.

See also: CTBase.Traits.time_dependence.

has_variable [Function]

CTBase.Traits.has_variable Function
julia
has_variable(obj) -> Bool

Return true if the object depends on variable parameters.

Checks that the object has the variable-dependence trait, then returns true if variable_dependence(obj) is NonFixed.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object depends on variable parameters.

Throws

See also: CTBase.Traits.is_variable, CTBase.Traits.VariableDependence.

has_variable_dependence_trait [Function]

CTBase.Traits.has_variable_dependence_trait Function
julia
has_variable_dependence_trait(obj) -> Bool

Check if the object has the variable-dependence trait.

This fallback method throws an error indicating the object does not support variable-dependence queries. Concrete types that have the trait should implement has_variable_dependence_trait(obj::MyType) = true.

The calling function name is automatically detected from the stacktrace for better error messages.

Arguments

  • obj::Any: The object to check.

Throws

See also: CTBase.Traits.VariableDependence, CTBase.Traits.variable_dependence.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractVectorField
) -> Bool

Indicate that AbstractVectorField has the variable-dependence trait.

This implementation declares that all vector fields support variable-dependence queries. Concrete AbstractVectorField instances have their variable dependence encoded in the type parameter VD.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractVectorField.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractHamiltonian
) -> Bool

Indicates that all AbstractHamiltonian types support variable-dependence queries.

Returns

  • true: Always returns true for Hamiltonian types.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractHamiltonian.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractControlLaw
) -> Bool

Indicates that all AbstractControlLaw types support variable-dependence queries.

Returns

  • true: Always returns true for control law types.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractControlLaw.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractPathConstraint
) -> Bool

Indicates that all AbstractPathConstraint types support variable-dependence queries.

Returns

  • true: Always returns true for path constraint types.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractPathConstraint.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractMultiplier
) -> Bool

Indicates that all AbstractMultiplier types support variable-dependence queries.

Returns

  • true: Always returns true for multiplier types.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractMultiplier.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractPseudoHamiltonian
) -> Bool

Indicates that all AbstractPseudoHamiltonian types support variable-dependence queries.

Returns

  • true: Always returns true for pseudo-Hamiltonian types.

See also: CTBase.Traits.variable_dependence, CTBase.Data.AbstractPseudoHamiltonian.

julia
has_variable_dependence_trait(
    _::CTBase.Data.AbstractControlledVectorField
) -> Bool

Indicate that all AbstractControlledVectorField types support variable-dependence queries.

See also: CTBase.Traits.variable_dependence.

is_autonomous [Function]

CTBase.Traits.is_autonomous Function
julia
is_autonomous(obj) -> Bool

Return true if the object is autonomous (time-independent).

Checks that the object has the time-dependence trait, then returns true if time_dependence(obj) is Autonomous.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object is autonomous.

Throws

See also: CTBase.Traits.TimeDependence, CTBase.Traits.time_dependence.

is_closed_loop [Function]

CTBase.Traits.is_closed_loop Function

Return true if x has closed-loop feedback.

Methods are defined on concrete types in Data (e.g. AbstractControlLaw).

Returns

  • Bool: true if the feedback trait is ClosedLoopFeedback, false otherwise.

See also: CTBase.Traits.ClosedLoopFeedback, CTBase.Traits.feedback.

is_control_constraint [Function]

CTBase.Traits.is_control_constraint Function

Return true if x is a pure control path constraint.

Methods are defined on concrete types in Data (e.g. AbstractPathConstraint).

Returns

  • Bool: true if the constraint-kind trait is ControlConstraintKind, false otherwise.

See also: CTBase.Traits.ControlConstraintKind, CTBase.Traits.constraint_kind.

is_control_free [Function]

CTBase.Traits.is_control_free Function
julia
is_control_free(obj)

Return true if the object is control-free (has no control input).

Checks that the object has the control-dependence trait, then returns true if control_dependence(obj) is ControlFree.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object has no control input.

Throws

See also: CTBase.Traits.ControlDependence, CTBase.Traits.has_control.

is_dyn_closed_loop [Function]

CTBase.Traits.is_dyn_closed_loop Function

Return true if x has dynamic closed-loop feedback.

Methods are defined on concrete types in Data (e.g. AbstractControlLaw).

Returns

  • Bool: true if the feedback trait is DynClosedLoopFeedback, false otherwise.

See also: CTBase.Traits.DynClosedLoopFeedback, CTBase.Traits.feedback.

is_inplace [Function]

CTBase.Traits.is_inplace Function
julia
is_inplace(obj) -> Bool

Return true if the object uses in-place function evaluation.

Checks that the object has the mutability trait, then returns true if mutability(obj) is InPlace.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object uses in-place evaluation.

Throws

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.mutability.

is_mixed_constraint [Function]

CTBase.Traits.is_mixed_constraint Function

Return true if x is a mixed state–control path constraint.

Methods are defined on concrete types in Data (e.g. AbstractPathConstraint).

Returns

  • Bool: true if the constraint-kind trait is MixedConstraintKind, false otherwise.

See also: CTBase.Traits.MixedConstraintKind, CTBase.Traits.constraint_kind.

is_nonautonomous [Function]

CTBase.Traits.is_nonautonomous Function
julia
is_nonautonomous(obj) -> Bool

Return true if the object is non-autonomous (time-dependent).

Checks that the object has the time-dependence trait, then returns true if time_dependence(obj) is NonAutonomous.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object is non-autonomous.

Throws

See also: CTBase.Traits.TimeDependence, CTBase.Traits.time_dependence.

is_nonvariable [Function]

CTBase.Traits.is_nonvariable Function
julia
is_nonvariable(obj) -> Bool

Return true if the object does not depend on variable parameters.

Checks that the object has the variable-dependence trait, then returns true if variable_dependence(obj) is Fixed.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object does not depend on variable parameters.

Throws

See also: CTBase.Traits.VariableDependence, CTBase.Traits.variable_dependence.

is_open_loop [Function]

CTBase.Traits.is_open_loop Function

Return true if x has open-loop feedback.

Methods are defined on concrete types in Data (e.g. AbstractControlLaw).

Returns

  • Bool: true if the feedback trait is OpenLoopFeedback, false otherwise.

See also: CTBase.Traits.OpenLoopFeedback, CTBase.Traits.feedback.

is_outofplace [Function]

CTBase.Traits.is_outofplace Function
julia
is_outofplace(obj) -> Bool

Return true if the object uses out-of-place function evaluation.

Checks that the object has the mutability trait, then returns true if mutability(obj) is OutOfPlace.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object uses out-of-place evaluation.

Throws

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.mutability.

is_state_constraint [Function]

CTBase.Traits.is_state_constraint Function

Return true if x is a pure state path constraint.

Methods are defined on concrete types in Data (e.g. AbstractPathConstraint).

Returns

  • Bool: true if the constraint-kind trait is StateConstraintKind, false otherwise.

See also: CTBase.Traits.StateConstraintKind, CTBase.Traits.constraint_kind.

is_variable [Function]

CTBase.Traits.is_variable Function
julia
is_variable(obj) -> Bool

Return true if the object depends on variable parameters.

Checks that the object has the variable-dependence trait, then returns true if variable_dependence(obj) is NonFixed.

Arguments

  • obj::Any: The object to check.

Returns

  • Bool: true if the object depends on variable parameters.

Throws

See also: CTBase.Traits.VariableDependence, CTBase.Traits.variable_dependence.

mutability [Function]

CTBase.Traits.mutability Function
julia
mutability(
    obj
) -> Type{MD} where MD<:CTBase.Traits.AbstractMutabilityTrait

Return the mutability trait value for the object.

This fallback method throws an error indicating the method is not implemented. Concrete types that have the trait should implement mutability(obj::MyType) to return the specific trait value (InPlace or OutOfPlace).

Arguments

  • obj::Any: The object to query.

Throws

See also: CTBase.Traits.AbstractMutabilityTrait, CTBase.Traits.has_mutability_trait.

julia
mutability(
    vf::CTBase.Data.AbstractVectorField{<:CTBase.Traits.TimeDependence, <:CTBase.Traits.VariableDependence, MD<:CTBase.Traits.AbstractMutabilityTrait}
) -> Type{MD} where MD<:CTBase.Traits.AbstractMutabilityTrait

Extract the mutability trait from an AbstractVectorField.

Returns

  • Type{<:AbstractMutabilityTrait}: The mutability trait type (InPlace or OutOfPlace).

Example

julia
using CTBase.Data
using CTBase.Traits

vf = Data.VectorField((dx, x) -> (dx .= -x; nothing))
Traits.mutability(vf)  # Returns InPlace

vf2 = Data.VectorField(x -> -x)
Traits.mutability(vf2)  # Returns OutOfPlace

See also: CTBase.Traits.has_mutability_trait, CTBase.Traits.is_inplace.

time_dependence [Function]

CTBase.Traits.time_dependence Function
julia
time_dependence(
    obj
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait value for the object.

This fallback method throws an error indicating the method is not implemented. Concrete types that have the trait should implement time_dependence(obj::MyType) to return the specific trait value (Autonomous or NonAutonomous).

Arguments

  • obj::Any: The object to query.

Throws

See also: CTBase.Traits.TimeDependence, CTBase.Traits.has_time_dependence_trait.

julia
time_dependence(
    vf::CTBase.Data.AbstractVectorField{TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Extract the time dependence trait from an AbstractVectorField.

Returns

  • Type{<:TimeDependence}: The time dependence trait type (Autonomous or NonAutonomous).

Example

julia
using CTBase.Data
using CTBase.Traits

vf = Data.VectorField(x -> -x; is_autonomous=true)
Traits.time_dependence(vf)  # Returns Autonomous

hvf = Data.HamiltonianVectorField((t, x, p) -> (x, -p); is_autonomous=false)
Traits.time_dependence(hvf)  # Returns NonAutonomous

See also: CTBase.Traits.has_time_dependence_trait, CTBase.Traits.is_autonomous.

julia
time_dependence(
    _::CTBase.Data.AbstractHamiltonian{TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a Hamiltonian.

Arguments

  • h::AbstractHamiltonian: The Hamiltonian object.

Returns

  • TD: The time-dependence type (Autonomous or NonAutonomous).

See also: CTBase.Traits.time_dependence, CTBase.Traits.TimeDependence.

julia
time_dependence(
    _::CTBase.Data.AbstractControlLaw{<:Any, TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a control law.

Arguments

  • cl::AbstractControlLaw: The control law object.

Returns

  • TD: The time-dependence type (Autonomous or NonAutonomous).

See also: CTBase.Traits.time_dependence, CTBase.Traits.TimeDependence.

julia
time_dependence(
    _::CTBase.Data.AbstractPathConstraint{<:Any, TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a path constraint.

Arguments

  • pc::AbstractPathConstraint: The path constraint object.

Returns

  • TD: The time-dependence type (Autonomous or NonAutonomous).

See also: CTBase.Traits.time_dependence, CTBase.Traits.TimeDependence.

julia
time_dependence(
    _::CTBase.Data.AbstractMultiplier{TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a multiplier.

Arguments

  • m::AbstractMultiplier: The multiplier object.

Returns

  • TD: The time-dependence type (Autonomous or NonAutonomous).

See also: CTBase.Traits.time_dependence, CTBase.Traits.TimeDependence.

julia
time_dependence(
    _::CTBase.Data.AbstractPseudoHamiltonian{TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a pseudo-Hamiltonian.

Arguments

  • h̃::AbstractPseudoHamiltonian: The pseudo-Hamiltonian object.

Returns

  • TD: The time-dependence type (Autonomous or NonAutonomous).

See also: CTBase.Traits.time_dependence, CTBase.Traits.TimeDependence.

julia
time_dependence(
    _::CTBase.Data.AbstractControlledVectorField{TD<:CTBase.Traits.TimeDependence}
) -> Type{TD} where TD<:CTBase.Traits.TimeDependence

Return the time-dependence trait of a controlled vector field.

See also: CTBase.Traits.time_dependence.

variable_costate_trait [Function]

CTBase.Traits.variable_costate_trait Function
julia
variable_costate_trait(
    _
) -> Type{CTBase.Traits.NoVariableCostate}

Return the augmented variable integration capability trait of a system or flow.

Arguments

  • obj: Any object (default implementation returns NoVariableCostate).

Returns

  • Type{<:AbstractVariableCostateCapability}: The capability trait, either SupportsVariableCostate or NoVariableCostate.

Notes

  • Default implementation returns NoVariableCostate for all objects

  • Specialized implementations on system and flow types return the appropriate trait based on the system's capabilities

  • Used for dispatch to determine if augmented integration operations are possible

  • The specific operations enabled depend on the system type

See also: CTBase.Traits.SupportsVariableCostate, CTBase.Traits.NoVariableCostate.

variable_dependence [Function]

CTBase.Traits.variable_dependence Function
julia
variable_dependence(
    obj
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait value for the object.

This fallback method throws an error indicating the method is not implemented. Concrete types that have the trait should implement variable_dependence(obj::MyType) to return the specific trait value (Fixed or NonFixed).

Arguments

  • obj::Any: The object to query.

Throws

See also: CTBase.Traits.VariableDependence, CTBase.Traits.has_variable_dependence_trait.

julia
variable_dependence(
    vf::CTBase.Data.AbstractVectorField{<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Extract the variable dependence trait from an AbstractVectorField.

Returns

  • Type{<:VariableDependence}: The variable dependence trait type (Fixed or NonFixed).

Example

julia
using CTBase.Data
using CTBase.Traits

vf = Data.VectorField(x -> -x; is_variable=false)
Traits.variable_dependence(vf)  # Returns Fixed

hvf = Data.HamiltonianVectorField((x, p, v) -> (x .* v, -p); is_variable=true)
Traits.variable_dependence(hvf)  # Returns NonFixed

See also: CTBase.Traits.has_variable_dependence_trait, CTBase.Traits.is_variable.

julia
variable_dependence(
    _::CTBase.Data.AbstractHamiltonian{<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a Hamiltonian.

Arguments

  • h::AbstractHamiltonian: The Hamiltonian object.

Returns

  • VD: The variable-dependence type (Fixed or NonFixed).

See also: CTBase.Traits.variable_dependence, CTBase.Traits.VariableDependence.

julia
variable_dependence(
    _::CTBase.Data.AbstractControlLaw{<:Any, <:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a control law.

Arguments

  • cl::AbstractControlLaw: The control law object.

Returns

  • VD: The variable-dependence type (Fixed or NonFixed).

See also: CTBase.Traits.variable_dependence, CTBase.Traits.VariableDependence.

julia
variable_dependence(
    _::CTBase.Data.AbstractPathConstraint{<:Any, <:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a path constraint.

Arguments

  • pc::AbstractPathConstraint: The path constraint object.

Returns

  • VD: The variable-dependence type (Fixed or NonFixed).

See also: CTBase.Traits.variable_dependence, CTBase.Traits.VariableDependence.

julia
variable_dependence(
    _::CTBase.Data.AbstractMultiplier{<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a multiplier.

Arguments

  • m::AbstractMultiplier: The multiplier object.

Returns

  • VD: The variable-dependence type (Fixed or NonFixed).

See also: CTBase.Traits.variable_dependence, CTBase.Traits.VariableDependence.

julia
variable_dependence(
    _::CTBase.Data.AbstractPseudoHamiltonian{<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a pseudo-Hamiltonian.

Arguments

  • h̃::AbstractPseudoHamiltonian: The pseudo-Hamiltonian object.

Returns

  • VD: The variable-dependence type (Fixed or NonFixed).

See also: CTBase.Traits.variable_dependence, CTBase.Traits.VariableDependence.

julia
variable_dependence(
    _::CTBase.Data.AbstractControlledVectorField{<:CTBase.Traits.TimeDependence, VD<:CTBase.Traits.VariableDependence}
) -> Type{VD} where VD<:CTBase.Traits.VariableDependence

Return the variable-dependence trait of a controlled vector field.

See also: CTBase.Traits.variable_dependence.