-
Notifications
You must be signed in to change notification settings - Fork 32
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
#619 Is intersection empty for polytopes #624
Conversation
""" | ||
function isempty(P::AbstractPolytope{N})::Bool where {N<:Real} | ||
return isempty(vertices_list(P)) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is the correct interpretation. To me, an HPolytope
/HPolygon
with no constraints is either not defined or universal (because each new constraint removes parts of the set).
Also, add a new line at the end of the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that the HPolytope
with no constraints is particular case that could be treated separately as being "universal", the whole R^n.
For VPolytope
, i think it is reasonable to say that if it has no vertices then it only contains the empty set, V = convex_hull{{}}
.
I was concerned with the case where the set is defined by a set of constraints with empty intersection. For instance consider the pair of constraints x <= -1 && x >= 1
:
julia> P = HPolytope([LazySets.HalfSpace([1.0, 0.0], -1.0), LazySets.HalfSpace([-1.0, 0.0], -1.0)])
LazySets.HPolytope{Float64}(LazySets.HalfSpace{Float64}[LazySets.HalfSpace{Float64}([1.0, 0.0], -1.0), LazySets.HalfSpace{Float64}([-1.0, 0.0], -1.0)])
julia> isempty(P)
true
julia> vertices_list(P)
0-element Array{Array{Float64,1},1}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than finding workarounds, we could accept that our algorithms are generally not correct for invalid polytope inputs, like unbounded or contradicting constraints 😉
For VPolytope, i think it is reasonable to say that if it has no vertices then it only contains the empty set, V = convex_hull{{}}.
Sure.
If HPolytope
and HPolygon
are problematic, should we replace AbstractPolytope
by Union{VPolygon, VPolytope}
then? Our other polytopic sets can never be empty by definition anyway.
src/is_intersection_empty.jl
Outdated
witness::Bool=false | ||
)::Union{Bool, Tuple{Bool, Vector{N}}} where {N<:Real} | ||
|
||
Check whether a pair of polytopes do not intersect, and otherwise optionally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"a pair of" → "two"
LazySets.binary_operations:Test Failed
Expression: check_method_ambiguity_binary(is_intersection_empty) |
i have no clue about the failing doctest in 0.7 |
witness::Bool=false | ||
)::Union{Bool, Tuple{Bool, Vector{N}}} where {N<:Real} | ||
return is_intersection_empty(point, set, witness) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agghhh there is some obscure setting in my editor (atom) which removes the empty lines
You have to add the type parameter in Funny that it worked in one of the builds. |
Closes #619.