Visit Your Local PBS Station PBS Home PBS Home Programs A-Z TV Schedules Watch Video Donate Shop PBS Search PBS
SAF Archives  search ask the scientists in the classroom cool science
scientists from previous shows
cool careers in science
ask the scientists

Photo of Kai Nagel Photo of Chris Barrett Kai Nagel and Chris Barrett as seen on
Life's Little Questions: Why Does Traffic Jam?

Click on Kai or Chris's photo to read a brief bio.

q If you could sense the current state of the cars on the road with TRANSIMS, could you use the simulations to forecast the traffic? Steve

A (From Kai Nagel) That's one of the applications this technology will eventually be used for. But we will need more than location and speed of cars -- for example, it is really important to have their destinations. Now, since in general we don't have that information for everybody (and probably don't want it for privacy reasons), we need to make surrogate assumptions. This is one of the things we are currently working on; I think it looks very promising; but it will take another couple of years before it will really be operational.

Also, traffic forecasting is as difficult as weather forecasting in some aspects, and worse in others. For example, similar to weather, traffic can be chaotic (in the scientific meaning of the word), which means that small changes somewhere in the system potentially can screw up the whole forecast. On top of that and in contrast to weather, traffic will actually react to the forecast. Once we predict a traffic jam somewhere, people will find alternatives, and the predicted traffic jam may never happen. This is clearly more complicated than weather.

q Hi! What is the name of the field of study you guys are in? I may be interested in taking those courses if they are available next year at the university. I am undecided what I will major in, but I've always wanted to do stuff like that. Thanks! Eric

A (from Kai Nagel) It is fairly interdisciplinary. In terms of methods, helpful is some background in applied mathematics, some background in computational physics, a good background in "scientific computing", and any class on "complex systems" (genetic algorithms, neural nets, adaptive computation...) you can find. In terms of possible applications, anything from simulations of the immune system to simulations of the world economy will help you to learn how to apply the stuff you learned in the classes. If you want to concentrate on traffic as an application, the best bet probably is to look for something about "intelligent transportation systems (ITS)" or about "traffic microsimulation".

q I noticed something at an airport which has been bothering me ever since because it just did not make sense. I think I saw a glimpse of the "reason" when I saw your research on SAF. I was standing in line for going through those metal detectors. Only one counter was open, hence the line was long and was moving very slowly. The airport security opened a second counter and within a very short time the line vanished. The line seemed to move much faster than twice the speed. My question to you is "Does the line move more than twice the speed or I was wrong in my estimates?" If you can answer this question, it would help me a lot. Thanks. Arvind

A A: (from Kai Nagel) Honestly, I cannot see a reason why two queues should move with anything but twice the speed of one queue.

However, possibly we need to be really clear about our terminology. Let's not use the word "speed". Define the "service rate" as the number of persons processed per time unit. For example, 1 person per minute. Then, two queues should process 2 persons per minute, right?

Now, this has an important effect on queue length. Queue length is number of people waiting. Assume that you have a situation where in the average 1.5 persons arrive per minute. Then, with only one counter open, the queue becomes longer and longer. If you arrived half an hour later, you would have to wait 15 minutes. If you arrived an hour later, you would have to wait 30 minutes. However, if you had the second counter open, the queue would decrease and eventually be gone.

I am writing it this way, because this may be the "psychological" definition of speed in this situation. If you arrive after 15 minutes, in one situation, you wait 15 minutes, in the other maybe one minute. One situation is 15 times faster than the other.

The definition of travel speed on a road in traffic systems is for many purposes very similar to this "waiting time" definition. And it is one of the most important points where traditional (non-simulation-based) models can go wrong.

The situation gets more complicated when you have randomness, i.e. some people need more time than others. This is pretty normal at the airport and in traffic. In such a situation, there are queues even when enough counters are open. These queues are sometimes short and sometimes long (just sit down near any such system and watch). If you average, say over second-by-second measurements, you obtain an average queue length. If suddenly more people arrive than before, this average queue length gets longer. Now, when the "arrival rate" becomes the same as the "service rate", the average queue length becomes infinite in some mathematical sense.

And this is a really annoying result, because even when you have enough counters open, people in the average still wait a really long time.

q What is the scientific name for the phenomenon causing a traffic jam? I have watched the segment of the show that was dedicated to the topic of traffic jams and control several times, and I have also looked over the show's transcript, however, I cannot seem to find the term. The question appeared on the web page and also on a worksheet that students can use to get extra credit points. June Sawyer

A (From the Web Staff) Thanks for your message about the Viewer Challenge question for the Why DoesTraffic Jam? story on "Life's Little Questions." It IS a challenging question, yet clues to the answer can be found in the show and the transcript.

In his conversation with Kai Nagel at Los Alamos, Alan Alda says "the original jam could have occurred by an exit ramp...but then it propagates backward..." Later in the story, with Sergui Luchian in Boston, Alan's narration refers to "one of the those backward waves we saw at Los Alamos" The answer, found by combining these two statements, is "backward propagating wave." Any student who gets this answer correct deserves extra credit!

q We are middle schoolers and are planing for the future. We were wondering if there are any good colleges for studying traffic engineering? Emily, Lindsay & Meradith

A (from Kai Nagel) I don't think I can do anything here beyond some general advice. I would look for a program that has plenty of computer stuff in it. You can usually get an idea from the web pages of the departments; you can try to find out what kind of computational equipment they have; you can try to find out how much of their course-work is computer related. You can get a description of all the classes they offer; find out how much of that you find interesting.

Especially during undergraduate school, try to find something that keeps your options open. Besides computer skills, this would include maths skills and language skills. Go abroad for a year, if you can. All these are also things I personally look for in resumes -- much more than if a student has taken the 26th specialization class or not.

Finding a good match in a grad school is a bit different from finding a good undergrad school. For grad school, you want to find a school that has good people in the specialized area(s) you are interested in. Access to computational equipment is important here again, as is the number and quality of specialization classes in your field. Somewhat useful is sometimes the following: Find out who of the professors is working in areas that you would find interesting. Looking up how often they are cited by other researchers can give you some intuition of how well recognized they are in the field. Science Citation Index or SciSearch provide such information. Use this criterion with care -- for example, it may be better to work with a young, unknown, but enthusiastic advisor, than with an established one who never has time. Talk to them directly to find out.

q was fascinated by the traffic simulations I saw. What kinds of A.I. technics did you use to get those results? What software tools did you use to write the simulator? Where can I learn more? David Link, Systems Programmer (Oracle Corp.)

A (from Kai Nagel) AI techniques: The AI (Artificial Intelligence) techniques in TRANSIMS are fairly rudimentary since we have so much computation to do. For example, let's say our simulation runs as fast as reality. This means that for each second of the simulation we have a second of computer time. But during that second we need to compute the decisions of a million or more drivers!! So in this case we just use a very short list of rules.

In order to obtain plausible routes, it turned out that a normal computer science shortest path algorithm (Dijkstra) was the fastest we could find.
TRANSIMS also contains a module that makes decisions about what the simulated people do during a given day (sleep, eat, work, shop, ...), and where they do that. We haven't tried it yet, but personally I would see here the greatest potential for interesting AI techniques. One thing I always wanted to try was to use genetic programming to find programs that make these decisions.

In some other sense, you could see the whole simulation as an "intelligent" system. Like an anthill. :-)

