Skip to content

Commit

Permalink
Merge pull request #3553 from JuliaReach/schillic/box_approximation
Browse files Browse the repository at this point in the history
Disallow `box_approximation` for unbounded sets
  • Loading branch information
schillic authored Sep 7, 2024
2 parents 853a9aa + 8a3af7d commit a6f15cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Approximations/box_approximation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ function box_approximation(S::LazySet{N}) where {N}
r = Vector{N}(undef, n)
@inbounds for i in 1:n
lo, hi = extrema(S, i)
if isinf(lo) || isinf(hi)
throw(ArgumentError("the box approximation of an unbounded set is undefined"))
end
ri = (hi - lo) / 2
if ri < zero(N)
if !_geq(ri, zero(N))
Expand Down
3 changes: 3 additions & 0 deletions test/Sets/Line.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ for N in [Float64, Rational{Int}, Float32]
# boundedness
@test !isbounded(l1)

# box_approximation
@test_throws ArgumentError box_approximation(l1)

# ispolyhedral
@test ispolyhedral(l1)

Expand Down

0 comments on commit a6f15cd

Please sign in to comment.