Skip to content

Commit

Permalink
Merge pull request #733 from JuliaReach/mforets/fix_normalization
Browse files Browse the repository at this point in the history
Fix normalization for affine systems
  • Loading branch information
schillic authored Jan 24, 2020
2 parents cc1772d + e3da2a5 commit e24bc06
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Utils/normalization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,27 @@ for CLC_S in (:CLCCS, :CLCDS)
end
end

# x' = Ax + b, x ∈ X, u ∈ U in the continuous case
# x+ = Ax + b, x ∈ X, u ∈ U in the discrete case
# x' = Ax + c, x ∈ X, u ∈ U in the continuous case
# x+ = Ax + c, x ∈ X, u ∈ U in the discrete case
for (CA_S, CLC_S) in ((:CACS, :CLCCS), (:CADS, :CLCDS))
@eval begin
function normalize(system::$CA_S{N, AN, VN, XT}) where {N, AN<:AbstractMatrix{N}, VN<:AbstractVector{N}, XT<:XNCF{N}}
n = statedim(system)
X = _wrap_invariant(system.X, n)
U = _wrap_inputs(system.b)
U = _wrap_inputs(system.c)
$CLC_S(system.A, I(n, N), X, U)
end
end
end

# x' = Ax + b in the continuous case
# x+ = Ax + b in the discrete case
# x' = Ax + c in the continuous case
# x+ = Ax + c in the discrete case
for (A_S, CLC_S) in ((:ACS, :CLCCS), (:ADS, :CLCDS))
@eval begin
function normalize(system::$A_S{N, AN, VN}) where {N, AN<:AbstractMatrix{N}, VN<:AbstractVector{N}}
n = statedim(system)
X = Universe(n)
U = _wrap_inputs(system.b)
U = _wrap_inputs(system.c)
$CLC_S(system.A, I(n, N), X, U)
end
end
Expand Down Expand Up @@ -154,10 +154,10 @@ _wrap_inputs(U::LazySet, B::AbstractMatrix) = ConstantInput(B*U)
_wrap_inputs(U::Vector{<:LazySet}, B::IdentityMultiple) = isidentity(B) ? VaryingInput(U) : VaryingInput(map(u -> B*u, U))
_wrap_inputs(U::Vector{<:LazySet}, B::AbstractMatrix) = VaryingInput(map(u -> B*u, U))

_wrap_inputs(U::AbstractInput, B::IdentityMultiple, c::AbstractVector) = isidentity(B) ? map(u -> u c, U) : map(u -> B*u c, U)
_wrap_inputs(U::AbstractInput, B::IdentityMultiple, c::AbstractVector) = isidentity(B) ? map(u -> u c, U) : map(u -> B*u c, U)
_wrap_inputs(U::AbstractInput, B::AbstractMatrix, c::AbstractVector) = map(u -> B*u c, U)

_wrap_inputs(U::LazySet, B::IdentityMultiple, c::AbstractVector) = isidentity(B) ? ConstantInput(U c) : ConstantInput(B*U c)
_wrap_inputs(U::LazySet, B::IdentityMultiple, c::AbstractVector) = isidentity(B) ? ConstantInput(U c) : ConstantInput(B*U c)
_wrap_inputs(U::LazySet, B::AbstractMatrix, c::AbstractVector) = ConstantInput(B*U c)

_wrap_inputs(U::Vector{<:LazySet}, B::IdentityMultiple, c::AbstractVector) = isidentity(B) ? VaryingInput(map(u -> u c, U)) : VaryingInput(map(u -> B*u c, U))
Expand Down

0 comments on commit e24bc06

Please sign in to comment.