Concatenation

Index

Warning

In the examples in the documentation below, the methods are not prefixed by the module name even if they are private.

julia> using CTFlows
julia> x = 1
julia> private_fun(x) # throw an error

must be replaced by

julia> using CTFlows
julia> x = 1
julia> CTFlows.private_fun(x)

However, if the method is reexported by another package, then, there is no need of prefixing.

julia> module OptimalControl
           import CTFlows: private_fun
           export private_fun
       end
julia> using OptimalControl
julia> x = 1
julia> private_fun(x)

Documentation

Base.:*Method
*(
    F::CTFlowsODE.AbstractFlow,
    g::Tuple{Real, Any, TF<:CTFlowsODE.AbstractFlow}
) -> Any

Shorthand for concatenate(F, g) when g is a tuple (t_switch, η_switch, G) including a jump.

Arguments

  • F::AbstractFlow: The first flow.
  • g::Tuple{ctNumber, Any, AbstractFlow}: Tuple with switching time, jump value, and second flow.

Returns

  • A flow with a jump at t_switch and a switch from F to G.

Example

julia> F * (1.0, η, G)
source
Base.:*Method
*(
    F::CTFlowsODE.AbstractFlow,
    g::Tuple{Real, TF<:CTFlowsODE.AbstractFlow}
) -> Any

Shorthand for concatenate(F, g) when g is a tuple (t_switch, G).

Arguments

  • F::AbstractFlow: The first flow.
  • g::Tuple{ctNumber, AbstractFlow}: Tuple containing the switching time and second flow.

Returns

  • A new flow that switches from F to G at t_switch.

Example

julia> F * (1.0, G)
source
CTFlowsODE.__concat_feedback_controlMethod
__concat_feedback_control(
    F::CTFlowsODE.AbstractFlow,
    G::CTFlowsODE.AbstractFlow,
    t_switch::Real
) -> CTFlows.ControlLaw{CTFlowsODE.var"#_feedback_control#73"{F, G, t_switch}, CTFlows.NonAutonomous, CTFlows.NonFixed} where {F, G, t_switch}

Concatenate feedback control laws of two optimal control flows.

Arguments

  • F, G: OptimalControlFlow instances.
  • t_switch::Time: Switching time.

Returns

  • A ControlLaw that dispatches to F or G depending on t.

Example

julia> u = __concat_feedback_control(F, G, 2.0)
julia> u(1.5, x, u, v)  # from F
julia> u(2.5, x, u, v)  # from G
source
CTFlowsODE.__concat_jumpsFunction
__concat_jumps(
    F::CTFlowsODE.AbstractFlow,
    G::CTFlowsODE.AbstractFlow
) -> Any
__concat_jumps(
    F::CTFlowsODE.AbstractFlow,
    G::CTFlowsODE.AbstractFlow,
    jump::Union{Nothing, Tuple{Real, Any}}
) -> Any

Concatenate the jumps of two flows, with optional extra jump at t_switch.

Arguments

  • F, G: Flows with jump events.
  • jump: Optional tuple (t_switch, η_switch) to insert.

Returns

  • Combined list of jumps.

Example

julia> __concat_jumps(F, G)
julia> __concat_jumps(F, G, (1.0, η))
source
CTFlowsODE.__concat_rhsMethod
__concat_rhs(
    F::CTFlowsODE.ODEFlow,
    G::CTFlowsODE.ODEFlow,
    t_switch::Real
) -> CTFlowsODE.var"#71#72"{CTFlowsODE.ODEFlow, CTFlowsODE.ODEFlow, <:Real}

Concatenate ODE right-hand sides with a switch at t_switch.

Arguments

  • F, G: ODEFlow instances.
  • t_switch::Time: Time at which to switch between flows.

Returns

  • A function of the form (x, v, t) -> ....

Example

julia> rhs = __concat_rhs(F, G, 0.5)
julia> rhs(x, v, 0.4)  # F.rhs
julia> rhs(x, v, 0.6)  # G.rhs
source
CTFlowsODE.__concat_rhsMethod
__concat_rhs(
    F::CTFlowsODE.VectorFieldFlow,
    G::CTFlowsODE.VectorFieldFlow,
    t_switch::Real
) -> CTFlowsODE.var"#69#70"{CTFlowsODE.VectorFieldFlow, CTFlowsODE.VectorFieldFlow, <:Real}

