A NumPy/SciPy-based microscopic traffic simulator
Project description
Fast Traffic Simulator
A NumPy/SciPy-based microscopic traffic simulator for directed road networks.
We develop this package at @fbk-most, a research unit at Fondazione Bruno Kessler.
The simulator models individual vehicles travelling from an origin node to a destination node across a directed graph of road edges. Shortest-path routing is computed via Dijkstra's algorithm and can be refreshed periodically to reflect current congestion. Vehicle behaviour on links follows Newell's simplified car-following model: each vehicle moves as fast as possible while respecting the road speed limit and keeping a safe distance from the vehicle ahead. This reproduces queue formation and congestion without explicit capacity constraints. Nodes are treated as dimensionless transfer points — travel time accrues only on links — and each edge supports multiple independent lanes.
Note: this package is currently in an early development stage. APIs may change without notice between releases.
Installation
pip install fast-traffic-simulator
Or, for development (requires uv):
git clone https://github.com/fbk-most/fast-traffic-simulator
cd fast-traffic-simulator
uv sync
Quick start
import pandas as pd
from fts import Simulator
# Build a minimal two-edge graph: 0 → 1 → 2
edges = pd.DataFrame({
'from': [0, 1],
'to': [1, 2],
'length': [100.0, 150.0],
'speed': [10.0, 15.0],
'lanes': [1, 1],
})
# One vehicle travelling from node 0 to node 2, departing at step 0
vehicles = pd.DataFrame({
'origin': [0],
'destination': [2],
'start': [0],
})
simulator, _ = Simulator.build(edges=edges, vehicles=vehicles)
while True:
simulator.step()
arrived = (simulator.vehicles.status == Simulator.VehicleStatus.ARRIVED.value).sum()
if arrived == len(vehicles):
break
print(f"Vehicle arrived at step {simulator.vehicles.arrival_time[0]}")
Main contributors
Marco Pistore: design and implementation.
Acknowledgements
This software has been developed in the scope of the Bologna Digital Twin project, and partially supported by the following projects:
- NRR ICSC National Research Centre for High Performance Computing, Big Data and Quantum Computing (CN00000013), under the NRRP MUR program funded by the NextGenerationEU.
- European Structural and Investment Funds, as part of the National Program for Metropolitan Cities and Medium-Sized Cities South 2021-2027, Priority 1 Digital Agenda and Urban Innovation,Action 1.1.2.1 Metropolitan Digital Agenda, Project BO1.1.2.1.a "DIGITAL TWIN: GOVERNANCE AND ENHANCEMENT OF DATA ASSETS"
License
Copyright 2025-2026 Fondazione Bruno Kessler
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_traffic_simulator-0.1.1.tar.gz.
File metadata
- Download URL: fast_traffic_simulator-0.1.1.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e09b7abd5717f4e4bb7aa7d7c5dd37253e8285cd7082853cd512882509d2372
|
|
| MD5 |
480a4043dfa75074f424bd5d9b1364a4
|
|
| BLAKE2b-256 |
125f5278e8b363e1ccc262d1fbcd9899f3ccb84133fc3e557bee8efc8c3002ba
|
Provenance
The following attestation bundles were made for fast_traffic_simulator-0.1.1.tar.gz:
Publisher:
publish.yml on fbk-most/fast-traffic-simulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_traffic_simulator-0.1.1.tar.gz -
Subject digest:
2e09b7abd5717f4e4bb7aa7d7c5dd37253e8285cd7082853cd512882509d2372 - Sigstore transparency entry: 1341743518
- Sigstore integration time:
-
Permalink:
fbk-most/fast-traffic-simulator@facfbb82cdee93007d755fe8dfe7bdb30fd2315a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fbk-most
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@facfbb82cdee93007d755fe8dfe7bdb30fd2315a -
Trigger Event:
release
-
Statement type:
File details
Details for the file fast_traffic_simulator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fast_traffic_simulator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc082877329d459127daf62a95172bcf240773c2e7a497831bccd43ee6169e53
|
|
| MD5 |
cede55e0f70c51d26cceaceab427ed06
|
|
| BLAKE2b-256 |
c149300e9c731a98176e816688f424ccd60676d322bdaae62cf155e84b47c335
|
Provenance
The following attestation bundles were made for fast_traffic_simulator-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on fbk-most/fast-traffic-simulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fast_traffic_simulator-0.1.1-py3-none-any.whl -
Subject digest:
bc082877329d459127daf62a95172bcf240773c2e7a497831bccd43ee6169e53 - Sigstore transparency entry: 1341743532
- Sigstore integration time:
-
Permalink:
fbk-most/fast-traffic-simulator@facfbb82cdee93007d755fe8dfe7bdb30fd2315a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/fbk-most
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@facfbb82cdee93007d755fe8dfe7bdb30fd2315a -
Trigger Event:
release
-
Statement type: