swoodhouse / Game

Other
1 stars 0 forks source link

Test if Existential Quantification works #19

Closed MClarke1991 closed 4 years ago

MClarke1991 commented 4 years ago

Around https://github.com/swoodhouse/Game/blob/b71e0ff472daea7a9f169cbc50b676030c4fee3a/src/GameDLL/GameDLL/Attractors.cpp#L325 in Attractors::attractors in src/GameDLL/GameDLL/Attractors.cpp there is an existential quantification which needs to be tested to make sure it works.

MClarke1991 commented 4 years ago

Cannot have a node of granularity > 100. Instead making a chain of 11 nodes of granularity 100 for combined granularity of 1100

MClarke1991 commented 4 years ago

And if I have nodes zi for 0<=i<=10 each must have a target function of the form `z{i+1} = min(var(z_i)-99,1)*var(z_i)`

swoodhouse commented 4 years ago

It's possible the check I want to do is more like

BDD variablesToKeepNonZero = (fr * br).ExistAbstract(nonPrimeVariables);
BDD frIntersected = fr * variablesToKeepNonZero;
BDD brIntersected = br * variablesToKeepNonZero;
 if ((frIntersected * !brIntersected).IsZero()) ....

I need to think about it a bit.

MClarke1991 commented 4 years ago

Well, this network doesn't stabilise in <1000 steps (uploaded as a .txt so Github will like it) EQ_test_1_not_a_json.txt EQ_test_1_does_not_stabilise_in_1000_steps EQ_test_1_not_a_csv.txt

swoodhouse commented 4 years ago

Thinking aloud.. fr will always reach an attractor, for all mutation configurations. Br may = fr for some config, in which case fr is an attractor, else fr is a superset of an attractor.

What we don't want to happen is for fr for some config to be a superset of an attractor but for other configs be equal to an attractor. If this happens, fr * !br != 0 and then when we remove br we will miss these attractors and never explore them again.

swoodhouse commented 4 years ago

An inelegant fix would be to loop over all configs, select the fr and br for that config (fr' = fr config, and br' = br config), and check whether fr' * !br' = 0.

I was trying to do a more elegant symbolic implementation of this.

swoodhouse commented 4 years ago

variablesToKeepNonZero = (fr br).ExistAbstract(nonPrimeVariables) was supposed to give you all configs such that fr' !br = 0.

swoodhouse commented 4 years ago
configsWithAttractors = (br * !fr).ExistAbstract(nonPrimeVariables)
frIntersected = fr * configsWithAttractors
if frIntersected != 0:
  add frIntersected
S = S - s - br
swoodhouse commented 4 years ago

There's a much more elegant solution that I just committed - simply unroll the network until you have definitely hit an attractor in all models, rather than a constant number of steps. I'm pretty sure this resolves this issue.