Skip to content

Commit

Permalink
merge common code for linear cpost
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Jan 10, 2025
1 parent 6cdf144 commit 8f41b33
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 140 deletions.
21 changes: 1 addition & 20 deletions src/Algorithms/A20/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::A20, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::A20{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/BFFPSV18/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::BFFPSV18, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::BFFPSV18{N,ST}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/BOX/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::BOX, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::BOX{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/GLGM06/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::GLGM06, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::GLGM06{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/INT/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::INT, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::INT{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/LGG09/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::LGG09, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::LGG09{N,AM,VN,TN}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
21 changes: 1 addition & 20 deletions src/Algorithms/VREP/post.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
# continuous post
function post(alg::VREP, ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize the initial-value problem
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
# default continuous post

# discrete post
function post(alg::VREP{N}, ivp::IVP{<:AbstractDiscreteSystem}, NSTEPS=nothing;
Expand Down
22 changes: 22 additions & 0 deletions src/Algorithms/linear_post.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# default continuous post for linear systems
function post(alg::Union{A20,BFFPSV18,BOX,GLGM06,INT,LGG09,VREP},
ivp::IVP{<:AbstractContinuousSystem}, tspan;
Δt0::TimeInterval=zeroI, kwargs...)
δ = alg.δ

NSTEPS = get(kwargs, :NSTEPS, compute_nsteps(δ, tspan))

# normalize system to canonical form
ivp_norm = _normalize(ivp)

# homogenize system
if get(kwargs, :homogenize, false)
ivp_norm = homogenize(ivp_norm)
end

# discretize system
ivp_discr = discretize(ivp_norm, δ, alg.approx_model)

# apply discrete post to discretized system
return post(alg, ivp_discr, NSTEPS; Δt0=Δt0, kwargs...)
end
1 change: 1 addition & 0 deletions src/ReachabilityAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ include("Algorithms/ASB07/ASB07.jl")
include("Algorithms/ORBIT/ORBIT.jl")
include("Algorithms/VREP/VREP.jl")
include("Algorithms/FLOWSTAR/FLOWSTAR.jl")
include("Algorithms/linear_post.jl")

# Nonlinear
include("Algorithms/CARLIN/CARLIN.jl")
Expand Down

0 comments on commit 8f41b33

Please sign in to comment.