Skip to content

Commit

Permalink
fix homogenization
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Jan 10, 2025
1 parent b5e8840 commit 8f08ae2
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Continuous/homogenization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
# Homogenization of linear systems
# ====================================================

using ..DiscretizationModule: next_set

# no-op
homogenize(ivp::IVP{LCS{N,MT},ST}) where {N,MT<:AbstractMatrix{N},ST} = ivp
homogenize(sys::LCS{N,MT}) where {N,MT<:AbstractMatrix{N}} = sys

"""
homogenize(ivp::IVP{CLCCS{N,MT,IdentityMultiple{N},XT,ConstantInput{SI}},ST}) where {N, MT<:AbstractMatrix{N}, XT<:LazySet{N}, SI<:Singleton{N}, ST<:LazySet{N}}
homogenize(ivp::IVP{<:CLCCS{N,MTA,MTB,XT,UT},ST}) where {N, MTA<:AbstractMatrix{N},
MTB<:IdentityMultiple{N}, XT<:LazySet{N}, UT<:ConstantInput{<:Singleton{N}}, ST<:LazySet{N}}
Transform an inhomogeneous linear initial-value problem into a homogeneous one
by introducing auxiliary state variables.
Expand All @@ -26,22 +29,27 @@ This function transforms the canonical initial-value problem ``x' = Ax + u``,
``x ∈ X`` with ``u(0) ∈ U = {u}`` (a singleton) into a homogeneous problem
without inputs ``y' = Â * y``, ``y ∈ Y``.
"""
function homogenize(ivp::IVP{CLCCS{N,MT,IdentityMultiple{N},XT,ConstantInput{SI}},ST}) where {N,
MT<:AbstractMatrix{N},
XT<:LazySet{N},
SI<:Singleton{N},
ST<:LazySet{N}}
function homogenize(ivp::IVP{<:CLCCS{N,MTA,MTB,XT,UT},ST}) where {N,
MTA<:AbstractMatrix{N},
MTB<:IdentityMultiple{N},
XT<:LazySet{N},
UT<:ConstantInput{<:Singleton{N}},
ST<:LazySet{N}}
# homogenized state matrix
B = input_matrix(ivp)
@assert isone(B.M.λ) "input matrix should be normalized"
U = ReachabilityAnalysis.next_set(inputset(ivp))
A = state_matrix(ivp)
= _homogenize_state_matrix(A, U)

# homogenized input set
# homogenized initial set
X0 = initial_state(ivp)
Y0 = _homogenize_initial_state(X0)

# homogenized state constraint
X = stateset(ivp)
Y = _homogenize_stateset(X)

ivph = IVP(CLCS(Â, Y), Y0)
return ivph
end
Expand Down

0 comments on commit 8f08ae2

Please sign in to comment.