Stochastic Cell Transmission Model for Urban Traffic Simulation
A C++ implementation of macroscopic traffic flow modeling with stochastic dynamics
This project implements the Modified Stochastic Cell Transmission Model (M-SCTM), a macroscopic traffic simulation model that extends the conventional SCTM to handle complex urban road networks.
The classical SCTM captures traffic state uncertainty and changing demand/supply conditions with high accuracy, but was originally limited to freeways and simple networks with a single origin-destination pair. M-SCTM overcomes this limitation by introducing vehicle agents with route choice behavior, enabling simulation on realistic urban networks where turning ratios are not predefined but determined through a route search algorithm.
- 🔀 Urban network support — extends SCTM beyond freeways to complex multi-OD urban networks.
- 🎲 Stochastic dynamics — models uncertainty in traffic states, travel demand, and supply conditions.
- 🚗 Agent-based route choice — vehicles select routes dynamically rather than relying on fixed turning ratios.
- 📊 Statistical analysis — includes R scripts for post-simulation data analysis and validation.
- ⚡ Efficient C++ core — built on Eigen for fast linear algebra and Boost for utilities.
| Dependency | Purpose |
|---|---|
| g++ | C++ compiler (C++11 or later) |
| Boost | General-purpose C++ libraries |
| Eigen | Linear algebra (matrix operations for the CTM) |
| R | Post-simulation data analysis |
makebin/release/simulatorSimulation output is written to data/ and test_data/.
SCTM/
├── src/ # C++ source code (M-SCTM implementation)
├── bin/release/ # Compiled simulator binary
├── build/release/src/ # Build artifacts
├── data/ # Simulation output data
├── test_data/ # Test output data
├── Makefile # Build configuration
└── simulator # Entry point script
The Cell Transmission Model (CTM) discretizes road segments into cells and simulates how traffic density propagates through them over time steps, based on fundamental traffic flow relationships. The Stochastic CTM adds probabilistic elements to capture real-world uncertainty in driver behavior and network conditions.
M-SCTM further extends this framework by resolving a cell-duplication problem that arises when applying the original SCTM's subsystem assignment to adjacent intersections in urban networks. It introduces individual vehicle agents that make route decisions, making the model applicable to networks with arbitrary topology and multiple origin-destination pairs.
If you use this software in your research, please cite:
@article{hadfi2017sctm,
title = {Traffic Simulation in Urban Networks Using Stochastic Cell Transmission Model},
author = {Hadfi, Rafik and Tokuda, Sho and Ito, Takayuki},
journal = {Computational Intelligence},
volume = {33},
number = {4},
pages = {826--842},
year = {2017},
publisher = {Wiley}
}- Simultra — A multiagent hybrid (microscopic + mesoscopic) road traffic simulator with OpenStreetMap rendering, by the same author.
Comments, feedback, and ideas are welcome. If you find bugs or omissions in the code or documentation, please don't hesitate to open an issue or submit a pull request.
Distributed under the GNU General Public License v3.0. See LICENSE for details.
© 2016 Rafik Hadfi