Software: TRANSIMS is written in C++, and it uses the Standard Template Library. PVM or MPI libraries are used for parallel computing. The "standard" visualizer uses OpenGL and GLUT. And it uses some more or less standard unix tools such as lex, yacc, m4, and perl. One should be able to find info on these via the web.

Learn more: has info on what was necessary to get the so-called IOC1-release to run, and it will eventually have info on what will be necessary to get the next releases up and running.

TRANSIMS doesn't use any package for agent-based simulations since we felt it would be too "big" to fit into anything available. But if you are interested in smaller-scale agent-based simulation, the "swarm" package ( seems to be picking up a bit. I have never used it -- I program all my computational experiments in plain old C, and use awk and gnuplot for data analysis. :-)

q Traffic has been a fascination of mine for many years. When I am driving, I am watching the traffic and studying it. I have devised many theories about traffic, and believe some of them have validity, but I have no way to test them. Is there a version of TRANSIMS available for consumer, or civilian use, or is one planned? Kelly Williams

A (from Kai Nagel) Chris may be able to answer what the plans are for "private person" use of TRANSIMS. In the meantime, I just wrote a short C version of cell-based single lane traffic, see On unix, it compiles with "gcc simple.c"; I don't know for other systems. If you want to, you can pull it over and play around with it. Since it was a bit late when I wrote it, watch out for possible programming errors. :-) Also, it is not necessarily an example of recommended programming style.

q During a traffic jam on a three-lane highway, I tend to use the right lane. While at normal speeds, traffic is slowest in this lane, but in a traffic jam it seems to move faster. Is this because cars are exiting, while entering cars move to the middle lane? Is there a "fastest" lane? Gavin McFarland

A (from Kai Nagel) I really don't have any scientific results on this. In my personal experience on the Long Island Expressway, the right lane seemed to be faster when approaching an exit ramp (because cars were leaving there), and slower when approaching an entry ramp (because new cars were entering there). That's similar to your observation.

