# Using Math to Determine Driving Behavior in Egyptian Traffic

Cairo, the capital of Egypt, is the largest and most populous city in Africa and the 17th most populous in the world. Its estimated metropolitan population is nearly 15.2 million, although newer estimates place it closer to 25 million. In addition, almost 5 million people from the surrounding area commute into the city daily, raising the total population to between 19 and 29 million. Such a population places enormous pressure upon the city’s resources, especially transportation. Though Cairo sports an extensive subway system as well as an above-ground rail network, the majority of vehicular traffic is conducted in automobiles. In an ancient city with narrow streets, this sheer volume of traffic proved a daunting challenge for city planners attempting to direct it. In addition, it was discovered that the government had insufficient funds to implement the necessary infrastructure and regulations. Thus, a formidable challenge was created: how to direct a transportation network of approximately 15 million without normal control systems in place. The solution that was reached is, at first glance, seemingly incomprehensible, but from both a mathematical and behavioural standpoint, it is brilliant in its simplicity. In essence, the Egyptian people solved the problem by eliminating traffic rules altogether!
At first glance, Cairo traffic appears truly chaotic: avenues built for four lanes are packed seven cars wide, traffic lights and signs are either outdated or completely ignored, and pedestrians jaywalk almost suicidally across tightly-packed traffic moving at full speed. Amidst all of this, the only signs of control are a handful of officers who conduct traffic at major intersections. Yet, despite this apparent chaos, Cairo traffic does not suffer from the traffic jams or long waits at traffic lights that plague North American cities. In fact, it is more efficient than such systems; in short, it is chaotic, but it works.
In order to decipher the workings of any system, the source of control must be identified. In North America, Europe and elsewhere, traffic is governed by laws, infrastructure such as signage and automated traffic lights. Thus, control is external and one has only to follow the rules to commute safely. In Egypt, the situation is just the opposite: there are no rules, and the individual is in control. But, as the individual is a part of a larger system, both the individual and the population are simultaneously in control. This kind of system is well-known to behaviourists, as it occurs often in nature. It is known as flocking.
In 1986, computer programmer Craig Reynolds attempted to model flocking behaviour (such as schools of fish and insect swarms) in order to discover the governing dynamics of the behaviour. At that point, it was unknown how flocks or swarms made coordinated movements in the absence of a discernable leader.
In his simulation, Reynolds discarded the idea of a leader and instead based his program on the behaviour of individuals. His flock units, which consisted of small triangles dubbed Boids, were each programmed to follow three simple rules:

#1. Separation: To avoid collisions, each boid must remain a certain distance away from neighbouring flock-mates.
#2. Alignment: Each boid must travel in the average direction of movement of the flock.
#3. Cohesion: Each boid must remain in the same general area as the rest of the flock.

When the programmed boids were released into the computer environment, the results were staggering: the boids automatically assembled themselves into complex, unified flocks. In fact, their movement in the simulation is indistinguishable from real-life flocks, and with additional programming to induce goal-seeking behaviour, Reynolds was able to make the flocks avoid obstacles, break and reform, and perform other life-like feats automatically. This artificial-life program has since become a Hollywood staple for modeling CGI swarms of animals.
In behavioural terms, boids represent an example of emergent behaviour, which does not stem from a goal but rather emerges from simple behaviour. It explains how such complex, coordinated behaviour can emerge from even simple organisms such as insects (ie. Termite mounds). Similarly, the problem of Egyptian traffic can be solved by realizing that drivers follow the same rules as do boids: they avoid collisions, follow the traffic flow and stay in the general vicinity of traffic. As long as every individual follows the three unwritten rules and is observant of their surroundings, traffic flows. Even the purposeful movement of individual drivers parallels Reynold’s goal-seeking algorithms that permitted obstacle avoidance. So does the changing of streets, which is analogous to boids breaking off and joining other flocks. In other words, Cairo’s traffic network is identical to a gigantic swarm of insects in the streets insofar as governing dynamics are concerned.
The beauty of such a system lies not only in the simplicity of its three cardinal rules, but in its localization of individual effect. The actions of each individual is governed only by the flock-mates ahead , behind and beside them. In turn, these neighbours are governed by their neighbours and so on. This means that the area beyond a flock member’s immediate surroundings does not matter. Thus, the size of the flock is irrelevant; any sized traffic system can be accommodated in the boid model, from a few cars to the millions of Cairo. It is a solution of mathematical elegance, and it has the potential to free billions of dollars worldwide in infrastructure for use elsewhere.
Unfortunately, this system requires drivers to be observant, aware of their surroundings, and willing to sacrifice personal progress for overall efficiency. In North America, where drivers are more egocentric, the implementation of such a system would lead to chaos and many accidents. Nonetheless, Egyptian traffic neatly demonstrates the power of simplicity and the mathematical simplicity that can be derived from nature, the ancient engineer.

*Mathematically speaking, boids are an elegant application of two relatively new mathematical fields: chaos theory and complexity theory. The system is of particular interest in both fields because it is unpredictable in the short but not the long term; thus it resides on the edge of chaos.

Sources:

Reynolds, Craig W: Flocks, Herds and Schools: A Distributed Behavioural Model (Originally submitted and copyrighted for SIGGRAPH conference, July 1987)
Source: http://www.red3d.com/cwr/papers/1987/SIGGRAPH87.pdf

Reynolds, Craig W: Boids: Background and Update
Source: http://www.red3d.com/cwr/boids/

Waldrop, Mitchell M: Complexity: The Emerging Science at the Edge of Order and Chaos. Copyright 1992, Simon and Schuster Inc, New York, London, Toronto, Sydney, Tokyo, Singapore.