1D Traffic Jams
Hi everyone,
Welcome to Stochastic Tinkering.
Today, I would like to tell you about the gif at the top of this article. It is a 1D cellular automaton model (The Nagel-Schreckenberg model) of traffic flow.
The gif shows two “traffic” simulations with different rules.
In each simulation, our 1D road is represented by a list of 0’s and 1’s. A “1” indicates the present of a car, and a “0” indicates the absence of a car.
In the top simulation, each car simply moves one space to the right during each step (with periodic boundary conditions).
On the bottom, each car moves one space to its right, so long as there is not already a car to its right. If there is car to its right, the car to the left simply waits until the next step.
Here are a few more simulations with traffic.
There are a few things that are interesting to note here.
Firstly, sometimes it appears that the cars are moving to the left, but they are always moving to the right! This is a traffic jam! Just from this simple rule, we observe the interesting result that traffic jams are emergent structures which can propagate in the opposite direction of the movement of the cars.
Another thing which you might observe above is that traffic jams can annihilate with holes. Let’s construct an extreme example to see this.
In other words, a long stretch of open road in front of a traffic jam allows it to clear up over time. This demonstration above is also cool because it shows that the cells are indeed moving to the right the entire time, even though it doesn’t look like it.
As usual, we have only scratched the surface here, but I learned a lot with just this trivial example.
I hope you enjoyed this little post. Here is the code if you want to play around with these things yourself!
Until next time, be well :)
-Matt