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

Let intersection of reach sets create a reach set #885

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading