Implementation of some known cellular automata. Use for academic purposes only.
Work in progress ...
Cellular Automaton. Floor Field Model [Burstedde2001] Simulation of pedestriandynamics using a two-dimensional cellular automaton Physica A, 295, 507-525, 2001
python cellular_automaton.py <optional arguments>
option | value | description |
---|---|---|
-h, --help |
show this help message and exit | |
-s, --ks |
KS | sensitivity parameter for the Static Floor Field (default 2) |
-d, --kd |
KD | sensitivity parameter for the Dynamic Floor Field (default 1) |
-n, --numPeds |
NUMPEDS | Number of agents (default 10) |
-p, --plotS |
plot Static Floor Field | |
--plotD |
plot Dynamic Floor Field | |
--plotAvgD |
plot average Dynamic Floor Field | |
-P, --plotP |
plot Pedestrians | |
-r, --shuffle |
random shuffle | |
-v, --reverse |
reverse sequential update | |
-l, --log |
LOG | log file (default log.dat) |
--decay |
DECAY | the decay probability of the Dynamic Floor Field (default 0.2) |
--diffusion |
DIFFUSION | the diffusion probability of the Dynamic Floor Field (default 0.2) |
-W, --width |
WIDTH | the width of the simulation area in meter, excluding walls |
-H, --height |
HEIGHT | the height of the simulation room in meter, excluding walls |
-c, --clean |
remove files from directories dff/ sff/ and peds/ | |
-N, --nruns |
NRUNS | repeat the simulation N times (default 1) |
--parallel |
use multithreading | |
--moore |
use moore neighborhood (default Von Neumann) | |
--box |
from_x to_x from_y to_y | Rectangular box defined by 4 numbers, where agents will be distributed. (default the whole room) |
With the following parameter:
Call:
python cellular_automaton.py -W 30 -H 30 -N 1 -n 2000 --diffusion 2 --plotAvgD --plotD -d 5 -s 2 -P
Video simulation
Dynamics floor field (averaged over time)
Call the script with the option -moore
to use the moore neighborhood. Otherwise, von Neumann neighborhood will be used as default.
The choice of the neighborhood has an influence on the evacuation time, as can seen below.
-P
)mu
(in case of the parallel update)the Asymmetric Simple Exclusion Process (ASEP)
Rajewsky, N. and Santen, L. and Schadschneider, A. and Schreckenberg, M. The asymmetric exclusion process: Comparison of update procedures Journal of Statistical Physics, 1998
python asep_slow.py <optional arguments>
option | value | descrption |
---|---|---|
-h, --help |
show this help message and exit | |
-n, --np |
NUMPEDS | number of agents (default 10) |
-N, --nr |
NRUNS | number of runs (default 1) |
-m, --ms |
MS | max simulation steps (default 100) |
-w, --width |
WIDTH | width of the system (default 50) |
-p, --plotP |
plot Pedestrians | |
-r, --shuffle |
random shuffle | |
-v, --reverse |
reverse sequential update | |
-l, --log |
LOG | log file (default log.dat) |
the theoretical fundamental diagram can be reproduced, see figure. The size of the system should be reasonably high and the simulation time also.
numpy
(asep_fast.py
) and the other implementation is using explicit loops (asep_slow.py
). The naming of the two variations is justified when measuring their execution time:
python make_fd.py asep_fast.py: 0:56.71 real, 52.12 user, 4.03 sys
python make_fd.py asep_slow.py: 1:15.42 real, 70.55 user, 4.23 sys