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:

- Acceleration: All cars not at the maximum velocity have their velocity increased by one unit. The maximum velocity is an integer and was 5 in the original work.
- Slowing down: All cars are checked to see if the current distance between it and the vehicle in front (in cells) is smaller than its current velocity (in cells per round). If the distance is smaller than the velocity, the velocity is reduced to the number of empty cells in front of the car – to avoid a collision. Note that in the next step the car in front may well move forward (depending on its velocity) but that this is not considered here.
- Randomisation: The speed of all cars that have a velocity of at least one, is now reduced by one unit with a probability of p.
- Vehicle motion: Finally, all cars are moved forward the number of cells equal to their velocity.

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.

## Follow Us