Another hypothesis is that on the right lane, there are more large trucks. Assume all traffic is stopped. When it starts moving, then eventually it starts moving 4 cars ahead of you, then three cars ahead of you, then 2 cars ahead of you, etc., and all this takes about 6 seconds. A truck, though, is like these four cars were connected by rods, and so you don't have to wait those 6 seconds. And over multiple trucks, this can add up.

But, as I said, this is all speculation.

q My question is regarding computer simulations of real-world conditions, specifically, tornadoes. I recently posited this question to someone at the National Severe Storms Center but was so insulted by the patronizing tone of their dismissive answer, I post it to you in hopes of more serious consideration. I have wondered for some time, given the variety in sizes and strengths of tornadoes, whether anyone has ever tried simulating the effect a high-explosive charge detonated in the vortex column would have on a tornado? Dennis Junot

A (from Kai Nagel) Hmm. I am sorry to hear that you had bad experiences with scientists. On the other hand, most of us are working really hard, and at least me, I sometimes get grouchy over it. Regarding your question, it should indeed be possible to use simulation to find out what effect a large enough explosion would have on a tornado. I am not aware of such an investigation, but that doesn't mean nobody has done it. I know of one problem, though: Trying to deliberately throw something into a tornado's path is extremely difficult. See, for example, the movie "Twister" -- and in reality, it's even harder than in the movie.

I just searched the LANL electronic data base for "tornado" and "explosive" and it didn't come up with anything relevant to your question. Maybe see if you find something on the NCAR (National Center for Atmospheric Research) web pages. Good luck!

q Hi, I'm a high-school student in Canada, and I'm involved with a project at school were we're trying to design a slightly more intelligent traffic control system. As part of the project we need to create a fairly realistic traffic simulation. What advice would you give? Which traffic-related statistics would be most important for us to incorporate into a simulation? Thank you. Anis

A (From Kai Nagel)
There are in general two different ways to code traffic on a road, one is "space oriented" and one is "vehicle oriented"
  • One way of space oriented is that you cut the street into many cells, and cells are either empty, or occupied by exactly one vehicle. Cars move by jumping from one cell to the next. Thus, the road "knows" where the cars are, what their speeds are, etc. Implementation would be something like:
    integer vel[nlanes][length] ;

    where nlanes is the number of lanes, and length is the number of cells along the link. vel[i][j] would for example be -1 when that particular position is empty, and anything between 0 and vmax for cars with that speed. vmax is something like 5.

  • Vehicle oriented means that the cars "know" what their position etc. is. Implementation would be something like:
    struct car { double position; double speed ; } ;
    struct car car[N] ;

    where N is the number of vehicles in your simulation.

If you have started implementing something, you will probably know what I am talking about.

Vehicle oriented is more realistic, but it is harder to implement for complicated situations. For example, if you want to change lanes, in space oriented you just check if the cells where you want to go are empty. In vehicle oriented you would have to ask all other cars where they are.

If you want to do single lane traffic in your studies, I would recommend vehicle oriented. If you want to do multi-lane, intersections, etc., I would recommend space oriented the first time you do such a project.

If you want to simulate larger networks of roads, you need to be able to read in networks, which means in practice files with nodes and files with links. You should be able to find some help with this part, it is fairly general.

The most important statistics of traffic are the so-called fundamental diagram. It shows for example flow (number of vehicles per, say, 1 minute) as a function of density (number of vehicles per, say, 1 mile). If you want to look at many different fundamental diagrams from our simulations, there is a paper "TRANSIMS traffic flow characteristics" under In general, we attempt to generate such statistics from the simulations, i.e. they should come out, not be put in.

I hope this helped a bit; without asking back, it is hard to tell how much you already know.

A (From Chris Barrett) What great questions! And what a good high school project. Well, there are traffic simulations around, and a variety of different methods for generating the flows.

There is a (Canadian!) professor at George Mason University near Washington DC that has developed a traffic simulation program that runs on PC's. I don't know what or how it might be arranged for him to provide it for high schools, but look him up on the web and ask him! His name is Michael Van Aerde, maybe there is an education version or something. Its a nice simulation and pretty realistic.

If you want to program your own, maybe I can point you to some information that could help. It's a challenging thing to do, but it could be pretty cool if you only simulate a few intersections. Or even just one...Anyway, check out the documents and papers on the TRANSIMS website for inspiration.

OK statistics. You need to measure the speeds, their distributions, and accelerations. You need to do that in relatively small time bins. You need to measure the "flow": vehicle miles/hour. You need to measure the "density": distance covered with cars/total distance of a road segment. You should check out the plot you get when you plot density on the horizontal axis and flow on the vertical axis. It pretty interesting because the flow goes up with density for a while and then tips over and goes down until traffic "jams". Think about it!

