You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*UXsim* is a free, open-source macroscopic and mesoscopic network traffic flow simulator written in Python.
13
-
It simulates the movements of car travelers and traffic congestion in road networks.
14
-
It is suitable for simulating large-scale (e.g., city-scale) traffic phenomena.
15
-
UXsim is especially useful for scientific and educational purposes because of its simple, lightweight, and customizable features, but users are free to use UXsim for any purpose.
13
+
*UXsim* is a lightweight traffic flow simulator in pure Python.
14
+
It enables users to model various traffic scenarios, from small toy networks to large metropolitan areas, without external dependencies.
15
+
Especially ideal for academic research and educational use.
16
16
17
-
If you are interested, please see:
17
+
## Quick Start
18
+
### Install
18
19
19
-
-[Jupyter Notebook](https://github.com/toruseo/UXsim/blob/main/demos_and_examples/demo_notebook_01en.ipynb) or [Google Colab](http://colab.research.google.com/github/toruseo/UXsim/blob/main/demos_and_examples/demo_notebook_05en_for_google_colab.ipynb): Interactive demonstrations and tutorials
20
-
-[Technical Documentation](https://toruseo.jp/UXsim/docs/index.html): Detailed documents on tutorials, simulation mechanism, and specifications of modules/functions
20
+
For Python 3.10 or later
21
21
22
-
## Main Features
23
-
24
-
- Simple, lightweight, and easy-to-use Python implementation of modern standard models of dynamic network traffic flow
25
-
- Macroscopic and mesoscopic traffic simulation: Simulating over 60000 vehicles in a city in 30 seconds, or even 1 million vehicles in a metropolitan area in 40 seconds depending on the simulation setting
26
-
- Dynamic traffic assignment: Traffic flow simulation with a given network and time-dependent OD demand
27
-
- Approximate solvers for Dynamic User Equilibrium and Dynamic System Optimum are also available
28
-
- Theoretically valid models commonly used in academic and professional transportation research
29
-
- Implementation of traffic control and management schemes such as taxi/shared-mobility, traffic signals, road pricing, and so on
30
-
- Flexible and customizable thanks to pure Python implementation
31
-
- Basic analysis of simulation results and their export to `pandas.DataFrame` and CSV files
32
-
- Visualization of simulation results using `Matplotlib`; interactive GUI is also available
33
-
- Can also be directly integrated with other Python-based frameworks, such as `PyTorch` for deep reinforcement learning traffic control
34
-
- The main code `uxsim.py` is only about 1200 lines of code. Users may easily understand and customize it
35
-
36
-
## Simulation Examples
37
-
38
-
### Large-scale scenario
39
-
40
-
Below are simulation results where approximately 60000 vehicles pass through a 10km x 10km grid network in 2 hours. The computation time was about 30 seconds on a standard desktop PC.
41
-
42
-
Visualization of link traffic states (thicker lines mean more vehicles, darker colors mean slower speeds) and some vehicle trajectories:
### Deep reinforcement learning signal control using PyTorch
52
-
53
-
A traffic signal controller is trained by deep reinforcement learning (DRL) using [PyTorch](https://pytorch.org/).
54
-
The left (or upper) scenario shows no control with fixed signal timing; the traffic demand exceeds the network capacity with the naive signal setting, and a gridlock occurs.
55
-
The right (or bottom) scenario shows DRL control, where the traffic signal can be changed by observing queue length; although the demand level is the same, traffic flows smoothly.
56
-
A [Jupyter Notebook of this example](https://github.com/toruseo/UXsim/blob/main/demos_and_examples/demo_notebook_03en_pytorch.ipynb) is available.
Download the `uxsim` directory from this Github repo or [the latest release](https://github.com/toruseo/UXsim/releases/latest/download/uxsim.zip) and place it in your local directory as follows:
112
-
```
113
-
your_project_directory/
114
-
├── uxsim/ # The uxsim directory
115
-
│ ├── uxsim.py # The main code of UXsim. You can customize this as you wish
116
-
│ └── ... # Other files and directories in uxsim
117
-
├── your_simulation_code.py # Your code if necessary
118
-
├── your_simulation_notebook.ipynb # Your Jupyter notebook if necessary
119
-
├── ... # Other files if necessary
120
-
```
121
-
This way, you can flexibly customize UXsim on your own.
58
+
Approximately 60000 vehicles pass through a 10km x 10km grid network in 2 hours. The computation time was about 30 seconds on a standard desktop PC.
59
+
In the first animation, thicker lines mean more vehicles and darker colors mean slower speeds.
- Lightweight, dependency-free, and fast mesoscopic simulation
142
+
- Simulate large-scale traffic networks with 1 million vehicles in a minute
143
+
- Based on theoretically valid models used in transportation research
144
+
- Apply traffic control mechanisms such as signals, tolls, and shared mobility
145
+
- Fully written in Python (core code ~1200 lines), easy to read and modify
146
+
- Supports approximate solvers for Dynamic User Equilibrium and Dynamic System Optimum
147
+
- Built-in analysis tool using `matplotlib` and `pandas`
148
+
202
149
## Further Reading
203
150
204
151
To learn more about UXsim, please see:
205
152
153
+
-[UXsim Technical Documentation](https://toruseo.jp/UXsim/docs/index.html): Detailed documents on tutorials, simulation mechanism, and specifications of modules/functions
206
154
-[Simple demo in Jupyter Notebook](https://github.com/toruseo/UXsim/blob/main/demos_and_examples/demo_notebook_01en.ipynb) or [Google Colab](http://colab.research.google.com/github/toruseo/UXsim/blob/main/demos_and_examples/demo_notebook_05en_for_google_colab.ipynb): Interactive demonstrations
207
155
-[Demos and examples](https://github.com/toruseo/UXsim/tree/main/demos_and_examples): Various examples using Jupyter Notebooks and Python codes
208
-
-[UXsim Technical Documentation](https://toruseo.jp/UXsim/docs/index.html): Detailed documents on tutorials, simulation mechanism, and specifications of modules/functions
-[JOSS paper](https://doi.org/10.21105/joss.07617): Peer-reviewed article in Journal of Open Source Software
211
-
156
+
-[Scientific overview](https://doi.org/10.21105/joss.07617): Peer-reviewed article in Journal of Open Source Software
212
157
213
158
## Terms of Use & License
214
159
@@ -217,8 +162,8 @@ UXsim is released under the MIT License. You are free to use it as long as the s
217
162
When publishing works based on UXsim, please cite:
218
163
- Toru Seo. [UXsim: lightweight mesoscopic traffic flow simulator in pure Python](https://doi.org/10.21105/joss.07617). Journal of Open Source Software, Vol. 10, No. 106, p. 7617, 2025.
219
164
220
-
```
221
-
@Article{seo2025joss,
165
+
```bibtex
166
+
@Article{seo2025uxsim,
222
167
author = {Toru Seo},
223
168
journal = {Journal of Open Source Software},
224
169
title = {{UXsim}: lightweight mesoscopic traffic flow simulator in pure {Python}},
@@ -231,11 +176,6 @@ When publishing works based on UXsim, please cite:
231
176
url = {https://doi.org/10.21105/joss.07617},
232
177
}
233
178
```
234
-
235
-
If you need more detailed information, please also cite:
236
-
- Toru Seo. [Macroscopic Traffic Flow Simulation: Fundamental Mathematical Theory and Python Implementation](https://toruseo.github.io/misc/MacroTrafficSim_English_summary.pdf). Corona Publishing Co., Ltd., 2023.
237
-
- Toru Seo. [UXsim: An open source macroscopic and mesoscopic traffic simulator in Python-a technical overview](http://dx.doi.org/10.48550/arXiv.2309.17114). arXiv preprint arXiv: 2309.17114, 2023.
238
-
239
179
Works using UXsim are summarized on the [Github Wiki page](https://github.com/toruseo/UXsim/wiki). Please feel free to edit.
240
180
241
181
## Contributing and Discussion
@@ -245,18 +185,6 @@ Please see the [Contributing Guideline](https://github.com/toruseo/UXsim/blob/ma
245
185
246
186
If you have any questions or suggestions, please post them to the [Issues](https://github.com/toruseo/UXsim/issues) or [Discussions](https://github.com/toruseo/UXsim/discussions) (in English or Japanese).
247
187
248
-
I (Toru Seo) work on this project in my spare time. Please understand that my response may be delayed.
249
-
250
-
## Acknowledgments
251
-
252
-
UXsim is based on various works in traffic flow theory and related fields. We acknowledge the contributions of the research community in advancing this field.
253
-
Specifically, UXsim directly uses the following works:
254
-
255
-
-[Newell's simplified car-following model](https://doi.org/10.1016/S0191-2615(00)00044-8) and its extension [X-model](https://doi.org/10.1016/j.trb.2013.02.008)
256
-
-[Incremental Node Model](https://doi.org/10.1016/j.trb.2011.04.001) and its [mesoscopic version](https://ubiquitypress.com/site/chapters/e/10.5334/baw.50/)
257
-
-[Dynamic User Optimum](https://doi.org/10.1016/S0191-2615(00)00005-9)-type Route Choice Model
258
-
259
-
## Related Links
188
+
## Author
260
189
261
-
-[Toru Seo (Author)](https://toruseo.jp/index_en.html)
262
-
-[Seo Laboratory, Institute of Science Tokyo](http://seo.cv.ens.titech.ac.jp/en/)
190
+
[Toru Seo, Institute of Science Tokyo](https://toruseo.jp/index.html)
0 commit comments