Skip to content

Commit

Permalink
Merge pull request #824 from JuliaReach/schillic/790_outsource
Browse files Browse the repository at this point in the history
Outsource code to LazySets
  • Loading branch information
schillic authored Apr 10, 2024
2 parents 30f556a + bbc682a commit ff7dc77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
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

0 comments on commit ff7dc77

Please sign in to comment.