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

Intersection of two reach sets #598

Closed
ga72kud opened this issue Feb 4, 2022 · 2 comments
Closed

Intersection of two reach sets #598

ga72kud opened this issue Feb 4, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ga72kud
Copy link

ga72kud commented Feb 4, 2022

ℛₐ = ReachabilityAnalysis.solve(prob_set_sysₐ, alg=GLGM06=Ts), T=TT[end], c=:yellow);
ℛᵦ = ReachabilityAnalysis.solve(prob_set_sysᵦ, alg=GLGM06=Ts), T=TT[end], c=:yellow);
ℛ=ℛₐℛᵦ

Ra and Rb are from type RechabilityAnalysis.Reachsolution Is this possible to intersect both reach sets?

I tried something like this

=[ℛₐ.F.Xk[i].Xℛᵦ.F.Xk[i].X for i in 1:length(ℛₐ.F.Xk)] #this does not work

        𝒫ℛₐ=project(ℛₐ , [1, 2])
        𝒫ℛᵦ=project(ℛᵦ , [1, 2])
        𝒫ℛ=𝒫ℛₐ𝒫ℛᵦ
        𝒫ℛ=[𝒫ℛₐ.Xk[i].X𝒫ℛᵦ.Xk[i].X for i in 1:length(𝒫ℛₐ.Xk)]
@schillic schillic added the enhancement New feature or request label Feb 4, 2022
@schillic
Copy link
Member

schillic commented Feb 4, 2022

This seems to not be supported out of the box. But your workaround works for me, including

ℛ=[ℛₐ.F.Xk[i].X∩ℛᵦ.F.Xk[i].X for i in 1:length(ℛₐ.F.Xk)] #this does not work

The problem is that you then lose all other information stored in the ReachSets/ReachSolution. I agree that it would be nice to support this as an operation on the ReachSolution in the library.

There are other things to note here:

  1. The operation is interpreted as a lazy intersection (see JuliaReach/LazySets.jl for details), which is why you get a result quickly. If you want to instead compute the concrete intersection (expensive in general), you can do ℛ = intersection.(ℛₐ, ℛᵦ) (note the . for broadcasting). Interestingly, this is supported. But doing this is expensive in higher dimensions.
  2. The reachable set used by GLGM06 is represented by (a sequence of) zonotopes. For these an intersection can be computed (however, in general this can be expensive). For nonlinear systems we currently only support Taylor models and their intersection is not supported. But you can obtain conservative overapproximations.

@ga72kud
Copy link
Author

ga72kud commented Feb 4, 2022

Thanks! intersection. is what I can use, awesome!

@ga72kud ga72kud closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants