Automated tests whether a rule is explosive; testOfRules.py

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Automated tests whether a rule is explosive; testOfRules.py

Post by martin.novy » June 23rd, 2020, 7:21 am

:arrow: Links
parent topic: (semi-)automated searches in rulespaces viewtopic.php?f=9&t=4561
applied to LtL: https://conwaylife.com/forums/viewtopic ... 350#p99727
applied to HROT: viewtopic.php?f=11&t=4434&p=101536#p101536

====

my scripts testOfRules*.py

after version 400 the program testOfRules*.py doesn't depend on Jupyter or IPython anymore

code https://github.com/martin12333/PyMartin ... estOfRules

input data https://github.com/martin12333/PyMartin ... elib-input

raw output data https://github.com/martin12333/PyMartin ... les/output

filtered, sorted output data https://github.com/martin12333/PyMartin ... s/filtered

(nothing yet: retest of the filtered https://github.com/martin12333/PyMartin ... recomputed)

----

(older versions 300-399 testOfRules*.ipynb)

(the more stable version is in the *master* branch;
github sometimes shows previews of ipynb, but better is nbviewer
https://nbviewer.jupyter.org/github/mar ... lob/master)

(the less stable version is in the *beta* branch
https://nbviewer.jupyter.org/github/mar ... ta/JUPYTER)
Last edited by martin.novy on August 2nd, 2020, 9:01 am, edited 7 times in total.

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » June 23rd, 2020, 7:22 am

lemon41625 wrote:
June 22nd, 2020, 9:00 pm

Alternatively, you could use lifelib and ...
... you can set a threshold for a explosive rule and a non explosive rule.
a demo program, that automatically tests for explosiveness

a soup 50*50, computed for 600 generations

log2( population_at_time_600 / population_at_time_300 )
could be an estimate of the exponent of growth


or without log2()
population_at_time_600 / population_at_time_300
could be an estimate of growth
threshold= 1.6 ?



demo-1exp--lifelib

Code: Select all

from __future__ import print_function
import lifelib
import math

################ tunable parameters

#rulestr='b3s23'
rulestr='r2b7t9s7t10'
rulestr='r2b7t12s7t10' 

w2=50#1000#100#1000#256#128#16#25
h2=50#32#16
niter=300#2000#6#2000#1000#500#10000#5000#800 #2400 #1500

###########################


schema1='tag1,time_s,time11,pop_s,population,space_s,w2,h2,w,h,rule_s,rulespace,rulestr'
print(schema1.replace(',',' '))



sess = lifelib.load_rules(rulestr)

lt = sess.lifetree()


p1=lt.pattern()
p=0.5 #0.3
p1[0:h2, 0:w2] = p

bb=p1.bounding_box
print(bb)

#######################################

p1 = p1[niter]

#######################################

bb=p1.bounding_box
print(bb)

h=1
w=1
if bb:
    h=bb[2]-bb[0]
    w=bb[3]-bb[1]

tag1='soup'
time_s='time'
time11=niter
pop_s='pop'
population=p1.population ;  population_niter = population
space_s='space'
rule_s='rule'
rulespace='lifelib'

print(tag1,time_s,time11,pop_s,population,space_s,w2,h2,w,h,rule_s,rulespace,rulestr)

#######################################

p1 = p1[niter]

#######################################

bb=p1.bounding_box
#print(bb)

h=1
w=1
if bb:
    h=bb[2]-bb[0]
    w=bb[3]-bb[1]


tag1='soup'
time_s='time'
time11=niter*2
pop_s='pop'
population=p1.population ;  population_2niter = population
space_s='space'
rule_s='rule'
rulespace='lifelib'

print(tag1,time_s,time11,pop_s,population,space_s,w2,h2,w,h,rule_s,rulespace,rulestr)
ratio= population_2niter/population_niter
print( ratio,  math.log2(ratio) )
tag1 time_s time11 pop_s population space_s w2 h2 w h rule_s rulespace rulestr
[0, 0, 50, 50]
[-58, -46, 159, 149]
soup time 300 pop 6079 space 50 50 195 217 rule lifelib r2b7t12s7t10
soup time 600 pop 15329 space 50 50 380 369 rule lifelib r2b7t12s7t10
2.521631847343313 1.334357660764367
Last edited by martin.novy on June 24th, 2020, 7:33 am, edited 1 time in total.

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » June 24th, 2020, 7:31 am

----
please post: some rules in lifelib notation: I will test them using my new program

(I have written a python script named
testing-rules-using-lifelib)

it computes measurements on random soups

it reads lines from an input file, for example default.rules.csv :

Code: Select all

rule lifelib b3s23
rule lifelib b3s23
rule lifelib b3s23
rule lifelib b13s23
rule lifelib b23s23
rule lifelib b34s23
rule lifelib b35s23
rule lifelib b36s23
rule lifelib b37s23
rule lifelib b38s23
rule lifelib r2b7t9s7t10
rule lifelib r2b7t12s7t10

it appends lines to an output file, for example 1.rules.csv :

Code: Select all

soup time 600 pop 406 ratio 1.1 space 50 50 85 135 rule lifelib b3s23
soup time 600 pop 525 ratio 0.9 space 50 50 348 472 rule lifelib b3s23
soup time 600 pop 359 ratio 1.0 space 50 50 324 399 rule lifelib b3s23
soup time 600 pop 607352 ratio 3.7 space 50 50 1850 1850 rule lifelib b13s23
soup time 600 pop 322111 ratio 3.5 space 50 50 1850 1850 rule lifelib b23s23
soup time 600 pop 21922 ratio 2.8 space 50 50 455 424 rule lifelib b34s23
soup time 600 pop 36 ratio 1.0 space 50 50 59 32 rule lifelib b35s23
soup time 600 pop 235 ratio 0.5 space 50 50 431 449 rule lifelib b36s23
soup time 600 pop 405 ratio 1.0 space 50 50 301 321 rule lifelib b37s23
soup time 600 pop 201 ratio 0.8 space 50 50 466 445 rule lifelib b38s23
soup time 600 pop 36 ratio 1.0 space 50 50 8 16 rule lifelib r2b7t9s7t10
soup time 600 pop 14724 ratio 2.7 space 50 50 319 359 rule lifelib r2b7t12s7t10

the meaning:

soup time 600 pop 406 ratio 1.1 space 50 50 85 135 rule lifelib b3s23

a soup was simulated for 600 time steps,

pop 406
the current population,

ratio 1.1
population_at_now / population_at_half_time ,

space 50 50 85 135
the initial soup was 50*50; now it is 85*135 ,

rule lifelib b3s23


----
links to github moved to the top of this topic
Last edited by martin.novy on July 19th, 2020, 7:13 am, edited 5 times in total.

User avatar
LaundryPizza03
Posts: 2296
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Automated tests whether a rule is explosive

Post by LaundryPizza03 » June 24th, 2020, 9:55 pm

You could average over multiple soups and run for longer if needed. The exponent of the growth matters as well; explosions should have O(t^2) growth rate.

Here are some more borderline cases to try out:

Code: Select all

b378s01356 #Long-lived, but still stable
b368s12578 #Marginally explosive; contains a linear replicator
b3-q4z5ys234k5j #Quickly settles, but explodes if there is a quadratic replicator
b01346s023 #Has approximately 0.0343 linear growth patterns per soup
b34a6ns2aek3-a4a #A rare example of an apgsearchable rule with a (relatively common) zz_QUADRATIC; also has a common gun
b357s1358 #Explodes at very large soup sizes, but smaller soups always die down
b3aeijs01c2n3ack4q5a6e #Has a common O(sqrt(t)) growth pattern

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » June 26th, 2020, 11:12 am

LaundryPizza03 wrote:
June 24th, 2020, 9:55 pm

Here are some more borderline cases to try out
thanks a lot for *borderline* cases.

I have added a few rules for comparison:
the input file: borderline1.rules.csv

Code: Select all

rule lifelib b378s01356 #Long-lived, but still stable
rule lifelib b368s12578 #Marginally explosive; contains a linear replicator
rule lifelib b3-q4z5ys234k5j #Quickly settles, but explodes if there is a quadratic replicator
rule lifelib b01346s023 #Has approximately 0.0343 linear growth patterns per soup
rule lifelib b34a6ns2aek3-a4a #A rare example of an apgsearchable rule with a (relatively common) zz_QUADRATIC; also has a common gun
rule lifelib b357s1358 #Explodes at very large soup sizes, but smaller soups always die down
rule lifelib b3aeijs01c2n3ack4q5a6e #Has a common O(sqrt(t)) growth pattern
rule lifelib b3s23 #added for comparison
rule lifelib r2b7t9s7t10 #added for comparison
rule lifelib r2b7t12s7t10 #added for comparison

the output:

Code: Select all

soup time 1600 pop 5802 ratio 0.8 space 800 30 831 113 rule lifelib b378s01356 #Long-lived, but still stable
soup time 1600 pop 7272 ratio 0.9 space 800 30 859 277 rule lifelib b368s12578 #Marginally explosive; contains a linear replicator
soup time 1600 pop 11986 ratio 3.0 space 800 30 857 683 rule lifelib b3-q4z5ys234k5j #Quickly settles, but explodes if there is a quadratic replicator
soup time 1600 pop 2336 ratio 1.9 space 800 30 1605 2442 rule lifelib b01346s023 #Has approximately 0.0343 linear growth patterns per soup
soup time 1600 pop 505 ratio 1.4 space 800 30 1791 1179 rule lifelib b34a6ns2aek3-a4a #A rare example of an apgsearchable rule with a (relatively common) zz_QUADRATIC; also has a common gun
soup time 1600 pop 12311 ratio 1.1 space 800 30 832 111 rule lifelib b357s1358 #Explodes at very large soup sizes, but smaller soups always die down
soup time 1600 pop 1870 ratio 1.0 space 800 30 801 36 rule lifelib b3aeijs01c2n3ack4q5a6e #Has a common O(sqrt(t)) growth pattern
soup time 1600 pop 2080 ratio 1.0 space 800 30 1865 1218 rule lifelib b3s23 #added for comparison
soup time 1600 pop 300 ratio 1.0 space 800 30 763 947 rule lifelib r2b7t9s7t10 #added for comparison
soup time 1600 pop 224727 ratio 2.3 space 800 30 1546 943 rule lifelib r2b7t12s7t10 #added for comparison
the meaning:

ratio
population_at_now / population_at_half_time ,

space ...
the initial soup was ...; now it is ... ,

(i have changed the initial shape of the soup from a square to a stripe)

----
I would like to encourage everyone to post more rules ... I will post the results and the population plots
----
in the plot
the horizontal axis is time
the vertical axis is population
Attachments
Screenshot from 2020-06-26 1648.png
Screenshot from 2020-06-26 1648.png (279.83 KiB) Viewed 4185 times
Last edited by martin.novy on June 29th, 2020, 6:09 am, edited 2 times in total.

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » June 28th, 2020, 12:01 pm

a test:

I have computed data about 18 R2 LtL rules

https://docs.google.com/spreadsheets/d/ ... edit#gid=0

filtered for PPratio <1.6

filtered for height >100

result: 4 known R2 LtL rules r2b7t*s7t*

User avatar
LaundryPizza03
Posts: 2296
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Automated tests whether a rule is explosive

Post by LaundryPizza03 » June 29th, 2020, 3:15 am

martin.novy wrote:
June 26th, 2020, 11:12 am
LaundryPizza03 wrote:
June 24th, 2020, 9:55 pm

Here are some more borderline cases to try out
thanks a lot for *borderline* cases.

I have added a few rules for comparison:
the input file: borderline1.rules.csv
----
I would like to encourage everyone to post more rules ... I will post the results and the population plots
Which lines correspond to which rules?

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » June 29th, 2020, 5:52 am

LaundryPizza03 wrote:
June 29th, 2020, 3:15 am

Which lines correspond to which rules?

issue67: the plot should have legend

(issue03..issue46 don't exist)

before I fix it:

the horizontal axis is time
the vertical axis is population

there are 4 rules with ratio > 1.3

they have populations:

Code: Select all

 11986 ratio 3.0 space 800 30 857 683 rule lifelib b3-q4z5ys234k5j #Quickly settles, but explodes if there is a quadratic replicator
 2336 ratio 1.9 space 800 30 1605 2442 rule lifelib b01346s023 #Has approximately 0.0343 linear growth patterns per soup
 505 ratio 1.4 space 800 30 1791 1179 rule lifelib b34a6ns2aek3-a4a #A rare example of an apgsearchable rule with a (relatively common) zz_QUADRATIC; also has a common gun
 224727 ratio 2.3 space 800 30 1546 943 rule lifelib r2b7t12s7t10 #added for comparison
so e.g. the violet growing line must be b34a6ns2aek3-a4a #A rare example of an apgsearchable rule with a (relatively common) zz_QUADRATIC

User avatar
LaundryPizza03
Posts: 2296
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: Automated tests whether a rule is explosive

Post by LaundryPizza03 » July 16th, 2020, 8:37 am

I've compiled a list of 100 randomly-generated non-relativstic rules, if you'd like to try them out. The list will need some grep formatting, though.

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » July 17th, 2020, 11:55 am

LaundryPizza03 wrote:
July 16th, 2020, 8:37 am
I've compiled a list of 100 randomly-generated non-relativstic rules, if you'd like to try them out. The list will need some grep formatting, though.

My script testOfRules-from-csv-or-cube.ipynb now can test 2 rules per minute, calling lifelib

But there is a problem: program runs-out of free memory after approx. 100 rules, and only restarting Jupyter-python-kernel helps

I will have to diagnose this problem better

EDIT: workaround : calling
python testOfRules.py
repeatedly from another script
----
Screenshot from 2020-07-17 1758.png
Screenshot from 2020-07-17 1758.png (355.5 KiB) Viewed 3910 times
interestingly, in the pop plot, there is one rule that first shrinks and then grows, non-smoothly, like CGOL does ... it is the rule #31 (a blue curve)

soup time 1584 pop 2360 ratio 1.3 space 1600 30 1613 805 rule lifelib b2-ak3eknr4eijnry5ceikq6-cn7e8s012ekn3inry4-acej5jn6-ak78 sumpop 4141728 i 31

... I looked at it in Golly, but it isn't like CGOL ... it grows like a fractal
----

EDIT: I have recomputed all 100 rules with a soup 32768*30;
all the numbers are at
https://docs.google.com/spreadsheets/d/ ... edit#gid=0

EDITED: when I filtered the results for non-explosiveness, 21 remained

EDITED: I ordered them by height, and excluded PPratio 1.00 (settle quickly)


OLD: the highest height have #31 #24 #61 #42
EDIT: the highest height have #34 #31 #24 #42 #78

tag1 time_s time11 pop_s population ratio_s PPratio space_s w2 h2 w h rule_s rulespace rulestr x sumpop x i v
soup time 3996 pop 327864 ratio 0.86 space 32768 30 33616 2939 rule lifelib b2en3-ar4anty5aijkn6as1c2cen3acery4cjnrtwy5-ijqy6ack7e8 sumpop 1536468144 i 34 0.363988989
soup time 3996 pop 26923 ratio 0.99 space 32768 30 33164 1921 rule lifelib b2-ak3eknr4eijnry5ceikq6-cn7e8s012ekn3inry4-acej5jn6-ak78 sumpop 135110004 i 31 0.2366116116
soup time 3996 pop 43057 ratio 1.04 space 32768 30 32799 1540 rule lifelib b2cek3cky4cektwz5qr6ckn7s01c2aen3-eir4-aiqz5-acy6e sumpop 209715372 i 42 0.1889389389
soup time 3996 pop 30485 ratio 0.77 space 32768 30 32825 1367 rule lifelib b2ce3-cejq4ekqtyz5-anqy6cn7c8s12ik3jnr4erw5kqr6-kn7 sumpop 268924116 i 24 0.1672922923
soup time 3996 pop 44496 ratio 1.01 space 32768 30 32767 660 rule lifelib b2in3aiq4cijtz5ceij6ack7c8s01e2ik3aijy4jkw5-acq6ck7e8 sumpop 175877928 i 78 0.07882882883

----

I would like to encourage everyone to post more rules ... I will post the testOfRules results and the population plots
Last edited by martin.novy on August 6th, 2020, 10:31 am, edited 4 times in total.

User avatar
martin.novy
Posts: 142
Joined: October 22nd, 2014, 6:22 am
Location: Czechia, EU
Contact:

Re: Automated tests whether a rule is explosive

Post by martin.novy » July 26th, 2020, 8:52 am

some discussion at discord
https://discord.com/channels/3579222555 ... 1529283674

(... a program (testOfRules) that searches for HROT rules. It has tested already 10000 almost completely random rules in a few days (8 rules per minute using lifelib). ...)

Post Reply