E Pluribus Unum
Stop and Logo
Traffic jams are a particularly intriguing topic for StarLogo models because we experience them from the inside. We may never know exactly what motivates an amoeba or a bird, but we have a very good idea of how a driver thinks and acts on the freeway at rush hour.
Resnick tells the story of writing a traffic simulation with some high school students. They programmed the cars to obey a follow-the-leader rule: If you're too close to the car in front, slow down; otherwise accelerate to the speed limit and maintain that speed. The students also created a roadside radar trap, where cars would momentarily brake; they predicted that this disturbance would cause a traffic jam. The prediction was correct. But then the students removed the radar trap and were surprised to find that traffic still bogged down, without any apparent cause.
Highway engineers are certainly familiar with this phenomenon—and so are drivers. You toil slowly through a mile of bumper-to-bumper traffic, expecting to find an accident or repair work obstructing the roadway, but when you get to the head of the queue, there's nothing to be seen. The congestion develops and dissipates spontaneously. Macroscopic explanations of this effect often invoke analogies with fluid dynamics or with the theory of phase transitions and critical phenomena. For example, a spontaneous jam might be compared with a shock wave propagating backward through the moving stream of traffic.
The StarLogo simulation offers a more intimate, driver's eye view of what goes on inside a traffic jam. The two rules that drivers obey are enough on their own, without any external trigger, to make the flow of traffic unstable. If a random fluctuation in speed or position brings you close to the car ahead, the rules require you to slow down. Thereafter the car behind you may also have to slow, and the car behind that one too. On the far side of the congested segment, cars leave the jam one by one. When it is your turn, you suddenly find the road ahead clear, and you can accelerate to maximum speed again. Indeed, the jam has the interesting effect of regulating the spacing of cars on the downstream side, so that traffic flows more smoothly than it would have without the jam. In the little world of StarLogo, however, the highway is actually a loop, and cars that exit at the right edge re-enter at the left; hence the traffic jam you've just escaped is one you will soon encounter again.