@@ -616,27 +616,30 @@ Overapproximate a sparse polynomial zonotope with a polytope in vertex represent
616
616
617
617
### Output
618
618
619
- A `VPolytope` that overapproximates the sparse polynomial zonotope .
619
+ A `VPolytope`.
620
620
621
621
### Algorithm
622
622
623
623
This method implements [Kochdumper21a; Proposition 3.1.15](@citet).
624
- The idea is to split `P` into a linear and nonlinear part (such that `P = P₁ ⊕ P₂`).
624
+ The idea is to split `P` into a linear and nonlinear part (such that `P = P₁ ⊕ P₂`).
625
625
The nonlinear part is enclosed by a zonotope. Then we combine the vertices
626
626
of both sets and finally apply a convex-hull algorithm.
627
627
"""
628
628
function overapproximate (P:: SparsePolynomialZonotope{N} , :: Type{<:VPolytope} ) where {N}
629
+ n = dim (P)
629
630
c = center (P)
630
631
G = genmat_dep (P)
631
632
GI = genmat_indep (P)
632
633
E = expmat (P)
633
- idx = P. idx
634
634
635
- H = [j for j in 1 : size (E, 2 ) if any (E[:, j] .> 1 )]
636
- K = setdiff (1 : size (E, 2 ), H)
635
+ H = Int[]
636
+ K = Int[]
637
+ for j in 1 : size (E, 2 )
638
+ push! (any (E[:, j] .> 1 ) ? H : K, j)
639
+ end
637
640
638
641
if ! isempty (H)
639
- SPZ₂ = SparsePolynomialZonotope (c, G[:, H], zeros (N, length (c) , 0 ), E[:, H], idx)
642
+ SPZ₂ = SparsePolynomialZonotope (c, G[:, H], zeros (N, n , 0 ), E[:, H], P . idx)
640
643
Z = overapproximate (SPZ₂, Zonotope)
641
644
c_z = center (Z)
642
645
GI_mod = hcat (GI, genmat (Z))
@@ -648,15 +651,15 @@ function overapproximate(P::SparsePolynomialZonotope{N}, ::Type{<:VPolytope}) wh
648
651
G_mod = G[:, K]
649
652
E_mod = E[:, K]
650
653
651
- # P̄ = SparsePolynomialZonotope(c_z, G_mod, GI_mod, E_mod, idx )
652
- # Compute vertices of a Z-representation
654
+ # conceptually: P̄ = SparsePolynomialZonotope(c_z, G_mod, GI_mod, E_mod)
655
+ # compute vertices of a Z-representation
653
656
p = size (E, 1 )
654
657
dep_params = Iterators. product (fill ([- one (N), one (N)], p)... )
655
- indep_params = Iterators . product ( fill ([ - one (N), one (N)], size ( GI_mod, 2 )) ... )
658
+ vlist_Z = vertices_list ( Zonotope ( zeros (N, n), GI_mod) )
656
659
657
- V = Vector {Vector{N}} ()
660
+ vlist = Vector {Vector{N}} ()
658
661
for α in dep_params
659
- dep_term = zeros (N, size (c) )
662
+ dep_term = copy (c_z )
660
663
for j in axes (G_mod, 2 )
661
664
prod = one (N)
662
665
for k in 1 : p
@@ -666,19 +669,15 @@ function overapproximate(P::SparsePolynomialZonotope{N}, ::Type{<:VPolytope}) wh
666
669
end
667
670
dep_term += prod * G_mod[:, j]
668
671
end
669
- for β in indep_params
670
- indep_term = zeros (N, size (c))
671
- for j in axes (GI_mod, 2 )
672
- indep_term += β[j] * GI_mod[:, j]
673
- end
674
- point = c_z + dep_term + indep_term
675
- push! (V, point)
672
+ for p in vlist_Z
673
+ point = dep_term + p
674
+ push! (vlist, point)
676
675
end
677
676
end
678
677
679
- convex_hull! (V )
678
+ convex_hull! (vlist )
680
679
681
- return VPolytope (V )
680
+ return VPolytope (vlist )
682
681
end
683
682
684
683
# function to be loaded by Requires
0 commit comments