maxmmitchell / mbta-subway-sim

A simulation of the MBTA Subway
0 stars 0 forks source link
genetic-algorithm model simulation transit

MBTA Subway Sim

A simulator of outages and station additions to the MBTA subway

What does MBTA Subway Sim do?

MBTA Subway Sim simulates the effects of station addition and subtractions on the MBTA subway. It anticipates how riders might be impacted using historical data. It takes into account week-wise date and time-of-day-wise time variance in ridership. MBTA Subway Sim, when run, fills the folder sim_out (or a user-described folder, which must exist) with the following files:

How do I use MBTA Subway Sim?

python3 simulation.py [OPTIONS]

Examples:

python3 simulation.py -i Run the simulation in interactive mode.

python3.9 simulation.py -s --station place-davis Simulate the subtraction of the Davis Square station from the Red line.

python3.9 simulation.py -a --station place-harsq --station place-portr --latitude 42.380869 --longitude -71.119685 --line red-a --output /out_add_ex_full/ --from-file /sim_in_full/ --name lesly Using the full-size model, simulate the addition of a station named place-lesly to the Red line between Harvard Square and Porter Square stations, at the coordinates (42.380869, -71.119685). Send the output of this to the directory /out_add_ex_full/.

How do I find the stop_id for the station I want?

Check MBTA_Rail_Stops.csv. A simple grep for the common stop name, or address, should turn up the appropriate row with the stop_id. Note that while MBTA_Rail_Stops.csv is a handy guide for finding information on stations, it is not the resource used by the simulation to determine whether or not stops exist -- for that, please see map.json.

How do I know which line to use?

Most stops are on the line expected of them, e.g., Forest Hills is on orange, Wonderland is on blue, etc. Things get funky with the green and red line, which are broken up corresponding to their branches. For the red line, stations from Alewife to Ashmont is on red-a, and stations from JFK to Braintree is on red-b. For the green line, green-e contains stations from Lechmere to Heath St., green-d contains stations from Kenmore to Riverside, green-c contains stations from Kenmore to Cleveland Circle, and green-b contains stations from Kenmore to Boston College.

What files are here?

How was MBTA Subway Sim made?

MBTA Subway Sim was created by Max Mitchell for his Master's project at Tufts University across the 2023-2024 school year. It has two parts; the model, and the simulation. The model is a genetic model representing a full set a rides on a given day, inferring routes based on historical ridership traffic data available on the MBTA's open data portal. the simulation expands on this model, taking as an input a change to the subway structure, and simulating the impact on ridership for current riders.

Future Work

MBTA Subway Sim has many exciting avenues remaining for future development and work. Please review writeup.pdf's Future Work section for more details, and CONTRIBUTING.md for guidelines on adding code to this repo.

Acknowledgments

I'd like to express my gratitude to a number of people who helped me on this project. To Richard Townsend, my advisor, who provided lots of support, encouragement, and feedback from the beginning through the end. To Liping Liu and Shan Jiang, for providing advice in a field which was new to me. To my brother, who reviewed my design document and pushed me to try something new. And finally, to all my friends and family, for everything.