UGE-MAS_BusSimulation

Public Transport Mobility Simulation

Abstract

This project models and simulates the interactions between passengers, public transport vehicles (buses), roads, and bus stops in a dynamically evolving urban environment. Built using Mesa, a Python-based multi-agent simulation framework, it evaluates the performance and resilience of public transport systems under normal operations and during disturbances such as road failures or vehicle breakdowns.

📹 Demo Video

YouTube —

Problem Definition

Objectives

  1. Passenger and Vehicle Simulation:
    • Represent passenger behaviors, including waiting at bus stops and traveling by bus.
    • Model buses with predefined routes and schedules, adapting to real-time conditions.
  2. Impact of Disturbances:
    • Introduce road disconnections.
    • Quantify their effects on passenger travel times and system efficiency.
  3. System Resilience:
    • Develop adaptive strategies to mitigate disruptions in transport systems.

Design and Implementation

Architecture

Demo GIF

Design Process

  1. System Breakdown:
    • Modularized components such as roads, buses, and passengers for clarity.
  2. Agent Interactions:
    • Designed interactions like bus-passenger pickups, road conditions affecting movement, and dynamic rerouting.
  3. Disturbance Management:
    • Incorporated real-time road failures and recovery mechanisms to analyze their impacts.

Coding Practices


System Components

Environment

The city is represented as a 2D grid containing:


Agents

Passenger

Bus

Bus Stop

Road

Intersection

Traffic Light


Challenges and Solutions

Challenges

  1. Dynamic Rerouting:
    • Problem: Calculating efficient routes during road failures.
    • Solution: Integrated Dijkstra’s algorithm for real-time pathfinding.
  2. Synchronization of Agents:
    • Problem: Ensuring smooth interactions between buses, passengers, and roads.
    • Solution: Leveraged Mesa’s staged activation to execute agent behaviors sequentially.
  3. Scalability:
    • Problem: Maintaining performance with increased grid size and agents.
    • Solution: Optimized agent interactions and ensured modular design for scalability.

Results and Observations

Key Metrics

  1. Passenger Travel Time:
    • Measured time taken from origin to destination under normal and disturbed conditions.
  2. Bus Efficiency:
    • Evaluated by the number of passengers served per route.
  3. Impact of Disturbances:
    • Quantified delays caused by road failures and breakdowns.

Insights


Future Enhancements

  1. Dynamic Passenger Behavior:
    • Simulate passengers choosing alternative routes or modes of transport.
  2. Advanced Traffic Control:
    • Utilize machine learning for predictive traffic light scheduling.
  3. Expanded Transportation Modes:
    • Include additional vehicles like taxis or bicycles for richer simulations.

Getting Started

This guide provides two ways to set up and run the simulation:

  1. Using Conda Environment
  2. Using Docker Hub

1. Running with Conda Environment

Prerequisites

Step-by-Step Guide

  1. Clone the Repository:
    git clone https://github.com/CongSon01/UGE-MAS_BusSimulation
    cd UGE-MAS_BusSimulation
    
  2. Create a Conda Environment:
      conda create --name bus_simulation python=3.10 -y
      conda activate bus_simulation
    
  3. Install Dependencies:
      pip install -r requirements.txt
    
  4. Run the Simulation:
      python run.py
    

2. Running with Docker Hub

  1. Pull the Pre-Built Docker Image:
    docker pull congson01/mobility-simulation:latest
    
  2. Run the Docker Container:
    docker run -p 8521:8521 congson01/mobility-simulation:latest
    

3 Access the Simulation:

http://127.0.0.1:8521/