An Agent-Based Discrete Event Simulation of Teleoperated Driving in Freight Transport Operations: The Fleet Sizing Problem
This repository contains the Python code for the simulation and analysis presented in the research paper:
Madadi, B., Nadi, A., Almeida Correia, G.H. de, Verduijn, T., Tavasszy, L., 2026. An Agent-Based Discrete Event Simulation of Teleoperated Driving in Freight Transport Operations: The Fleet Sizing Problem. Transportation Research Interdisciplinary Perspectives 36, 101864. https://doi.org/10.1016/j.trip.2026.101864
Teleoperated or remote-controlled driving (TOD) complements automated driving and acts as a transitional technology towards full automation. An economic advantage of teleoperated driving in logistics operations lies in managing fleets with fewer teleoperators compared to vehicles with in-vehicle drivers. This alleviates growing truck driver shortage problems in the logistics industry and can save costs. However, a trade-off exists between the teleoperator-to-vehicle (TO/V) ratio and the service level of teleoperation. This study designs a simulation framework to explore this trade-off, generating multiple performance indicators as proxies for teleoperation service level. By applying the framework, the research identifies factors influencing the trade-off and optimal teleoperator-to-vehicle ratios under different scenarios. A case study on road freight tours in The Netherlands reveals that for any operational settings, a teleoperation-to-vehicle ratio below one can manage all freight truck tours without delay. The minimum teleoperator-to-vehicle ratio for zero-delay operations is never above 0.6, implying a minimum of 40% teleoperation labor cost saving. For operations where a small delay is allowed, teleoperator-to-vehicle ratios as low as 0.4 are shown to be feasible, indicating potential savings of up to 60%.
The study employs a simulation framework that integrates a teleoperation simulator with MASS-GT, a multi-agent simulation system for goods transport.
- MASS-GT: Simulates logistics decision-making to generate road freight tours, which serve as the demand for teleoperation. It includes:
- Shipment Module: Simulates long-term tactical choices (producer selection, distribution channel, shipment size/vehicle type, delivery time).
- Scheduling Module: Simulates short-term tactical choices (tour formation, delivery time optimization, vehicle type).
- Teleoperation Simulator: A Discrete Event Simulation (DES) model that processes the tour data from MASS-GT.
- Entities: Trucks with activities (Idle, In Queue, Takeover, Teleoperated, Signed off).
- Resources: Teleoperators with states (Idle, Busy, Resting, Takeover).
- Events: Occurrences triggering state changes (e.g., takeover request, trip completion).
- Queues: Trucks wait for available teleoperators (FIFO).
- Key Performance Indicators (KPIs): Average waiting time per vehicle, waiting time per vehicle in queue, vehicle utilization, teleoperator utilization, makespan, tour completion rate, distance completion rate, and delay.
The simulation explores various scenarios by adjusting parameters like the teleoperator-to-vehicle (TO/V) ratio, takeover times, simulation start times, and working shifts.
The Python code is organized into the following modules:
preprocess.py: Handles the preprocessing of input data (e.g., MassGT tour data). It selects and filters tours based on specified criteria (tour length, start time, proportion of tours) and prepares the data for the simulation, including calculating buffer times and moving durations.simulate.py: The main script for running the discrete event simulation. It defines vehicle and teleoperator classes, initializes simulation parameters (e.g., number of replications, TO/V ratios, takeover times), and manages the simulation loop. It calls functions fromevent.pyto process events and frompreprocess.pyto get input data. After the simulation, it collects and prepares data for reporting.event.py: Contains functions for processing different types of events within the simulation, such as vehicle idling, queuing for a teleoperator, teleoperator takeover, teleoperation of a vehicle, and teleoperator resting. It manages the event list and updates the state of vehicles and teleoperators.report.py: Generates summary statistics and visualizations from the simulation results. It creates reports on utilizations, statuses, queue lengths, makespan, and completion rates. It also produces trade-off plots showing KPIs versus TO/V ratios for different scenarios.visualize.py: Contains functions for creating plots of the simulation results, such as the number of vehicles in different states over time, queue lengths, and teleoperator statuses. It generates detailed plots for individual replications and summary plots.validate.py: Provides tools for validating the simulation results, including comparison of simulated outputs with reference or real-world data, and generating validation tables and plots to assess model accuracy and reliability.sensitivity.py: Contains routines for performing sensitivity analysis on the simulation model. It allows systematic variation of key parameters to evaluate their impact on performance indicators, supporting robustness checks and scenario exploration.
- Prerequisites & environment:
Create a conda environment with 2022-compatible packages:
```bash
conda create -n tod python=3.9 numpy=1.23.5 pandas=1.5.3 matplotlib=3.6.3 scipy=1.9.3 seaborn=0.12.2 -c conda-forge -y
conda activate tod
```
-
Input Data:
- The simulation requires an input file named
Tours_REF.csvin anInput/directory. This file should contain the tour data generated by MassGT or a similar source, formatted as expected bypreprocess.py. - The
preprocess.pyscript will generate temporary filtered tour files (e.g.,Input/Tours_filtered_S0.csv) during its execution. Note that the input file in this repository is compressed to save space. please unzip it before running the code.
- The simulation requires an input file named
-
Output Directory:
- The simulation will create an
Output/directory to store results, including CSV files of statistics and JPEG images of plots. Subdirectories will be created for each scenario.
- The simulation will create an
To run the simulation, execute the simulate.py script from the command line:
python simulate.pyThe script will iterate through different scenarios defined by parameters within the parameters() function in simulate.py. It will:
- Preprocess input data for each replication.
- Run the simulation for the specified number of replications per scenario.
- Generate reports and visualizations for each scenario.
- Generate overall trade-off plots.
If you run this script with existing parameters in the code, it will reproduce the results presented in the results section of the paper inside a directory called "Output". You can change these parameters to explore different scenarios.
If you run the sensitivity.py script, it will perform sensitivity analysis based on the defined parameters and generate corresponding outputs inside a directory called "Sensitivity".
If you run the validate.py script, it will perform validation of the simulation results and generate validation tables and plots (reported in the statistical stability subsection of the paper) inside the Output directory.
The simulation behavior can be configured by modifying the parameters in the parameters() function within simulate.py:
-
replication: Number of simulation runs for each scenario (e.g., 5).
-
sample_size: Proportion of total tours to be included in the simulation (e.g., 0.01 for 1%).
-
simulation_start: List of simulation start times in hours (e.g., [0, 5, 8]).
-
simulation_duration: List of simulation durations in hours (e.g., [9, 24]).
-
to2v_ratios: Array of teleoperator-to-vehicle ratios to test (e.g., np.array(list(range(30, 105, 5))) / 100 for 0.30, 0.35, ..., 1.00).
-
takeover_times: List of takeover times in minutes (e.g., [0, 1, 2, 3]).
-
max_to_duration: Maximum continuous teleoperation duration for a teleoperator before a long rest, in minutes (e.g., 4.5 * 60).
-
rest_short: Duration of short rest for teleoperators in minutes (e.g., 10).
-
rest_long: Duration of long rest for teleoperators in minutes (e.g., 45).
The simulation generates the following outputs in the Output/ directory, organized by scenario:
CSV files:
-
Summary statistics for utilization, status, counts, queues, and makespan (e.g., R_0_summary_utilization.xlsx, R_0_dist_completion.csv).
-
Detailed event logs, queue states, and vehicle/teleoperator states for the first replication of each scenario (e.g., R_1_events.csv).
JPEG images:
-
Plots showing the number of vehicles in different states, queue lengths, and teleoperator states over time for the first replication (e.g., R_1_states_vh.jpeg, R_1_queues.jpeg).
-
A summary plot combining these for the first replication (e.g., R_1_summary.jpeg).
Overall Trade-off Plots:
-
Located in Output/0 Ratios/.
-
Plots showing KPIs (average queue time, max queue time, tour completion rate, distance completion rate, delay) versus teleoperator-to-vehicle ratios for different takeover times and tour scenarios (e.g., tl-9_tb-0_avg_q_times.jpeg).
-
An Excel file Full_ratios.xlsx containing the aggregated data used for these plots.
If you use this research or code, please cite the original paper:
Madadi, B., Nadi, A., Almeida Correia, G.H. de, Verduijn, T., Tavasszy, L., 2026. An Agent-Based Discrete Event Simulation of Teleoperated Driving in Freight Transport Operations: The Fleet Sizing Problem. Transportation Research Interdisciplinary Perspectives 36, 101864. https://doi.org/10.1016/j.trip.2026.101864
BibTeX:
@article{madadi2026agent, title={An Agent-Based Discrete Event Simulation of Teleoperated Driving in Freight Transport Operations: The Fleet Sizing Problem}, author={Madadi, Bahman and Nadi, Ali and Almeida Correia, Gonçalo Homem de and Verduijn, Thierry and Tavasszy, Lóránt}, journal={Transportation Research Interdisciplinary Perspectives}, volume={36}, pages={101864}, year={2026}, doi={10.1016/j.trip.2026.101864} }
MIT License
Copyright (c) 2023 Bahman Madadi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
