Replication Data for: Bridging the Public-Private Transport Discomfort Gap
Description
This repository contains the Python source code and the algorithmic infrastructure for the manuscript "Bridging the Public-Private Transport Discomfort Gap: A Data-Driven What-If Optimization Framework" (submitted to _Transportation Research Part A: Policy and Practice_). **Research Objective and Hypothesis** The research addresses the chronic uncompetitiveness of Public Transport (PT) compared to Private Vehicles (PV) in expanding metropolitan areas. We hypothesize that by objectively quantifying the "discomfort gap"—specifically out-of-vehicle penalties such as walking, waiting, and transfer times—transport authorities can deploy targeted, high-ROI service improvements to foster a modal shift. **About the Framework and Data Context** This repository provides the computational framework developed to evaluate this hypothesis. In the associated manuscript, the framework ingests crowdsourced GPS mobility traces and official static GTFS transit schedules to generate theoretical multimodal alternative itineraries via OpenTripPlanner (OTP). _(Please note: The anonymized mobility datasets and the specific origin-destination matrices used for the case study in the paper are not included in this repository. This repository strictly provides the codebase and the optimization models)._ **Contents of the Repository** The codebase is structured to handle the following analytical steps: - **Differential Generalized Discomfort Metric:** Python scripts designed to compute the generalized cost gap between private trips and PT alternatives based on travel phases. - **Propensity Model Calibration:** Code implementing the non-linear regression to fit an empirical Sigmoid mode-shift propensity curve based on Random Utility Theory. - **Priority Corridors Extraction (H-index):** Algorithms to calculate the _H-index_, a spatial-temporal metric used to prioritize critical urban corridors where transport supply fails to meet demand. - **What-If Optimization Framework (Genetic Algorithm):** The core Python codebase implementing a modular decision model. The Genetic Algorithm simulates the application of four operational levers: stop optimization, frequency adjustments, commercial speed upgrades, and schedule synchronization. **Interpretation and Usage** Researchers and transport planners can utilize this modular Python framework to deploy the proposed Decision Support System (DSS) in other urban contexts. By inputting their own local GTFS feeds and mobility demand data, users can replicate the methodology to evaluate transit competitiveness and simulate targeted optimization scenarios.
Files
Steps to reproduce
Methodology/Steps to Reproduce This repository contains the complete Python codebase required to replicate the Data-Driven What-If Optimization Framework. The execution is organized into sequential scripts that process the data from raw inputs to the final optimized transport interventions. Software and Prerequisites The workflow requires a standard Python 3.x env with the `pandas`, `numpy`, etc libraries. All parameters are in the `config.py` file. It is assumed that user has already generated alternative itineraries (via OTP) and possesses the local GTFS static feeds (e.g., CTM and ARST). Workflow To fully reproduce the methodology, the scripts must be executed in the following order: - 1. Data Preprocessing (`step1_preprocessing.py`): Cleans the raw mobility dataset. It filters trips by transport mode, removes out-of-bounds GPS coordinates, drops invalid records, and computes the baseline Generalized Cost for the observed trips. - 2. Discomfort Calculation (`step2_discomfort.py`): Parses the OTP alternative itineraries to extract the distinct travel phases: walking, waiting, transferring, and riding. It computes the Differential Generalized Discomfort ($\Delta D$) by comparing the effort of observed private trips against their theoretical public transport alternatives, and vice versa. - 3. Propensity Modeling (`step3_propensity.py`): Aggregates the $\Delta D$ values into empirical bins and applies non-linear least squares regression (`scipy.optimize.curve_fit`) to calibrate the Sigmoid mode-shift propensity curve, extracting the specific $P_{max}$, $g$, and $\Delta D_{flex}$ parameters. - 4. Corridor Extraction (`step4_corridors.py`): Discretizes the urban territory into a spatial grid (e.g., 500x500m cells) and temporal windows (e.g., 10-minute slots). It aggregates individual trips into spatial-temporal flow corridors and calculates the _H-index_ to rank and isolate the top priority corridors for public transport interventions. - 5. Candidate Generation (`step6_candidates.py`): Ingests the GTFS schedules and route geometries to dynamically generate discrete intervention candidates for the four operational levers: frequency increases, schedule synchronization, new stop placements, and commercial speed upgrades. It pre-computes the costs and benefits, outputting specialized JSON lookup tables for rapid fitness evaluation. - 6. Genetic Algorithm (`step7_ga.py`): Executes the combinatorial optimization. The GA evaluates binary decision chromosomes across generations to maximize the number of users converted to PT, while strictly enforcing CAPEX, OPEX, and maximum fleet constraints. It outputs the optimal solution vector. - 7. Cost-Efficiency Analysis (`step8_results.py`): Processes the optimized GA outputs to perform a granular cost-efficiency analysis for each applied lever per corridor. It generates the final paper-ready visualizations, including the scatter bubble charts, heatmaps, and LaTeX table snippets.
Institutions
- University of CagliariSardinia, Cagliari