The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.

created with NetLogo

Copyleft Carlos Gershenson

This simulation was exended from the model "Gridlock" by Uri Wilensky & Walter Stroup, which comes with NetLogo 2.0.0 (see more info at the bottom)
Traffic lights try to "self-organize" for improving traffic.

Traffic is not so much an optimization task, but an adaptation task, since traffic flows and densities change constantly. Optimization gives the best possible solution for a given configuration. But since in real traffic the configuration is constantly changing, it seems that we would do better with an adaptive mechanism than a mechanism which is optimal some times, and some times creates havoc (and it is too expensive to try to find all possible optimal solutions, since the configuration space is too huge and uncertain...).

For the technicalities and further descriptions, you can read the paper Self-Organizing Traffic Lights.

For any question, contact the author

You can download the source code, and use/modify it with NetLogo (quicker than with a browser, need NetLogo version 2.1 or higher)


Run "Setup" before starting simulation. Then start and stop with "Go". Some parameters, such as grid-sizes and four-dirs? will be applied only after pressing "Setup".

Tip: you can "freeze" the display (on top of the "city" display) and/or switch off the plots to accelerate simulations.

For model details, consult the paper "Self-Organizing Traffic Lights"


"Setup"- Initializes simulation

"Re-run"- "soft" and quick "Setup" (just clears variables, doesn't change street topology)

"Reset-TL"- Turns phases of adaptive control methods ("sotl"'s and "cut-off") to zero, so that they need to adapt again (to check robustness)

"Go"- Start and stop simulation


-control- select control method for traffic lights
+when changing methods during the same run, resetTL. (If one was yellow, can cause problems...)


"grid-size-x"- number of vertical streets

"grid-size-y"- number of horizontal streets

"number"- initial number of cars for "Setup" and "Re-run", maximum number of cars when torus? is off

%vertical- percentage of cars flowing in vertical roads (%horizontal= 100-%vertical)

%southbound- percentage of cars flowing in southbound roads (%northbound= 100-%southbound)

%eastbound- percentage of cars flowing in eastbound roads (%westbound= 100-%eastbound)

prob-turn- probability of turning at an intersection

simulation-speed- regulates processing speed

speed-limit- maximum speed of cars

p- phase period for cyclic control methods ("marching", "optim", and "no-corr")

mingreen- minimum green phase for "sotl-phase" and "sotl-platoon" controls

keep-platoon- "omega" distance at which carsh are checked from green light in "sotl-platoon" control

cut-platoon- "miu" cars approaching a green light at which platoons can be cut in "sotl-platoon" control

queue-cut- lambda queue length for "cut-off" control

tolerance- "theta" threshold for all "sotl" control methods

metatolerance- attempt of metaadaptive regime. Doesn't work, keep set to zero...


torus?- switches cyclic boundaries on and off

four-dirs?- toggle between two and four directions (needs "Setup")

homo?- toggle between homogeneous and heterogeneous street distances (needs "Setup")
-works nicely for 8x8

power?- makes traffic lights work

yellow?- include yellow phase (1 timestep) between green and red phases

crash?- monitor crashes at intersections

plots?- switches plotting (off increases simulation speed)

This activity and associated models and materials was created as part of the projects:
PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and INTEGRATED SIMULATION AND MODELING ENVIRONMENT. These projects gratefully acknowledge the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Copyright 2002 by Uri Wilensky & Walter Stroup. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:
a) this copyright notice is included.
b) this model will not be redistributed for profit without permission from the copyright holders.
Contact the copyright holders for appropriate licenses for redistribution for profit.

To refer to this model in academic publications, please use: Wilensky, U. & Stroup, W. (2002). NetLogo HubNet Gridlock model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use: Copyright 2002 by Uri Wilensky and Walter Stroup. All rights reserved. See for terms of use.

This software is licensed under the CC-GNU GPL.

Carlos Gershenson's homepage