Each road has two lanes, one each direction. The lanes are each 4 metres wide (so each road is 8 metres wide). All cars travel straight ahead; none try to turn. For convenience, we've numbered the lanes from 1 to 10 and labelled the lights A through F.
We assume traffic moves according to a simple mathematical model (follow the link for more information). The relevant parameters are the number of cars per minute d, . . . , d trying to use each lane, the speed limit c, two numbers l and L that control how cars tend to space themselves out, and the timings of the traffic lights. In this simulation, you can set the values of any or all of these parameters and watch what happens. As well as a graphical display, you'll see what the average speed of the cars is as a percentage of the speed limit: a measure of how effective your light timings are at keeping the traffic moving!
You can run the simulation in any one of the following ways:
In each of the scenarios, the basic traffic behaviour is the same: c=40, l=4, and L=20 (see the mathematical model for what these mean), and there's no limit to how fast cars can accelerate. The difference is in the numbers d, . . . , d: the number of cars per minute trying to use each lane.
Scenario 1. (d, . . . , d[10) = (10, 5, 5, 10, 15, 10, 8, 8, 5, 10)See below for instructions.
Scenario 2. (d, . . . , d[10) = (5, 15, 2, 15, 2, 10, 1, 8, 10, 5)
Scenario 3. (d, . . . , d) = (7, 20, 15, 15, 12, 6, 10, 10, 2, 12)
You may also want to make the lights turn green at different times, so that a lane with heavy traffic can encounter all green lights. The scenario begins just as light A starts its east-west green cycle. To stagger the lights, you can specify how far into the scenario lights B through F begin their east-west green cycle. We'll call these numbers B0 through F0. For example, setting B0 = 15 means that light B will begin an east-west green cycle 15 seconds after the start of the scenario. Setting B0 = -15 means that light B started an east-west green cycle 15 seconds before the start of the scenario.
Choose the scenario you want from the popup menu above, and enter the values for Aew, Ans, . . . , Few, Fns, B0, . . . , F0 that you think will lead to the smallest average waiting time (greatest average speed) for cars over a 10-minute period. (You may want to refer back to the map to see where each of the ten lanes is located relative to the six lights). Then press "Start Simulation". You'll see empty roads at the start of the ten-minute period, and you can advance the time by amounts you choose. Once you've advanced the time all the way to ten minutes, you will see what the average speed of the cars was under your timings and how that compares to the previous high score. Can you set a new high score?
In this simulation, you can choose the values for the three basic parameters c, l, and L in the mathematical model we are assuming the traffic follows. You can also decide how many seconds S it takes for the lead car to accelerate to full speed; leave this at zero if you want the lead car to be able to accelerate infinitely fast. You'll probably be surprised at how long it takes the line to get moving even when this number is set to zero (and less inclined to blame the reaction time of the cars in front of you next time you're kept waiting!)
Once you've chosen value for c, l, L, and S (or you can just leave them at their defaults if you like), press "Start Simulation". You'll see empty roads at the start of the simulation. Then select "advance simulation by 120 seconds"; during this period, eastbound cars will line up at red light B, and red light B will just have turned green. Then keep advancing the simulation at 1-second intervals, seeing how long it takes cars far back in the line to get moving.
This part of the simulation was designed to accompany Part II of the competition, which is a challenge to find mathematical formulas for how long it takes cars far back in the line to get going. You can use the simulation to see how accurate your mathematical predictions are.