        Switch to text-only version (no graphics) Go to University of Toronto Mathematics Network Home Page Details on The Mathematical Model Used Read about the Competition this simulation was originally designed for

Computer Traffic Simulation: Graphical Version

If you're familiar with the simulation, you can skip directly to the predefined scenarios, the green light start-up scenario, or to the completely customizable scenario. If your browser does not support graphics, you should access the text-only version.

Introduction

This simulation is a simple model of traffic flowing along ten lanes governed by six traffic lights, as shown in the map below. It is designed to illustrate mathematical principles rather than to be 100% realistic. 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:

The Pre-defined Scenarios

Try your hand at timing the lights for three different pre-defined scenarios. How effective are your timings? Can you beat the previous high score?

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)
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)
See below for instructions.

Choose Scenario:

Enter Light Timings:

All values must be integers (representing number of seconds), with no decimal points. Allowable values for Aew, Ans, etc. are from 10 to 600. This includes an automatic 5-second yellow. Allowable values for B0, . . . , F0 are from -600 to 600.

Aew =  Ans =  Bew =  Bns =
Cew =  Cns =  Dew =  Dns =
Eew =  Ens =  Few =  Fns =

B0 =  C0 =  D0 =
E0 =  F0 =

Instructions

To time the lights, you need to pick, for each light, two numbers: how many seconds it lets east-west traffic through, and how many seconds it lets north-south traffic through. We'll call these numbers Aew and Ans for light A, Bew and Bns for light B, and so on.

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?

Green Light Start-Up

Imagine a long line of cars stopped at a red light. The light turns green. If you've ever been near the back of such a line, you've probably sat in frustration wishing the cars in front would get a move on! But is it only their slowness in reaction?

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.

Allowable values are: c from 5 to 60, l from 4 to 16, L from 5 to 40 (and l must be less than L), and S from 0 to 15. No decimal points are allowed.

c =   L =   l =   S =

Custom Scenario

Here you can completely customize the simulation. See above for instructions on timing the lights.

Traffic Density:

Enter values for d, . . . , d: the number of cars per minute trying to use each lane. Allowable values are from 0 to 120, with no decimal points allowed.

d= d= d= d= d=
d= d= d= d= d=

Traffic Behaviour

Enter values for the parameters c, l, and L that determine the mathematical model. Also choose the number of seconds S an unobstructed car takes to accelerate to full speed. To start with, you'll probably just want to leave these unchanged from their default values. Allowable values are: c from 5 to 60, l from 4 to 16, L from 5 to 40 (and l must be less than L), and S from 0 to 15. No decimal points are allowed.

c =   L =   l =   S =

Enter Light Timings:

All values must be integers (representing number of seconds), with no decimal points. Allowable values for Aew, Ans, etc. are from 10 to 600 (or 0 to omit that phase of the cycle altogether). This includes an automatic 5-second yellow (unless you entered 0). Allowable values for B0, . . . , F0 are from -600 to 600.

Aew =  Ans =  Bew =  Bns =
Cew =  Cns =  Dew =  Dns =
Eew =  Ens =  Few =  Fns =

B0 =  C0 =  D0 =
E0 =  F0 =       