Skip to content

Commit

Permalink
Merge pull request #885 from JuliaReach/schillic/intersection_reachset
Browse files Browse the repository at this point in the history
Let `intersection` of reach sets create a reach set
  • Loading branch information
schillic authored Jan 9, 2025
2 parents b160b6a + 6538da6 commit 42e27d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/ReachSets/AbstractReachSet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,22 @@ end
# Concrete intersection methods
# ------------------------------

function intersection(R::AbstractReachSet, S::AbstractReachSet)
return _intersection(set(R), set(S), FallbackIntersection())
end
function _intersection(R::AbstractReachSet, S::AbstractReachSet, method::AbstractIntersectionMethod)
return _intersection(set(R), set(S), method)
function intersection(R::AbstractReachSet, S::AbstractReachSet,
method::AbstractIntersectionMethod=FallbackIntersection())
T1 = tspan(R)
T2 = tspan(S)
T = T1 T2
if isempty(T)
throw(ArgumentError("cannot intersect reach sets with disjoint time intervals"))
end

cap = _intersection(set(R), set(S), method)
return ReachSet(cap, T)
end

# fallback methods for reach-sets
@commutative function _intersection(R::AbstractReachSet, X::LazySet,
method::AbstractIntersectionMethod)
method::AbstractIntersectionMethod=FallbackIntersection())
return _intersection(set(R), X, method)
end

Expand Down
4 changes: 0 additions & 4 deletions src/ReachSets/TaylorModelReachSet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ end
# ======================

# for TMs, we overapproximate with a zonotope
function _intersection(R::TaylorModelReachSet, Y::LazySet)
return _intersection(R, Y, FallbackIntersection())
end

function _intersection(R::TaylorModelReachSet, Y::LazySet, ::FallbackIntersection)
X = set(overapproximate(R, Zonotope))
return intersection(X, Y)
Expand Down

0 comments on commit 42e27d1

Please sign in to comment.