-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
171 lines (111 loc) · 6.01 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
Model-S -- Symbiosis Promotes Fitness Improvements in the Game of Life
======================================================================
Peter Turney
July 22, 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) 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.
(3) 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.
(4) 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.