0% found this document useful (0 votes)
80 views

Bluefish 3 Report

This report details a project to model and predict traffic patterns at Boston Latin School. The authors gathered anonymous student schedule data and used Python and 2D matrices representing the school's floor plans to simulate student movement between classes. Preliminary results showed distributing traffic more evenly across the school, reducing the average number of students in an area by about 7.2%. Scaling up the model to the full schedule reduced the number of students in specific areas by up to 20.7%, showing modeling student movement can improve efficiency and safety during the pandemic.

Uploaded by

Tim Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Bluefish 3 Report

This report details a project to model and predict traffic patterns at Boston Latin School. The authors gathered anonymous student schedule data and used Python and 2D matrices representing the school's floor plans to simulate student movement between classes. Preliminary results showed distributing traffic more evenly across the school, reducing the average number of students in an area by about 7.2%. Scaling up the model to the full schedule reduced the number of students in specific areas by up to 20.7%, showing modeling student movement can improve efficiency and safety during the pandemic.

Uploaded by

Tim Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Tim Nguyen, Phineas Scovel

Project Final Report


Modeling and Predicting Traffic Patterns at BLS
Tim Nguyen, Phineas Scovel
MSEF 2022

1
Tim Nguyen, Phineas Scovel

Table of Contents

Table of Contents 2

Project Abstract 3

Background 4

Problem 5

Possible Solutions 6

Methods and Materials 7

Data Tables 8

Data Tables Continued 9

Analysis 10

Conclusions 11

Further Applications 12

Works Cited 13

2
Tim Nguyen, Phineas Scovel

Project Abstract
Traffic is becoming an increasingly dangerous issue, especially during the time of Covid-19.
During times of a pandemic, social distancing is a critical component in containing the spread of
Covid-19. Boston Latin School suffers these exact problems. Four minutes are given between
classes for transitioning, and students are often in very crowded and congested areas where
social distancing cannot be kept. However, other parts of the campus are often empty, creating
the need of trying to distribute the traffic within the school for a safer and faster transition for
students. After deciding to use Python along with 2D matrices representing our school’s different
floor plans it was necessary to gather data that was needed. Acquiring the anonymous student
schedules from the school's registrar in the format of a large Google Sheet then led to creating a
method to manage this data efficiently and format it in a way that is straightforward to use.
Following this, matrices were created for simulation to run on and the required relations between
room numbers (to which the student will go) and their corresponding locations within the
matrices. Subsequently, running a control model with no optimizations as a control model
allowed comparison to future iterations. Preliminary results were created by running a smaller
test size with a simpler algorithm to gauge whether or not our plan is feasible. These preliminary
results showed that it is possible to spread the traffic within the school campus more evenly.
Specifically, the average number of students within a given area was reduced by about 7.2%. The
fastest path was found to oftentimes not be the shortest path. To get the final results, all that was
needed to do was to scale the preliminary code to all 7 periods on all 6 days of the rotating
schedule, and the number of students in a specific area was reduced up to 20.7%. This project
gave reasoning to back the assumption that humans cannot perfectly predict and assess what the
most efficient route between places is, and that creating an external tool that can help improve
the efficiency of students' movement significantly during the times of a pandemic when safety
and speed are crucial.

3
Tim Nguyen, Phineas Scovel

Background
Pathfinding is used everywhere in one’s daily life from mapping the directions to work to
calculating optimal paths for warehouse workers. It is an extremely helpful concept when
implemented correctly, but can be very tricky to get right. As a human, pathfinding is simple
since it is something that many have been doing their entire lives and it is almost hardcoded into
one’s brain. For computers, on the other hand, it is not so simple. A human can view and
understand the “big picture” of something very easily but a computer only can focus on a single
thing at once, making it very difficult to consider large problems at once.
In general a “pathfinding algorithm” is a program that returns a route, sometimes
associated with a “cost,” which is a path through a set of obstacles. This is what needs to be
improved for a well-optimized path. An iteration is a single repetition of a block of code, or a
function, etc. which can be iterated multiple times to produce desired results. An epoch can mean
many things, but this project will refer to a single iteration of a single period within the school
day. A function is a section of code that has been named, allowing the code to run more easily,
use in several places, and gives the operation it is completing more versatility.
Using and referring to a mathematical function called a “sigmoid” several times in the
𝑎
code and slides which is a special type of function in the form of 𝑑·𝑥 resembling a spline or
𝑏+𝑐·𝑒
logarithmic-like growth curve. An image of what several sigmoid functions used look like is
shown below.

3 different sigmoid functions which we tested to represent the change in weights on


matrices.

4
Tim Nguyen, Phineas Scovel

Problem
The students of Boston Latin School as well as many schools around the nation face a
tight transition period, which creates very congested hallways and an unsafe situation during the
Covid-19 pandemic.

5
Tim Nguyen, Phineas Scovel