At stop lights you want to measure the queue lengths and so on. Let us know how it goes!

q I enjoyed watching your segment on "Life's Little Questions"; I've long pondered that annoying fact of life concerning freeway travel. It seems that if drivers maintained sufficient space from the car in front of them, that the "critical traffic density" necessary for jams would not be reached and traffic jams could be prevented. Have you determined what this spacing is at, say, 55 MPH? Is there any likelihood that drivers could be made (through education or strict enforcement) to maintain jamproof distances? Steve

A (From Chris Barrett) Well, you know, this is a very very good question. Although we could all just get far enough apart to avoid the jam density, it would lower the roadway occupancy so much that the flow (the throughput in vehicle miles/hour) would actually go down. So we still wouldn't be moving very well.

The thing that is important is the fluctuations. If we were only centimeters apart, but there were no speed fluctuations, we could really move some traffic. Of course chain reaction collisions and traffic safety come to mind!

In any case the fluctuations ripple down the flows and entrain, sometimes growing, other fluctuations. The density allows that process to continue and lowering will impede it at the cost of lower throughput as I said above. Just like investing, we have a risk/return trade off here.

Some automatic driving technologies are being developed to help with safer close driving, but I think that will be a while before they are accepted and perfected.

Maybe we should sometimes just take the train or bus -- or walk and lower the traffic densities that way!

A (From Kai Nagel): Your observation is essentially right. The problem with this is that if you do this, the efficiency of the whole system goes down. Let's say cars are apart 0.02 miles, and they drive 50 miles per hour. This means that, within an hour 1 cars/0.02 miles x 50 miles = 2500 cars will pass a given location (say underneath a bridge) in an hour. If you pull these cars farther apart, say to 0.03 miles, only 1667 cars will pass underneath that bridge during that same hour. So the jams are gone now, but at the end of the hour 833 cars are waiting somewhere in the system.

The rest is not really hard to understand, but it's a bit longwinded.

The spacing depends on reaction time. Assume the car in front of you brakes hard. You need some time to react. If you start braking at a location past where the car in front of you started braking, you will crash into it. The result of this argument is that people typically leave between 1 and 2 seconds time headway, which translates into between 25 and 50 yards at 55 mph. (In kilometers instead of miles this would be a bit easier.)

In order for jams to inherently NOT exist, you need that the time distance between people driving OUT of a jam is less than the time distance between people driving INTO a jam. For example, if per second one car leaves a jam but only 0.8 enter it, the jam will eventually go away.

But this would imply that the reaction time for acceleration would have to be shorter than the reaction time for emergency braking. Yet clearly, since not braking is life threatening but not accelerating just makes the person behind you blow their horn, people usually react more slowly when they accelerate -- which stabilizes jams.

IN CONSEQUENCE: Next time when you are in a jam, try to get moving quickly when traffic gets moving in front of you.

q I am a second grade student in Mrs. Brown's class. I was wondering why is the red light always on top? Kris

A (From Chris Barrett) You know, some people can't see colors. So folks decided that if the stop lights were always in the same order, even they could tell if they should go or stop. Well, if it changed from place to place, then they might have a wreck if it wasn't like that.

So they just made a rule. And the rule said that red was on top. It could have been the other way, but once there was the rule and everybody was safe, that was good enough and they kept it that way.

Great question, have a great year in 2nd grade.

A (From Kai Nagel) It is so that little guys like my boss Chris can still see at least the red light even when they have a car in front of them. :-) :-) It's like in the movies: The upper part of the screen is easier to see.

I hope it's O.K. that I understood this a bit as a joke. In reality, it's probably good that the red light is always at the same position, and it doesn't really matter where it is, and top just happened.

q I was very impressed by the work that you are doing with traffic studies. Is this program available for cities to adapt to their own situation, i.e. input census statistics and generate similar kinds of information? If so, how can I obtain this? The show was great. Nancy

A (From Chris Barrett) It is sure rewarding to hear that people such as yourself would actually want to use the results of so much hard work -- that they see it as relevant to their lives.

That's what we've been working toward!

During this year and the next year, TRANSIMS technology will begin leaving the lab and making its way into the commercial sector. At the transims website ( there is an announcement of an "Opportunity Forum" in June that will lead to products that municipalities can use. But at the moment, it isn't yet quite "ready for mainstreet."

We hope many products will evolve over the next few years and we hope your interest is indicative that lots of people will want this people-oriented technology!


Scientific American Frontiers
Fall 1990 to Spring 2000
Sponsored by GTE Corporation,
now a part of Verizon Communications Inc.