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

Conversation

KalelR
Copy link
Contributor

@KalelR KalelR commented Aug 6, 2024

As discussed in #143, filtering out repetitive (e.g., 4=>4) entries in rmap can lead to problems when key_retraction is used. A simple fix that works is to remove the filter line, as I'm doing here.

I've also added the test I was doing when I found this error. Without the filter, the code works great, resulting in the right column in this figure

matching_by_flow_example-method-2-dummy_multistable_equilibrium!

Note that this is not the "actual" behavior of the system, as by construction the attractor at 0 moves to -5, as shown on the left column. This is however a consequence of matching by distance in state space, not a problem with the code.

Copy link
Member

@Datseris Datseris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current test added is unecessarily complex. This is not problem with continuation, it is a problem with matching, only,. There is no need to define a dynamical system or make a continuation.

Why don't you just use this code?

using Attractors

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)
matcher = MatchBySSSetDistance()
rmaps = match_sequentially!(mapped_atts, matcher)

fractions_cont = [Dict(1 => 1.0), Dict(1 => 1.0), Dict(2 => 0.8091908091908092, 1 => 0.19080919080919082), Dict(2 => 0.1906187624750499, 1 => 0.8093812375249501), Dict(2 => 0.18862275449101795, 3 => 0.6207584830339321, 1 => 0.1906187624750499), Dict(2 => 0.6211365902293121, 3 => 0.19042871385842472, 1 => 0.18843469591226322), Dict(4 => 0.4097706879361914, 2 => 0.19042871385842472, 3 => 0.18843469591226322, 1 => 0.21136590229312063), Dict(4 => 0.21115537848605578, 2 => 0.1902390438247012, 3 => 0.18824701195219123, 1 => 0.4103585657370518), Dict(5 => 0.21613545816733068, 4 => 0.1942231075697211, 2 => 0.1902390438247012, 3 => 0.18824701195219123, 1 => 0.21115537848605578)]

mapped_fracs = deepcopy(fractions_cont)
match_sequentially!(mapped_fracs, rmaps)

Furthermore, why are the basins such complex numbers instead of just 0.1, 0.2, ... etc.? You can make them programmatically from the attractors by equi-distributing the number 1 to all attractors.

Copy link
Member

@Datseris Datseris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to increment patch version in Project.toml

@Datseris Datseris merged commit 835f6a7 into JuliaDynamics:main Aug 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants