image provider

Traffic Simulator


This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

This project could be used my a group lobbying for changes to a local intersection, or even by an entire city to control its traffic flow.

The idea is to create a toolkit of Java objects that can simulate the flow of traffic. You would have objects for streets, intersections, stop signs, traffic lights, round-abouts, various types of vehicle and various types of driver.

The goal is to realistically simulate how traffic would flow given various ways of configuring the traffic control measures. You want to simulate accidents too and their blocking effect.

You might collect real world data by observing traffic lights, the times vehicles pass a spot, known accident rates at various intersections at various times of day. With access to satellite photos you might be able to glean the start and end points of each trip and the route to get there.

Using pseudo-random generators you can simulate traffic and other variables, such as driver attentiveness.

The simulator looks at the system at time t and computes what it would be doing at time t+1. It runs the entire simulation over and over using different randomisations, collecting statistics.

You might be able to investigate whether a round-about or a standard intersection would be best in a given situation. You can find out what would happen if an extra lane were added. You can tinker with various ways of controlling the lights, either using a fixed algorithm, one that changes over the day, one that monitors traffic or one that somehow knows ahead of time the route every car will take.

For inspiration, you might want to Google for queue simulation to see what others have done along this line.

I did a project like this back in the 1960s, that I called QSL (Queue Simulation Language) and discovered that using macros to generate PL/1 source code that was compiled and then optimised worked orders of magnitude faster than the GPSS (General Purpose Simulation System) interpretive system. It also gave me the ability to easily add arbitrary code to the simulation.

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number