Possible Solutions
Some possible solutions came to mind when trying to find ways to reduce congestion in
the hallways during the transition. These possible solutions included using GPS to track the
students’ movements, calculating with 3D models, running a particle simulation, and running a
2D simulation with matrices and weights. Using GPS would allow us to get real-time movements
of everyone in the school building that used an app. This method yields the most accurate and
realistic data for our control but has many problems. GPS signals are not reliable in a building,
making it hard to track the precise movements of everyone, but also creates privacy issues if the
technology is misused. Calculating the movements of everyone using a 3D model creates a better
sense of depth and space when trying to model each person’s movement. However, 3D modeling
is a very computationally intensive task, and it would be unnecessary as there is no need for
height data. Running a particle simulation would give out the best model of the random
movements within the school building. The randomness of the particle simulator could also help
show which routes are best and could be improved but is very inefficient and very hard to
accurately show the realistic movements in the school building. Lastly, running a 2D simulation
with matrics and weights makes it easy to control and predict based on the data. Since it is a 2D
matrix, it is not computationally demanding as the other options and allows the data to be
manipulated in any way. This allowed fine-tuning the model to accurately show the best
representation of students going to class in a given school day, but also can easily predict the best
paths for each student too.

6
Tim Nguyen, Phineas Scovel

Methods and Materials


To solve the problem, it was best to model the school with several 2D matrices
representing each floor’s hallways and classrooms. There are many Python libraries, and it using
one of them allowed the program to use these matrices combined with starting and ending
locations to find the most efficient routes within a singular matrix based on the weights in the
matrices. Adjusting these weights allowed it to account for an increase in traffic, as well as stitch
the several matrix floors together to create an entire school of matrices. Following this, new
methods were created for several instances of each “school” of matrices, allowing the program to
run each period within the school day on a separate matrix which is what happens in the actual
school following the normal transition times. Then it was iterated with this process several times
with newer and more efficient weighted matrices several times to achieve an optimal pathing for
students specific to each period, floor, and school day they are currently “walking” through.

7
Tim Nguyen, Phineas Scovel

Data Tables
Data was acquired from the school’s registrar, which consisted of a large Google Sheet
filled with an anonymized student ID, students' homeroom, and a list of their schedules with
corresponding classroom numbers. A program was then written to parse this Google Sheet into a
data format that best suited the program's needs (JSON) and was also able to be quickly read
from given the amount of data being dealt with. A secondary reference file was then created
containing every single room number in the building which were then labeled with their
coordinates on matrices, and the floor they corresponded to.
Several output formats were used for data. Mainly TXT documents were used which
contained plain text representing matrices with their weights, labeled with which school day,
period, and epoch they corresponded to. Printing to the terminal as an output in early
development was also used since it was a quicker, but dirtier way to achieve similar results.

8
Tim Nguyen, Phineas Scovel

Data Tables Continued

A sample of the spreadsheet received from the registrar's A sample of some of the A sample of the
office. The spreadsheet contained a random student ID for location array that was data from the
each unique student, grade, schedule, description, mapped to correspond with spreadsheet into a
homeroom, and classroom. the correct matrix and more readable
coordinate. format for the
program.

9
Tim Nguyen, Phineas Scovel

Analysis
The standard deviation of the weighted matrices, which is how effective it is being
gauged, was reduced by a factor of up to 4.8%, and were able to reduce several hotspots by up to
20.7%. Several examples of this would be certain blocks within the school going down from 336
to 309, 448 to 411, 424 to 392, 230 to 215, 173 to 142, 271 to 225, 285 to 253, 268 to 221, and
247 to 211. This demonstrated an average hotspot reduction of 14.01% in certain areas.

10
Tim Nguyen, Phineas Scovel

Conclusions
Final results include a significant reduction in traffic throughout the schools
demonstrated by a more even distribution of students and lower hotspots on average. The path of
the students was able to be manipulated into something that was more efficient overall for the
whole school but also helped reach the goal of maintaining a safer environment in the school by
reducing the number of students in a previously very congested part of the building.

11
Tim Nguyen, Phineas Scovel

Further Applications
Looking into other uses, this project would be more accessible if it was presented in a
medium such as a mobile application. This allows for students to be able to use the application
during the school day, displaying real-time visible changes caused by the optimized routes. The
algorithm can also be in mind to more effectively schedule the students in a new school year.
This would create a safer environment but also allow the school to run at peak efficiency.
Another use would be to use the algorithm to be able to evacuate students in the case of an
emergency such as fire more quickly and efficiently given the severity of the consequences if a
traffic jam occurs and something goes wrong, which could cost lives if not planned for.

12
Tim Nguyen, Phineas Scovel

Works Cited
Wikimedia Foundation. (2022, April 12). A* search algorithm. Wikipedia. Retrieved
April 25, 2022, from https://en.wikipedia.org/wiki/A*_search_algorithm

Python Software Foundation. Python Language Reference, version 3.7. Available at


http://www.python.org

Bresser, A. (2021, January 21). pathfinding. PyPI. https://pypi.org/project/pathfinding/

13

You might also like