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

Fallback implementation for inclusion between polytopic sets #1792

Closed
mforets opened this issue Nov 23, 2019 · 4 comments · Fixed by #1796
Closed

Fallback implementation for inclusion between polytopic sets #1792

mforets opened this issue Nov 23, 2019 · 4 comments · Fixed by #1796
Assignees
Labels
bug 🐛 Something isn't working

Comments

@mforets
Copy link
Member

mforets commented Nov 23, 2019

julia> typeof.([Rt, Tg])

2-element Array{DataType,1}:
 Zonotope{Float64}                                                         
 MinkowskiSum{Float64,Singleton{Float64,Array{Float64,1}},BallInf{Float64}}

julia> Rt  Tg

MethodError: no method matching iterate(::MinkowskiSum{Float64,Singleton{Float64,Array{Float64,1}},BallInf{Float64}})
Closest candidates are:
  iterate(!Matched::Core.SimpleVector) at essentials.jl:604
  iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:604
  iterate(!Matched::ExponentialBackOff) at error.jl:214
  ...

Stacktrace:
 [1] in(::Array{Float64,1}, ::MinkowskiSum{Float64,Singleton{Float64,Array{Float64,1}},BallInf{Float64}}) at ./operators.jl:1055
 [2] (::Array{Float64,1}, ::MinkowskiSum{Float64,Singleton{Float64,Array{Float64,1}},BallInf{Float64}}) at ./operators.jl:1068
 [3] issubset at /home/mforets/.julia/dev/LazySets/src/ConcreteOperations/issubset.jl:229 [inlined]
 [4] issubset(::Zonotope{Float64}, ::MinkowskiSum{Float64,Singleton{Float64,Array{Float64,1}},BallInf{Float64}}) at /home/mforets/.julia/dev/LazySets/src/ConcreteOperations/issubset.jl:226
 [5] top-level scope at In[187]:1

but

julia> Tg_poly = HPolytope(constraints_list(Tg));
julia>Rt_poly = HPolytope(constraints_list(Rt));
julia>Rt_poly  Tg_poly 

true

cc: @dfcaporale, @SebastianGuadalupe

@schillic schillic added the bug 🐛 Something isn't working label Nov 23, 2019
@schillic
Copy link
Member

The problem is in the membership (see the top of the stack trace).

@mforets
Copy link
Member Author

mforets commented Nov 23, 2019

True, dispatch is trying to use the function the uses the vertices (this one). However, in general it is more efficient and less error-prone to use the support function (this function) which is triggered if one swaps the containment check.

I would add an algorithm choice for ⊆(P::AbstractPolytope{N}, S::LazySet{N}), such that algorithm='vertices' and algorithm='constraints' allows to choose the method, letting the constraints algorithm to be the default one.

@mforets
Copy link
Member Author

mforets commented Nov 23, 2019

For a new method to handle the computation in [1] of the stack trace, i've opened #1793.

@schillic
Copy link
Member

I would add an algorithm choice for ⊆(P::AbstractPolytope{N}, S::LazySet{N}), such that algorithm='vertices' and algorithm='constraints' allows to choose the method, letting the constraints algorithm to be the default one.

Sounds good.

mforets added a commit that referenced this issue Nov 27, 2019
* add algorithm option and set constraints to the default

* Update src/ConcreteOperations/issubset.jl

Co-Authored-By: Christian Schilling <[email protected]>

* Update src/ConcreteOperations/issubset.jl

* update the default

* swap conditional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants