Python implementation of a traffic simulation using a random walk over a graph. Scripts in this repository allow to perform a simulation with two dynamics: synchronous and asynchronous dynamics. A more detailed description of the simulation and those two dynamics can be found in the pdf Arise of congestion.
To start using the repository, first clone it:
git clone https://github.com/MassimoMario/traffic_simulation.git
This project requires Python โฅ 3.8 and the following libraries:
numpymatplotlibtqdmnetworkxgeopandas
To install them you can run on the Bash:
pip install -r requirements.txt
The main script simulation.py can be runned from the command line providing different argument ending in different configuration.
As an example you can run:
python simulation.py --file my_file.geojson --n_max 10 --tc 3 --n_steps 100 --load 3 --dynamics sy
The dynamics argument is a string an allows only 'asy' and 'sy' values for asynchronous and synchronous dynamics.
simulation script are plots of the input network, its degree histogram, the probability distribution of node state and the deviations occurrence.
my_file.geojson with your actual file .geojson :) .
For a complete list of parameters and their descriptions, run:
python simulation.py --help
The repository contains the following folders and files:
simulation.pyis the main script for simulating and plotting the resultssimulation_class.pyis the script containing the simulation class definitionrequirements.txttxt file containing the required libraries to run the simulationArise of congestionis a pdf report of the use of such simulation on the Bologna urban network.