This repository contains the code of the framework to simulate the effect of the Braess Paradox on CO2 emissions in urban areas. The framework models the traffic flows from real data and simulates the traffic using SUMO (Simulation of Urban MObility). It is possible to simulate the traffic in different cities and different scenarios. Particulary, the framework can be used to simulate different closure road strategies within the city and analyze the effect on CO2 emissions of these strategies. It can also be used as a detector of the Braess Paradox in urban areas.
The repository is divided in the following folders:
-
src
- contains all the notebooks and the code.0_prepare_Milan_GPS_dataset.ipynb
- notebook with the code to preprocess GPS data from Milan.1_create_od_matrix.ipynb
- notebook to generate the Origin-Destination matrix from GPS data.2_create_mobility_demand.ipynb
- notebook to generate the mobility demand from the OD matrix.3_create_routed_paths_duarouter.ipynb
- notebook to the routed paths from the mobility demand using Duarouter.4a_experiments.ipynb
- notebook to simulate the vehicular traffic in SUMO.4b_results_and_road_aggregation.ipynb
- notebook to resume the results obtained from the simulation and aggregate the edges of the road network.5a_remove_road_experiments.ipynb
- notebook to run the entire framework from the beginning and simulate the vehicular traffic in SUMO after removing some roads.5b_results_remove_experiments.ipynb
- notebook to resume the results obtained from the simulation after removing some roads and compare the results with the baseline experiment.6_all_experiment_results.ipynb
- notebook to aggregate the results obtained from different closure strategies.7a_k_road_plots.ipynb
- notebook to compute the K_road, the K_source and the betweenness centrality for the road in the road network.7b_k_road_clustering.ipynb
- notebook to classify the road of the road network in different categories using clustering technique on the K_road, the Volume-Over-Capacity and the betweenness centrality.7c_remove_k_road_.ipynb
- notebook to remove the road in the road netwrok based on the road classification.7d_remove_k_road_experiments.ipynb
- notebook to run the entire framework from the beginning and simulate the vehicular traffic in SUMO after removing the road based on the road classification.
plot_utils.py
- python utility functions for generating the figures.result_utils.py
- python utility functions for computing the results.utils.py
- python utility functions for the framework.
-
data
- contains the data used in the framework.road_net
- contains the road networks used in SUMO from OSM.shapes
- contains the geojson shape of the city used in the framework.mobility_data
- contains the mobility demand generated from each experiment.OD_matrices
- contains the OD matrices generated from the real data.
-
sumo_simulation_scripts
- contains the code to make experiments in SUMO from traffiCO2
Please always refer to the SUMO Installation page for the latest installation instructions.
To install SUMO on Windows it is necessary to download the installer here and run the executable.
To install SUMO on Linux is it necessary to execute the following commands:
sudo add-apt-repository ppa:sumo/stable
sudo apt-get update
sudo apt-get install sumo sumo-tools sumo-doc
SUMO can be installed on macOS via Homebrew.
You can install and update Homebrew as following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew update
brew install --cask xquartz
To install SUMO:
brew tap dlr-ts/sumo
brew install sumo
After installing SUMO you must configure your PATH
and SUMO_HOME
environment variables.
Suppose you installed SUMO at /your/path/to/sumo-<version>
- On the Windows search box search for "Edit the system environment variables" option and open it;
- Under user variables select
PATH
and click Edit. If no such variable exists you must create it with the New-Button; - Append
;/your/path/to/sumo-<version>/bin
to the end of thePATH
value (do not delete the existing values); - Under user variables select
SUMO_HOME
and click Edit. If no such variable exists you must create it with the New-Button; - Set
/your/path/to/sumo-<version>
as the value of theSUMO_HOME
variable.
- Open a file explorer and go to
/home/YOUR_NAME/
; - Open the file named
.bashrc
with a text editor; - Place this code export
SUMO_HOME="/your/path/to/sumo-<version>/"
somewhere in the file and save; - Reboot your computer.
First you need to determine which shell (bash or zsh) you are currently working with. In a terminal, type ps -p $$
.
In a Terminal, execute the following steps:
- Run the command
open ~/.zshrc
, this will open the.zshrc
file in TextEdit; - Add the following line to that document:
export SUMO_HOME="/your/path/to/sumo-<version>"
and save it; - Apply the changes by entering:
source ~/.zshrc
.
In a Terminal, execute the following steps:
- Run the command
open ~/.bash_profile
, this will open the.bash_profile
file in TextEdit; - Add the following line to that document:
export SUMO_HOME="/your/path/to/sumo-<version>"
and save it; - Apply the changes by entering:
source ~/.bash_profile
.
To execute the framework you must follow the following steps:
- Clone the repository.:
git clone https://github.com/Simoniuss/Braess-Paradox-Framework.git
- Install the conda environment:
conda env create -f environment.yml
- Activate the conda environment:
conda activate braess