JuliaReach / LazySets.jl

Scalable symbolic-numeric set computations in Julia
https://juliareach.github.io/LazySets.jl/
Other
226 stars 32 forks source link

Containment check #68

Closed schillic closed 6 years ago

schillic commented 6 years ago

Add a containment check ∈(x, S) for all sets.

For some we already have is_contained. I prefer in instead (the Julia alias for ).

mforets commented 6 years ago

where x is a point? for polygons we should check point in polygon algorithms.

agreed for overloading in

mforets commented 6 years ago

.. still we can use is_contained in the mathematical sense, as for #69

schillic commented 6 years ago

Yes, x is a point. Should it be a Vector or a Singleton? We can provide a convenience conversion function for the other combination.

mforets commented 6 years ago

we can implement it with sets, i.e. using Singleton, and also provide the shortcut for x being a Vector.

schillic commented 6 years ago

I thought about it and I think it is more efficient to unwrap a Singleton (which is anyway what has to be done) in one case than to wrap a vector in a Singleton in the other case. So I want to implement it for AbstractVector and provide a conversion function for Singleton.

Where would we define the conversion function? Inside LazySets.jl? Maybe we should create a new file for general LazySet functions (we already have norm/radius/diameter in box_approximations.jl, so we could move them there as well).

schillic commented 6 years ago

for polygons we should check point in polygon algorithms.

Thanks for this pointer. I will implement the "dot product" solution from the bottom of the page.

The algorithms in this link work for nonconvex polygons, and at the bottom it is said "Simpler algorithms are possible for [...] convex polygons [...]." We also already have an implementation for HPolygon using support vectors. Not sure if this is "optimal", though. We can always add better algorithms later, for now I just want one solution.

schillic commented 6 years ago

We are not 100% sure that the Zonotope implementation works in all cases, but keep it for now. @schillic expects it to fail for linearly dependent generators only.

Most types are now supported by #74. Eventually we can continue in #77 with the missing ones.