Skip to content

Commit 49e5fee

Browse files
committed
SPZ overapproximation of CH(::SPZ,::SPZ)
1 parent 66caa49 commit 49e5fee

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/Approximations/overapproximate.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,45 @@ function load_paving_overapproximation()
648648
end
649649
end # quote / load_paving_overapproximation
650650

651+
"""
652+
# Extended help
653+
654+
overapproximate(CH::ConvexHull{N,<:SparsePolynomialZonotope,<:SparsePolynomialZonotope},
655+
::Type{<:SparsePolynomialZonotope}) where {N}
656+
657+
### Algorithm
658+
659+
This method implements Proposition 3.1.28 in [1].
660+
661+
[1] Kochdumper, Niklas. *Extensions of polynomial zonotopes and their application
662+
to verification of cyber-physical systems.* PhD diss., Technische Universität
663+
München, 2022.
664+
"""
665+
function overapproximate(CH::ConvexHull{N,<:AbstractSparsePolynomialZonotope,<:AbstractSparsePolynomialZonotope},
666+
::Type{<:SparsePolynomialZonotope}) where {N}
667+
PZ₁ = first(CH)
668+
c₁ = center(PZ₁)
669+
G₁ = genmat_dep(PZ₁)
670+
GI₁ = genmat_indep(PZ₁)
671+
E₁ = expmat(PZ₁)
672+
PZ₂ = second(CH)
673+
c₂ = center(PZ₂)
674+
G₂ = genmat_dep(PZ₂)
675+
GI₂ = genmat_indep(PZ₂)
676+
E₂ = expmat(PZ₂)
677+
678+
# zonotope overapproximation of convex hull of zonotopes
679+
cZ = zeros(N, dim(CH))
680+
Z = overapproximate(ConvexHull(Zonotope(cZ, GI₁), Zonotope(cZ, GI₂)))
681+
682+
# exact convex hull of simple polynomial zonotopes
683+
PZ₁_bar = SimpleSparsePolynomialZonotope(c₁, G₁, E₁)
684+
PZ₂_bar = SimpleSparsePolynomialZonotope(c₂, G₂, E₂)
685+
PZ_bar = convex_hull(PZ₁_bar, PZ₂_bar)
686+
687+
return SparsePolynomialZonotope(center(PZ_bar), genmat_dep(PZ_bar), genmat(Z), expmat(PZ_bar))
688+
end
689+
651690
# ============== #
652691
# disambiguation #
653692
# ============== #

test/Approximations/overapproximate.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ for N in [Float64, Float32]
322322
# overapproximation with HPolyhedron
323323
H = HalfSpace(N[1, 0], N(1))
324324
@test overapproximate(H, HPolyhedron, BoxDirections{N}(2)) == HPolyhedron([H])
325+
326+
# Example 3.1.29 from thesis
327+
PZ1 = SparsePolynomialZonotope(N[-5, 0], N[2 0 2; 0 2 2], Matrix{N}(undef, 2, 0), [1 0 1; 0 1 1])
328+
PZ2 = SparsePolynomialZonotope(N[3, 3], N[1 -2 2; 2 3 1], hcat(N[1//2; 0]), [1 0 2; 0 1 1])
329+
PZ = overapproximate(CH(PZ1, PZ2), SparsePolynomialZonotope)
330+
@test center(PZ) == N[-1, 3//2] # no reasonable tests available here
325331
end
326332

327333
for N in [Float64]

0 commit comments

Comments
 (0)