Skip to content

Commit

Permalink
disallow box_approximation for unbounded sets
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Aug 24, 2024
1 parent 6e1f954 commit 8a3af7d
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 8a3af7d

Please sign in to comment.