-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
216 lines (142 loc) · 7.95 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
Model-S -- Symbiosis Promotes Fitness Improvements in the Game of Life
======================================================================
Peter Turney
January 17, 2021
Model-S is a tool for modeling symbiosis. Model-S is implemented as a
set of Python scripts that work with the Golly software for the Game
of Life.
This document describes how to install and run Model-S in Windows 10.
With some changes, you should also be able to run Model-S in Linux
or Mac OS.
Installing Model-S
==================
(1) Download and Install Golly
Golly is a C++ program for the simulation of cellular automata:
- https://en.wikipedia.org/wiki/Golly_(program)
I used the 64-bit Golly 4.0 for Windows 10 (golly-4.0-win-64bit.zip):
- http://golly.sourceforge.net/
- https://sourceforge.net/projects/golly/files/latest/download
Golly is stored in a zip file. I created a directory called Golly
and put the contents of the zip file in this directory:
- C:\Users\peter\Golly
(2) Download and Install Python
Golly can be extended with scripts written in Python or Lua. Model-S is
a set of Python scripts that run with Golly.
I used Python 3.9.1 for Windows (python-3.9.1-amd64.exe). Golly 4.0
is designed to work with Python 3.3+. It no longer works with Python 2.X.
Here is some information on using Python with Golly:
- http://golly.sourceforge.net/Help/python.html
(3) Download and Install Numpy and Statistics
Numpy provides Python numerical functions needed by Model-S. After Python
has been installed, Numpy can be installed in Windows 10 by opening a
command prompt and executing the following commands:
> pip3 install numpy
> pip3 install wheel
> pip3 install statistics
You should be able to find pip3 here:
C:\Users\MyUserName\AppData\Local\Programs\Python\Python39\Scripts
(4) Download and Install Model-S
Create a subdirectory of your Golly directory and put the Model-S files
in this subdirectory. In my case, the Model-S files are in this
directory:
- C:\Users\peter\Golly\Model-S
Golly needs to know where to find the rules for the Immigration game.
The rules are in the file Immigration.rule in the Model-S files.
Start Golly and navigate through the Golly menu system as follows:
- File > Preferences > Control > Your Rules ...
Click on "Your Rules ..." and enter the Model-S directory:
- C:\Users\peter\Golly\Model-S
(5) Adjust Windows 10 Antimalware Service
Windows 10 Antimalware Service wastes a lot of CPU time checking Golly
for malware, whenever Golly is executing. To free up your CPU, tell the
Antimalware Service not to check Golly:
- open Windows Defender Security Center
- select Virus & threat protection
- select Virus & threat protection settings
- select Add or remove exclusions
- add the Golly process (Golly.exe)
(6) Adjust Windows 10 Update Policy
Windows 10 will periodically install updates and restart the computer
without asking for permission. This will terminate an ongoing simulation
prematurely. To prevent this, you need to use the Windows Group Policy
Editor, which is available in Windows 10 Pro, but not in Windows 10 Home.
If you have Windows 10 Home, it is worthwhile to upgrade to Windows 10 Pro.
Here is information about how to set the Windows Group Policy Editor
to prevent termination of a simulation run:
- https://docs.microsoft.com/en-us/windows/deployment/update/waas-restart
I set my group policy as follows:
- Local Computer Policy > Computer Configuration > Administrative Templates
> Windows Components > Windows Update
- Configure Automatic Updates = Enabled = 2 = Notify before downloading
and installing any updates
- No auto-restart with logged on users for scheduled automatic updates
instalations = Enabled
Running Model-S
===============
(1) run_model.py -- run a simulation; evolve a population
The main routine for running Model-S is run_model.py. It uses the
supporting code in model_classes.py, model_functions.py, and
model_parameters.py. It also uses the rules for the Immigration
Game, in the file Immigration.rule.
To run Model-S, start Golly and then open the Model-S folder in the
left panel of Golly. Click on run_model.py to start the simulation.
You can control the behaviour of the simulation by editing the
numbers in the parameter file, model_parameters.py, before you
start Golly.
When Golly is running, the Golly screen will show the final outcome of
each Immigration game that is played. The intermediate stages of the
games are not displayed, in order to maximize the speed of the simulation.
If you want a more detailed view of an individual game, use the
script view_contest.py. A typical simulation run takes about two to
six days for 100 generations, depending on the speed of the computer
and the settings of the parameters.
As run_model.py executes, it stores a log file with some statistics
from the run. It also stores samples (pickles) of individuals that
evolve during the run. The directory where these files are stored,
log_directory, is specified in model_parameters.py. You should
create a folder for storing the files and edit model_parameters.py
so that log_directory points to your desired folder.
(2) compare_generations.py -- compare populations across generations
As a simulation runs, Model-S stores samples of the population for each
generation. After the simulation ends, compare_generations.py can
compare samples across different generations. Individuals in an
earlier generation will compete with individuals in a later generation
in repeated Immigration Games. In general, we expect that individuals
in the later generation will perform better than individuals in an
earlier generation.
To run compare_generations.py, start Golly and open the Model-S folder
in the left panel of Golly, then click on compare_generations.py.
(3) compare_random.py -- compare populations with random individuals
After a simulation ends, compare_random.py can compare samples from
a run by having them compete against randomly generated individuals.
For a given individual from a run, the competitor is an individual
with the same dimensions (the same number of rows and columns) and
the same density (the same ratio of 1s to 0s). The competitor is
generated by randomly shuffling the cells of the given individual
from the simulation run. This ensures that the outcome of the
competition is based on the structure of the individual (the
pattern of the 0s and 1s) and not on the size or density of the
individual.
(4) compare_types.py -- compare populations with different parameters
Two different simulation runs, based on different parameter settings,
can be compared with compare_types.py. Individuals in generation N of
one run are compared with individuals in generation N of another run.
(5) measure_areas.py -- calculate the average areas of individuals
After a simulation ends, measure_areas.py can examine samples to
calculate their areas (the number of rows times the number of columns).
In general, we expect the areas to grow over the generations.
(6) measure_densities.py -- calculate the average densities
After a simulation ends, measure_densities.py can examine samples to
calculate their densities (the number of 1s divided by the area).
We expect that a relatively narrow range of densities will be
preferred.
(7) measure_diversities.py -- calculate the standard deviation of fitness
After a simulation ends, measure_diversities.py can examine samples
to calculate the standard deviation of the fitness in the samples, which
gives an indication of how much diverity there is in the samples.
(8) view_contest.py -- see an Immigration Game played
After a simulation ends, view_contest.py allows the user to pick
samples and have individuals from the samples compete against
each other in an Immigration Game. This may provide some
insight into the nature of the game and the nature of the
indivuals that evolve in the simulation.