For this project you will write a computer program to simulate a simple model of traffic jams: the Nagel- Schreckenberg model. This is a simple example of a cellular automaton model: it divides a single-lane road into cells, which are aligned in a single row whose ends are connected so that all cells make up a circle (this is called periodic boundary condition). Each cell is either empty road or contains a single car, i.e., no more than one car can occupy a cell at any time. Each car is assigned a velocity which is an integer between 0 and a maximum velocity (= 5 in Nagel and Schreckenberg’s original work).
Time is discretised into “rounds". In each round, the following four steps are applied simultaneously to all the cars:
You can start without applying step 3), i.e., just write a program that does 1), 2) and 4), and then afterwards apply 3) and determine its affect. The first thing to study is the average velocity of the cars as a function of their density on the road. At a low density of cars you should find that they space out along the road and all can move at the maximum velocity, but at high densities of cars they get in each others way and the average velocity drops. Having found the average speed you can look at how traffic jams form at high densities by looking at the distribution of cars along the road. You can also vary p and see how this effects traffic jams.