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
Metadata
Release files for fast-traffic-simulator 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fast_traffic_simulator-0.2.0.tar.gz | 24.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fast_traffic_simulator-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.7 kB
Release files / fast_traffic_simulator-0.2.0.tar.gz
| Download URL | fast_traffic_simulator-0.2.0.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92defca34248fb4c9ceda6a069444403e45498aa17ecab3b9c920d19415b5784
|
|
BLAKE2b-256 checksum How to use checksums |
b096bd53107ab76cda27ca4a27320a41bf6c9d0c0e00c549e25acc5d42967015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.
Transparency logRelease files / fast_traffic_simulator-0.2.0-py3-none-any.whl
| Download URL | fast_traffic_simulator-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e979ad7393e5c19e22003c218c0550c7f72ba6ff02a4d4fef89bcd1d6c6e2cd3
|
|
BLAKE2b-256 checksum How to use checksums |
7cddc7a152a5582783583c23959732f969106503f3759cdac62c90534298c79d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.
Transparency logSecurity for fast-traffic-simulator 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for fast_traffic_simulator-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.