Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outsource code to LazySets #824

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ExprTools = "0.1"
HybridSystems = "0.4"
IntervalArithmetic = "0.16 - 0.20, =0.20.9" # new versions require updates and are incompatible with dependencies
IntervalMatrices = "0.6 - 0.10"
LazySets = "2.11"
LazySets = "2.12"
LinearAlgebra = "<0.0.1, 1.6"
MathematicalSystems = "0.11 - 0.13"
Parameters = "0.10 - 0.12"
Expand Down
35 changes: 1 addition & 34 deletions src/Flowpipes/setops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ function _reconvert(V::VPOLY{N,VN}, static::Val{true}, dim::Missing) where {N,VN
return _reconvert(V, static, Val(LazySets.dim(V)))
end

Base.convert(::Type{HPolytope{N,VT}}, P::HPolytope{N,VT}) where {N,VT} = P
function Base.convert(::Type{HPolytope{N,VT}}, P::LazySet) where {N,VT}
return HPolytope([HalfSpace(VT(c.a), c.b) for c in constraints_list(P)])
end

function Base.convert(::Type{Hyperrectangle{N,Vector{N},Vector{N}}},
H::Hyperrectangle{N,SVector{L,N},SVector{L,N}}) where {N,L}
return Hyperrectangle(Vector(H.center), Vector(H.radius))
Expand Down Expand Up @@ -184,27 +179,9 @@ LazySets.Projection(X::LazySet, vars::NTuple{D,Int}) where {D} = Projection(X, c
LazySets.Projection(X::LazySet; vars) = Projection(X, vars)

# ===============================
# Decompositions and partitions
# Splitting
# ===============================

#const Partition{}

# concrete decomposition using a uniform block partition
#const Partition{N, VT} = AbstractVector{VT} where {VT<:AbstractVector{Int}}

function _decompose(X::LazySet{N},
blocks, # ::AbstractVector{<:AbstractVector{Int}}
set_type::Type{ST}) where {N,ST<:LazySet}
n = dim(X)
result = Vector{ST}(undef, length(blocks))

@inbounds for (i, bi) in enumerate(blocks)
πX = Projection(X, bi)
result[i] = overapproximate(πX, ST)
end
return CartesianProductArray(result)
end

# split the symmetric box [-1, 1]^n in nparts in each dimension
function _split_symmetric_box(n::Int, nparts::Int)
return IA.mince(symBox(n), nparts)
Expand All @@ -217,16 +194,6 @@ function _split_symmetric_box(D::Int, partition::Vector{Int})
return convert.(IA.IntervalBox, Sp)
end

# ==================================
# Zonotope order reduction methods
# ==================================

# zonotope with mixed static array types
function LazySets.reduce_order(Z::Zonotope{N,SVector{n,N},MMatrix{n,p,N,L}}, r::Real,
alg::AbstractReductionMethod) where {n,N,p,L}
return reduce_order(Zonotope(Z.center, SMatrix(Z.generators)), r, alg)
end

# ====================================
# Disjointness checks
# ====================================
Expand Down
Loading