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

Remove confusing membership method #840

Merged
merged 3 commits into from
Aug 27, 2024
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
5 changes: 0 additions & 5 deletions src/Flowpipes/Flowpipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@ function ∈(x::AbstractVector{N}, fp::Flowpipe{N,<:AbstractLazyReachSet{N}}) wh
return any(R -> x ∈ set(R), array(fp))
end

function ∈(x::AbstractVector{N},
fp::VT) where {N,RT<:AbstractLazyReachSet{N},VT<:AbstractVector{RT}}
return any(R -> x ∈ set(R), fp)
end

function LazySets.linear_map(M, fp::Flowpipe)
out = [linear_map(M, R) for R in fp]
return Flowpipe(out, fp.ext)
Expand Down
20 changes: 15 additions & 5 deletions src/Flowpipes/clustering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,25 @@ end
# for Taylor model flowpipes we preprocess it with a zonotopic overapproximation
function cluster(F::Flowpipe{N,TaylorModelReachSet{N}}, idx,
method::LazyClustering{P,Val{true}}) where {N,P}
Fz = overapproximate(Flowpipe(view(F, idx)), Zonotope)
return cluster(Fz, 1:length(idx), method) # Fx is now indexed from 1 ... length(idx)
return _cluster_TM(F, idx, method)
end
# disambiguations
function cluster(F::Flowpipe{N,TaylorModelReachSet{N}}, idx,
method::LazyClustering{Missing,Val{true}}) where {N}
return _cluster_TM(F, idx, method)
end

# ambiguity fix
function cluster(F::Flowpipe{N,TaylorModelReachSet{N}}, idx,
method::LazyClustering{P,Val{false}}) where {N,P}
return _cluster_TM(F, idx, method)
end
function cluster(F::Flowpipe{N,TaylorModelReachSet{N}}, idx,
method::LazyClustering{Missing,Val{false}}) where {N}
return _cluster_TM(F, idx, method)
end

function _cluster_TM(F, idx, method)
Fz = overapproximate(Flowpipe(view(F, idx)), Zonotope)
return cluster(Fz, 1:length(idx), method)
return cluster(Fz, 1:length(idx), method) # Fx is now indexed from 1 ... length(idx)
end

# =====================================
Expand Down
3 changes: 1 addition & 2 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ import Aqua
piracies=(broken=true,))

# do not warn about ambiguities in dependencies
# the ambiguities should be resolved in the future
Aqua.test_ambiguities(ReachabilityAnalysis; broken=true)
Aqua.test_ambiguities(ReachabilityAnalysis)
end
4 changes: 2 additions & 2 deletions test/flowpipes/flowpipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ end

times = 0:0.01:1.9
values = [[x] for x in (@. 1 - exp(-times))]
@test all(vi ∈ H(ti) for (ti, vi) in zip(times, values))
@test all(vi ∈ H′(ti) for (ti, vi) in zip(times, values))
@test all(any(vi ∈ R for R in H(ti)) for (ti, vi) in zip(times, values))
@test all(any(vi ∈ R for R in H′(ti)) for (ti, vi) in zip(times, values))
end

@testset "Flowpipe clustering" begin
Expand Down