Jamison Ragusa's Portfolio

Simulation of Hallway Traffic

An interactive simulation developed in 8th grade, this project won an award at my regional science fair for experimenting with simulations. The simulation used a pathfinding algorithm to simulate hallways in buildings and then fill them with agents. The artificially intelligent agents had the goal of getting themselves from their starting room to another randomly selected room in the blueprint. I used it to test the optimal width, room spacing, and corner shape for hallways to avoid over-crowding. Because all the agents had different and randomized starting and ending points the test was balanced out. I timed each of the agents to get my data.

Mapping Hallway Traffic with Computer Models


            The purpose of this experiment is to help architects design more efficient environments. The program created for the test can be used to simulate a hallway filled with people. This simulation was made with the intention of solving a big problem: crowded hallways. This program could therefore be employed in the design of buildings. The tests involved show how traffic is affected by hallway width and by the angle of corners. The methodology for generating the simulations is agent-based modeling (ABM).  ABMs are computer-based environments created using simple rules that mimic more complex systems.  In my experiment the complex system are hallways full of students.

            Agent-Based Modeling is a modeling framework for explaining, among many things, social and economic based phenomena in a way that wasn't possible before. The use of models has changed the way economists and social scientists look at the world. Computerized models take people's understanding of what works in a situation to a new level. Experts can now use a model to visualize why they find the answer that they do.

            The history of Agent-Based Modeling is complicated but not very long. The creation of ABM cannot be credited to one specific person. It was a team effort by many people due to necessity.  It had become increasingly difficult to solve more complex problems using just mathematics or survey research. 

            ABM was revolutionary in its time because it tested the limits of computational technology. Models generally require a large amount of computational power which is why the first rule of model creation, as said in a personal interview by Dr. John Miller, a Fellow at the Santa Fe institute and the head of the Department of Social and Decision Sciences at Carnegie Mellon University, is “Remove all excess information or the model will be too complex for a computer to run.”(Miller 19 Oct, 2010)

There are actually very few steps needed to create a model: 

              build agents and a test environment

              a set of rules that tell the agents what to do

              form a hypothesis of the result of the test

              run the model and collect the data needed

            ABM has helped us to understand how things work more easily. Maybe someday all of the world’s problems and mysteries could be solved with ABM. It will surely become an important tool in the future as modern technology advances.

            The tests I am running will consist of three different sized hallways which are noted in figure 5. These are accompanied by a 45 degree turn, a 90 degree turn, and a 60 degree turn. These are noted in figure 7.

            My hypotheses are that the most efficient routes will be found in the wide hallway and the forty five degree turn hallway.

Materials needed:                                   

  • a computer (mac or PC)
  • Game Maker software program
  • Microsoft Excel


            Agent-Based Modeling is a mathematical technique using rules such as “agents are required to avoid objects in their path”, among countless other possible rules.  ABM technique models real-life situations using a computer allowing people to more thoroughly analyze the situation and draw data from it.

            I began by creating a new program within the Game Maker software. There I created groups of color coded agents. These agents represent people in the hallway and each has somewhere to go within the environment. To create a realistic environment I created a group of agents that stood around in the hallway creating obstacles for the other agents, simulating students in front of their lockers.  All other agents had destinations such as coming and going to rooms off of the hallway. You can see agents in figure 1.

        Figure 1

Agents were given simple rules through the coding system within Game Maker.

Figure 2

The programming for the agents followed these steps:

  • When agent is created: set a variable called speed to a random number between 0 and 3.
  • When the agent reaches its destination it will vanish (to remove clutter).
  • When agents approach a wall or another agent they will move to avoid it.

            When the space key is pressed and held the agent will move in the direction of its destination.  A simulation is run by pressing the space key until which point all the agents reach their destination.

You can see an example of the code in figure 2.

            I created six unique environments that would be used to test my hypotheses. There are three environments for each of the two tests.  The two tests consist of 1) hallway width and 2) hallway corners.  Figures x and y are examples of some of the environments in the model.

   Figures x and y                      

         I ran the program through and timed the agents in each room three times. There were ten to fifteen agents depending on the room. This data was recorded in indexed time units for comparison purposes, meaning the time units are relative to the program environment and do not necessarily reflect real clock time.

Results and discussion:

            The results of my two tests defy both of my hypotheses. In the hallway width test the medium sized hall was the most efficient path. As seen in Figure 5. I believed that the wide hallway would be the most efficient. My rationalization as to why the medium hall was the most efficient is because any time saved in the wide hallway due to thinned traffic was spent traveling the extra distance across the wider hall.

            In the corner test the most efficient route was the sixty degree turn. I don’t understand why it was the most efficient.  At this point it is unclear whether further tests would have revealed an explanation. 

            In my attempt to program this model it took several attempts with software programs.  I learned and used StarLogo, Multi Media Fusion 2 Developer and Game Maker.  This was a time consuming roadblock.  Game Maker is the only one that worked for me.

            Although I put a great deal of time in to this project, it is possible that the study could have been improved if I could have collected more data by running more tests and possibly created more expansive environments.


            The width of my most efficient hallway in the test was about seven people wide. That seems to be the ideal. The fact that the widest hallway was not as efficient shows that bigger is not better. I hope that this model will help architects to design more efficient hallways into buildings with high foot traffic.

Appendix – Charts and Tables

Figure 4

Figure 5

Web Hosting Companies