Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow box_approximation for unbounded sets #3553

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading