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

Fix matching by SSSet distance #144

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 0 additions & 2 deletions src/matching/sssdistance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ function _matching_map_distances(keys₊, keys₋, distances::Dict, threshold;
end
end

# the final step is to filter out equivalent mappings where key and value are the same
filter!(p -> p.first ≠ p.second, rmap)
return rmap
end

Expand Down
16 changes: 16 additions & 0 deletions test/continuation/matching_attractors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ end
end
end

@testset "synthetic multistable matching" begin
attractors_cont_simple = Dict{Int64, SVector{1, Float64}}[Dict(1 => [0.0]), Dict(1 => [0.0]), Dict(2 => [2.0], 1 => [0.0]), Dict(2 => [0.0], 1 => [2.0]), Dict(2 => [2.0], 3 => [4.0], 1 => [-5.0]), Dict(2 => [4.0], 3 => [-5.0], 1 => [2.0]), Dict(4 => [6.0], 2 => [0.0], 3 => [2.0], 1 => [4.0]), Dict(4 => [4.0], 2 => [0.0], 3 => [2.0], 1 => [6.0]), Dict(5 => [8.0], 4 => [6.0], 2 => [0.0], 3 => [2.0], 1 => [4.0])]
attractors_cont = [Dict(k=>StateSpaceSet(Vector(v)) for (k,v) in atts) for atts in attractors_cont_simple]

mapped_atts = deepcopy(attractors_cont)
rmaps = match_sequentially!(mapped_atts, default)

fractions_cont = [Dict(1 => 1.0), Dict(1 => 1.0), Dict(2 => 0.8, 1 => 0.2), Dict(2 => 0.2, 1 => 0.8), Dict(2 => 0.2, 3 => 0.6, 1 => 0.2), Dict(2 => 0.6, 3 => 0.2, 1 => 0.2), Dict(4 => 0.4, 2 => 0.2, 3 => 0.2, 1 => 0.2), Dict(4 => 0.2, 2 => 0.2, 3 => 0.2, 1 => 0.4), Dict(5 => 0.2, 4 => 0.2, 2 => 0.2, 3 => 0.2, 1 => 0.2)]
mapped_fracs = deepcopy(fractions_cont)
match_sequentially!(mapped_fracs, rmaps)

@test all(keys.(attractors_cont) .== keys.(mapped_atts) )
@test all(keys.(attractors_cont) .== keys.(mapped_fracs) )
@test all(Set.(values.(fractions_cont)) .== Set.(values.(mapped_fracs)))
end

@testset "global_continuation matching" begin
# Make fake attractors with points that become more "separated" as "parameter"
# is increased
Expand Down
Loading