Concatenate vector field right-hand sides with time-based switching.

Arguments

  • F, G: VectorFieldFlow instances.
  • t_switch::Time: Switching time.

Returns

  • A function of the form (x, v, t) -> ....

Example

julia> rhs = __concat_rhs(F, G, 2.0)
julia> rhs(x, v, 1.0)  # uses F.rhs
julia> rhs(x, v, 3.0)  # uses G.rhs
source
CTFlowsODE.__concat_rhsMethod
__concat_rhs(
    F::CTFlowsODE.AbstractFlow{D, U},
    G::CTFlowsODE.AbstractFlow{D, U},
    t_switch::Real
) -> CTFlowsODE.var"#71#72"{CTFlowsODE.ODEFlow, CTFlowsODE.ODEFlow, <:Real}

Concatenate the right-hand sides of two flows F and G, switching at time t_switch.

Arguments

  • F, G: Two flows of the same type.
  • t_switch::Time: The switching time.

Returns

  • A function rhs! that dispatches to F.rhs! before t_switch, and to G.rhs! after.

Example

julia> rhs = __concat_rhs(F, G, 1.0)
julia> rhs!(du, u, p, 0.5)  # uses F.rhs!
julia> rhs!(du, u, p, 1.5)  # uses G.rhs!
source
CTFlowsODE.__concat_tstopsMethod
__concat_tstops(
    F::CTFlowsODE.AbstractFlow,
    G::CTFlowsODE.AbstractFlow,
    t_switch::Real
) -> Any

Concatenate the tstops (discontinuity times) of two flows and add the switching time.

Arguments

  • F, G: Flows with tstops vectors.
  • t_switch::Time: Switching time to include.

Returns

  • A sorted vector of unique tstops.

Example

julia> __concat_tstops(F, G, 1.0)
source
CTFlowsODE.concatenateMethod
concatenate(
    F::CTFlowsODE.AbstractFlow,
    g::Tuple{Real, Any, TF<:CTFlowsODE.AbstractFlow}
) -> CTFlowsODE.OptimalControlFlow

Concatenate two AbstractFlows and insert a jump at the switching time.

Arguments

  • F::AbstractFlow
  • g::Tuple{ctNumber,Any,AbstractFlow}: (t_switch, η_switch, G)

Returns

  • A concatenated flow with the jump included.

Example

julia> F * (1.0, η, G)
source
CTFlowsODE.concatenateMethod
concatenate(
    F::CTFlowsODE.OptimalControlFlow,
    g::Tuple{Real, Any, TF<:CTFlowsODE.OptimalControlFlow}
) -> CTFlowsODE.OptimalControlFlow

Concatenate two OptimalControlFlows and a jump at switching time.

Arguments

  • F::OptimalControlFlow
  • g::Tuple{ctNumber,Any,OptimalControlFlow}

Returns

  • A combined flow with jump and control law switching.

Example

julia> F * (1.0, η, G)
source
CTFlowsODE.concatenateMethod
concatenate(
    F::CTFlowsODE.AbstractFlow,
    g::Tuple{Real, TF<:CTFlowsODE.AbstractFlow}
) -> CTFlowsODE.OptimalControlFlow

Concatenate two AbstractFlow instances with a prescribed switching time.

Arguments

  • F::AbstractFlow: First flow.
  • g::Tuple{ctNumber,AbstractFlow}: Switching time and second flow.

Returns

  • A new flow that transitions from F to G at t_switch.

Example

julia> F * (1.0, G)
source
CTFlowsODE.concatenateMethod
concatenate(
    F::CTFlowsODE.OptimalControlFlow,
    g::Tuple{Real, TF<:CTFlowsODE.OptimalControlFlow}
) -> CTFlowsODE.OptimalControlFlow

Concatenate two OptimalControlFlows at a switching time.

Arguments

  • F::OptimalControlFlow
  • g::Tuple{ctNumber,OptimalControlFlow}

Returns

  • A combined flow with switched dynamics and feedback control.

Example

julia> F * (1.0, G)
source