Skip to content

Commit b0d0ce1

Browse files
committed
Added JKS16 zonotope order reduction and documentation
1 parent ba2c3e8 commit b0d0ce1

File tree

2 files changed

+20
-40
lines changed

2 files changed

+20
-40
lines changed

docs/src/lib/interfaces/AbstractZonotope.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ LazySets.AbstractReductionMethod
243243
LazySets.ASB10
244244
LazySets.COMB03
245245
LazySets.GIR05
246+
LazySets.JKS16
246247
```
247248

248249
## Implementations

src/Interfaces/AbstractZonotope.jl

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -811,14 +811,20 @@ struct ASB10 <: AbstractReductionMethod end
811811
"""
812812
JKS16 <: AbstractReductionMethod
813813
814-
Zonotope order-reduction method from [SCOTT2016126](@citet).
815-
"""
816-
struct JKS16 <: AbstractReductionMethod
814+
`JKS16` uses a greedy factorization and iterative generator reduction
815+
816+
### Algorithm
817817
818+
- The JKS16 method reorders the generator matrix using reduced row echelon form (rref) to form a `T`,
819+
then iteratively removes excess generators from `V` while updating `T`.
820+
- The default `JKS16()` uses `ϵ = 1e-6` (pivot threshold) and `δ = 1e-3` (volume threshold).
821+
Referenced from [SCOTT2016126](@citet).
822+
"""
823+
struct JKS16{N<:Number} <: AbstractReductionMethod
818824
ϵ::N
819825
δ::N
820826

821-
JKS16::N=1e-6, δ::N=1e-3) = new(ϵ, δ)
827+
JKS16::N=1e-6, δ::N=1e-3) where {N<:Number} = new{N}(ϵ, δ)
822828
end
823829

824830
"""
@@ -844,16 +850,18 @@ The available algorithms are:
844850
845851
```jldoctest; setup = :(using LazySets: subtypes, AbstractReductionMethod)
846852
julia> subtypes(AbstractReductionMethod)
847-
3-element Vector{Any}:
853+
4-element Vector{Any}:
848854
LazySets.ASB10
849855
LazySets.COMB03
850856
LazySets.GIR05
857+
LazySets.JKS16
851858
```
852859
853860
See the documentation of each algorithm for references. These methods split the
854861
given zonotopic set `Z` into two zonotopes, `K` and `L`, where `K` contains the
855862
most "representative" generators and `L` contains the generators that are
856-
reduced, `Lred`, using a box overapproximation. We follow the notation from
863+
reduced, `Lred`, using a box overapproximation. This methodology varies slightly
864+
for `JKS16` (for details, refer to the method). We follow the notation from
857865
[YangS18](@citet). See also [KopetzkiSA17](@citet).
858866
"""
859867
function reduce_order(Z::AbstractZonotope, r::Real,
@@ -865,7 +873,10 @@ function reduce_order(Z::AbstractZonotope, r::Real,
865873

866874
# if r is bigger than the order of Z => do not reduce
867875
(r * n >= p) && return Z
876+
return _reduce_order_zonotope_common(Z, r, n, p, method)
877+
end
868878

879+
function _reduce_order_zonotope_common(Z, r, n, p, method::Union{ASB10,COMB03,GIR05})
869880
c = center(Z)
870881
G = genmat(Z)
871882

@@ -891,39 +902,7 @@ function reduce_order(Z::AbstractZonotope, r::Real,
891902
return Zonotope(c, Gred)
892903
end
893904

894-
"""
895-
reduce_order(Z::AbstractZonotope, r::Real,
896-
method::JKS16)
897-
898-
Reduce the order of a zonotopic set by overapproximating it with a zonotope that has
899-
fewer generators, using the JKS16 method.
900-
901-
### Input
902-
903-
- `Z` -- zonotopic set
904-
- `r` -- desired order
905-
- `method` -- `JKS16` uses a greedy factorization and iterative generator reduction
906-
907-
### Output
908-
909-
A new zonotope with fewer generators, if possible.
910-
911-
### Algorithm
912-
913-
- The JKS16 method reorders the generator matrix using reduced row echelon form (rref) to form a `T`,
914-
then iteratively removes excess generators from `V` while updating `T`.
915-
- The default `JKS16()` uses `ϵ = 1e-6` (pivot threshold) and `δ = 1e-3` (volume threshold).
916-
Referenced from [SCOTT2016126](@citet).
917-
"""
918-
function reduce_order(Z::AbstractZonotope, r::Real, method::JKS16)
919-
r >= 1 || throw(ArgumentError("the target order should be at least 1, " *
920-
"but it is $r"))
921-
n = dim(Z)
922-
p = ngens(Z)
923-
924-
# if r is bigger than the order of Z => do not reduce
925-
(r * n >= p) && return Z
926-
905+
function _reduce_order_zonotope_common(Z, r, n, p, method::JKS16)
927906
c = center(Z)
928907
G = genmat(Z)
929908

@@ -960,7 +939,7 @@ function reduce_order(Z::AbstractZonotope, r::Real, method::JKS16)
960939
end
961940

962941
# reorder the generator matrix G
963-
function _factorG(G::AbstractMatrix, ϵ::N, δ::N)
942+
function _factorG(G::AbstractMatrix, ϵ::N, δ::N) where {N}
964943
G✶ = copy(G)
965944
n, ng = size(G)
966945

0 commit comments

Comments
 (0)