Abstract
Metro train timetable rescheduling (TTR) is a critical task for ensuring the reliability of urban rail transit systems. However, with the increasing density of railway networks and the growing number of operational trains, TTR has evolved into a typical high-dimensional and large-scale optimization problem. Traditional mathematical programming and heuristic approaches often struggle with the “curse of dimensionality” and fail to provide real-time responses under stochastic disturbances. To address these challenges, this paper proposes a novel framework based on Multi-Agent Deep Reinforcement Learning (MADRL). Specifically, we model the TTR problem as a decentralized cooperative process and utilize the Multi-Agent Advantage Actor-Critic (MAA2C) algorithm to optimize train schedules dynamically. The proposed framework is implemented within the Flatland simulation environment, which allows for the representation of complex arbitrary topologies. We design a composite reward function that minimizes total delay deviation while maximizing passenger satisfaction, subject to constraints such as headway, operating time, and train capacity. Furthermore, to enhance the robustness of the model against high-dimensional state uncertainties, random disturbances following a negative exponential distribution are introduced during training. Experimental results across various scenarios—ranging from simple dual-track to complex random networks—demonstrate that the MAA2C-based approach significantly outperforms traditional baselines. It not only achieves faster convergence in small-scale scenarios but also demonstrates superior computational efficiency and scalability in large-scale environments, effectively minimizing passenger waiting times. This study validates the potential of MADRL in solving high-dimensional traffic control problems for intelligent transportation systems.
1. Introduction
With the rapid acceleration of global urbanization, urban rail transit systems have evolved into large-scale, complex networks that serve as the backbone of metropolitan transportation. As the scale of railway networks expands and the density of operational trains increases, the coupling relationships between different lines and trains become exponentially intricate, leading to a typical high-dimensional system state space. As the scale of railway networks expands and the density of operational trains increases, the coupling relationships between different lines and trains become exponentially intricate, leading to a typical high-dimensional system state space (as illustrated in Figure 1). In such complex environments, the reliability of the train timetable is paramount. However, inevitable stochastic disturbances—such as facility failures, passenger overload, or extreme weather—can easily disrupt pre-planned schedules, causing cascading delays across the entire network. Traditionally, Train Timetable Rescheduling (TTR) relies heavily on manual coordination by dispatchers or simple rule-based strategies. Yet, faced with the high-dimensional uncertainty and large-scale spatiotemporal constraints of modern metro systems, these conventional methods often struggle to provide optimal, real-time responses, highlighting the urgent need for intelligent, automated optimization frameworks. Figure 2 highlights the challenges of real-time rescheduling where local delays can propagate across the network.
Figure 1.
Schematic illustration of the complex coupling relationships and high-dimensional state space in a large-scale metro network.
Figure 2.
Framework of the Train Timetable Rescheduling (TTR) problem under stochastic disturbances. The diagram highlights the challenges of real-time rescheduling where local delays can propagate across the network. The light blue solid lines represent the actual operating trajectories of the other trains in the network under the rescheduled plan.
Looking back over the decades of AI development, from machine learning to deep learning [1], it has consistently provided robust technological support to the transport sector. The Train Timetable Rescheduling (TTR) problem is fundamentally rooted in the Train Timetable Problem (TTP), a classic Non-deterministic Polynomial-time hard (NP-hard) problem [2] that necessitates significant computational resources to resolve polynomial-time constraints. Currently, approaches to solving the TTP can generally be categorized into two paradigms: Mathematical Programming-based methods and Reinforcement Learning (RL)-based methods. Mathematical programming approaches primarily rely on quantifying key factors to formulate objective functions and constraints, designing algorithms to search for optimal parameter combinations within the decision space. Extensive research has been conducted in this domain. For instance, Brannlund et al. [3] proposed a method based on Lagrangian relaxation to maximize profit by scheduling a set of trains without violating track capacity constraints. Building on this, Cacchiani et al. [4] combined a Mixed-Integer Linear Programming (MILP) model with heuristic algorithms to enhance robustness, ensuring minimal network-wide impact under delay scenarios. Similarly, Caprara et al. [5,6] integrated Lagrangian relaxation with Beam Search heuristics, creating a model capable of handling practical engineering data and operational constraints. To balance conflicting objectives effectively, meta-heuristic algorithms have also been widely adopted, yielding promising results in various optimization scenarios [7,8,9,10]. Unlike static mathematical models, RL-based methods typically formulate the TTR problem as a Markov Decision Process (MDP) to avoid entrapment in local optima. Early MDP-based approaches focused on sequential decision-making strategies, such as First-In-First-Out (FIFO) or First-In-Last-Out (FILO). Carey et al. [11] utilized heuristics on Pentium PCs to resolve conflicts in draft timetables under FIFO logic, while Carey et al. [11] proposed a discrete event model based on local feedback strategies, simulating dual-track scenarios to handle potential disturbances. In the realm of deep learning, Kuppusamy et al. [12] introduced a novel TTR model integrating Improved Genetic Algorithms (IGA), Long Short-Term Memory (LSTM), and Recurrent Neural Networks (RNN). Simulations at Chennai Railway Station demonstrated that this approach significantly reduced energy consumption to a minimum average of 696 kWh. However, such hybrid methods often lack the flexibility and robustness required for dynamic adjustment under varying stochastic events. In 1999, Sutton et al. [13] formalized the concept of Reinforcement Learning (RL), wherein an agent interacts with an environment by observing states and executing actions to maximize cumulative rewards. Classical algorithms include Q-learning [14], DDPG [15], A2C [16], and PPO [17]. In the context of TTR, Li et al. [18] proposed an Actor-Critic (A2C) framework to make dynamic decisions for single and dual-track systems based on MDPs. While many studies have successfully applied Q-learning to generate Q-tables for TTR [19,20], this approach suffers from the need for massive computational resources to update Q-tables and difficulty in converging within complex engineering problems. To overcome these limitations, Arulkumaran et al. [21] introduced Deep Reinforcement Learning (DRL), employing neural networks to approximate Q-tables. Ning et al. [22] applied DRL to minimize the average total delay of all trains, validating the model with Beijing-Shanghai High-Speed Railway data. Liao et al. [23] utilized DRL for energy-efficient rescheduling, demonstrating superior real-time performance and learning efficiency compared to traditional heuristics like Genetic Algorithms. Furthermore, Obara et al. [24] combined graph theory with Deep Q-Networks (DQN), achieving excellent results in over 50% of test cases and reducing passenger dissatisfaction by approximately 20%.
Addressing the limitations of Q-learning in high-dimensional spaces, Yang et al. [25] applied the Deep Deterministic Policy Gradient (DDPG) algorithm, allowing for continuous adjustment of cruising speeds and dwell times, thereby saving significant energy under stochastic disturbances. Similarly, Kubosawa et al. [26] developed an automated dispatching system utilizing RL and dynamic simulators to model network-wide traffic and passenger flow.
While the aforementioned studies have established a solid foundation for train rescheduling, a synthesis of the current literature reveals significant bottlenecks. Based on the analysis above, we identify three critical research gaps regarding large-scale optimization and high-dimensional learning that necessitate further investigation:
- Inapplicability to Urban Transit Characteristics: Most existing studies focus on high-speed railway systems rather than urban metro systems. Metro systems are multi-dimensional, multi-role environments involving complex interactions. Modeling such systems requires not only operational metrics but also a comprehensive consideration of passenger satisfaction to maximize travel efficiency, which is often overlooked in traditional railway-focused TTR research.
- Scalability and Computational Complexity: As TTR is an NP-hard problem, traditional algorithms often struggle with high time complexity. Current mathematical solving algorithms frequently converge to local optima or face computational deadlocks when applied to large-scale networks, lacking the efficiency required for real-time responsiveness.
- Slow Convergence in High-Dimensional Spaces: Although DRL has been introduced, standard single-agent approaches face challenges in convergence speed and 0-stability when dealing with the high-dimensional state spaces of TTR. Designing an effective training methodology and a robust network architecture remains a significant bottleneck for intelligent agent decision-making.
While the aforementioned studies have established a solid foundation for train rescheduling, a synthesis of the current literature reveals significant limitations. Based on the analysis above, we identify three critical research gaps regarding large-scale optimization and high-dimensional learning that necessitate further investigation:
- Modeling Strategy: To address system complexity, we explicitly model passenger satisfaction as a core objective, extracting key influencing factors.
- Solution Approach: To overcome the “curse of dimensionality” and solve difficulties, we utilize the Flatland environment to construct a high-fidelity baseline network for multi-agent interactive learning.
- Algorithmic Efficiency: To resolve slow convergence, we employ the MAA2C framework to implement distributed learning and decision-making under limited computational resources. By strategically designing the network structure and optimizing the training method, this model aims to significantly reduce the workload of operators and enhance both safety and efficiency for metro systems at a lower cost.
2. Proposed Methodology: Multi-Agent Deep Reinforcement Learning Framework for TTR
To address the Train Timetable Rescheduling (TTR) problem in urban rail transit systems, this study constructs a post-disruption network operation optimization model. The primary objective is to maximize passenger satisfaction, subject to constraints ensuring operational safety. To solve this optimization model effectively, we establish a multi-agent interactive learning framework based on the Flatland simulation environment. Leveraging reinforcement learning to handle complex decision-making processes, we adopt the Advantage Actor-Critic (A2C) framework to implement distributed learning and execution. This approach is designed to optimize the network structure and training methodology, thereby enhancing solution speed and computational efficiency even under limited computing resources.
2.1. Mathematical Formulation of the TTR Decision Model
2.1.1. System Modeling and Basic Assumptions
To ensure the generality and robustness of the proposed model within urban rail transit systems, we refine the core elements based on practical operational requirements and established modeling theories. The fundamental assumptions of the model are established as follows:
Assumption 1
(Network Topology). We focus on a macroscopic dual-track urban rail transit system as the primary modeling object. Regarding train operations, the model considers full-length routing (terminal-to-terminal operations) and excludes complex routing schemes such as short-turn loops or skip-stop patterns.
Assumption 2
(Agent and Station Definitions). Based on the specific operational scenario, the fundamental theoretical model is illustrated in Figure 3. This model represents an urban rail system incorporating upstream, downstream, and turn-around operations. Let I denote the set of stations and K denote the set of trains. This structure serves as the foundation for the subsequent reinforcement learning formulation.
Figure 3.
Schematic representation of the urban rail system model.
Assumption 3
(Delay Composition). We do not explicitly model initial departure delays as independent variables, as any departure delay inherently propagates to arrival delay. The scheduled arrival time is defined as the earliest possible departure time plus the fault-free travel time along the shortest path. Consequently, the actual arrival delay is composed of three distinct components: initial departure delay, the duration of the facility failure, and secondary delays caused by waiting or rerouting to resolve conflicts.
2.1.2. Objective Function
The primary goal of the objective function is to maximize passenger satisfaction. To achieve this, it is essential to identify the key factors influencing passenger sentiment. According to previous literature [27], passenger dissatisfaction during a metro journey can be categorized into six dimensions: arrival delay, departure delay, waiting time, dwell time, travel time, and connection time. In this study, we specifically focus on two critical indicators: the total time deviation of all trains across the line and the total passenger delay time caused by timetable disruptions.
To facilitate the mathematical formulation of the metro train timetable rescheduling problem and the associated Multi-Agent Deep Reinforcement Learning (MADRL) environment, the key parameters and variables used throughout this paper are summarized in Table 1. These notations cover the train kinematics, passenger flow dynamics, and the reward components of the optimization model.
Table 1.
Notations and definitions of key parameters and variables.
Consequently, the objective function is designed to minimize a weighted sum of two components: the total train time deviation and the metric for passenger dissatisfaction based on total delay . Here, represents the cumulative difference between the planned and actual arrival times for all trains, while denotes the cumulative delay time experienced by all passengers on both upstream and downstream services. The general form of the objective function is expressed in Equation (1), where w1 and w2 are weighting coefficients determined by specific operational priorities, satisfying the condition .
To quantify the total train time deviation , the key lies in calculating the disparity between the scheduled and actual timetables. Let and denote the planned and actual arrival times of train at station , respectively. Similarly, let and represent the planned and actual departure times. Thus, the total train time deviation t1 across the entire line can be formulated as shown in Equation (2).
Regarding the passenger satisfaction metric , this term reflects the aggregated loss of passenger utility, defined as the cumulative delay time of all passengers on both upstream and downstream trains. Let represent the total number of passengers on train at station . Accordingly, can be formulated as shown in Equation (3).
By substituting Equations (2) and (3) into Equation (1), the comprehensive objective function is expanded as follows:
Following the definition of the objective function, we proceed to construct the necessary operational constraints.
2.1.3. Constraints
While the primary objective is to minimize train operation deviation, ensuring operational safety is paramount. Consequently, explicit constraints are imposed on headway time, operation time, and turn-around time. From the passenger’s perspective, waiting time must also be considered in relation to passenger volume. In summary, the constraints for the objective function primarily encompass four aspects: headway time, operation time, turn-around time, and train capacity.
- (a)
- Headway Time Constraints
Headway time is a critical factor in ensuring the safe operation of urban rail transit systems. The time interval between two adjacent trains during the reception and departure processes must satisfy specific safety constraints. These constraints involve the Planned Arrival Time (PAT), Planned Departure Time (PDT), Actual Arrival Time (RAT), and Actual Departure Time (RDT).
Strict time constraints must be applied to the train working diagram. In an urban rail transit system, adjacent trains and + 1 at station must satisfy the minimum headway constraint, denoted as . The specific constraint conditions are expressed in the following equations:
- (b)
- Operation Time Constraints
Operation time is primarily categorized into travel time (running time) and dwell time (station stop time). Based on the actual Automatic Train Operation (ATO) system of the Shanghai Metro, this model classifies operation modes into two levels: automatic and manual. The travel time is dependent on the operation level, and constraints are applied using the reception and departure time intervals of trains under different operation levels.
During train operation, let and represent the ATO system status of train at station , corresponding to the manual or automatic operation levels, respectively. denotes the travel time under operation level , while indicates the dwell time under operation level. The constraints for travel time and dwell time across the entire line are formulated as follows:
- (c)
- Turn-around Time Constraints
Regarding turn-around time, the constraints primarily account for the time consumption during the transition between upstream and downstream states. In the operational line, trains are required to turn around at the terminal station. The turn-around time at station is defined as the difference between the arrival and departure times. Here, the turn-around time is represented as the time difference between train departing from the turn-around station I and arriving at the next station for passenger loading. Subject to the turn-around time constraint, this is expressed as follows:
2.2. Markov Decision Process Formulation and MAA2C Algorithm Design
Flatland, a reinforcement learning library specifically developed for railway systems by Mohanty et al. [28], is utilized to simulate the TTR problem and formulate it as a Markov Decision Process (MDP), as illustrated in Figure 4. An MDP comprises an agent and an environment. The agent interacts with the environment by selecting an action from the action space. This action generates a reward signal fed back to the agent and induces a state transition in the environment, which is observable by the agent. Taking a simplified railway transport scenario as an example: assuming a single train in a grid-based network, a forward movement action changes the train’s position on the grid, thereby altering the system state.
Figure 4.
Schematic diagram of the MAA2C-based reinforcement learning model architecture.
A finite MDP is characterized by finite sets of states , actions , and rewards . In this context, the transition probability, representing the likelihood of transitioning to state with reward given current state and action , is defined as:
The probabilities for all potential values of and can be computed based on the current state and selected action , satisfying the Markov property . Subsequently, the immediate reward and the expected long-term return are calculated as follows, where denotes the discount factor. Accordingly, the value function for a state s under policy is given by .
The MDP model integrates the spatiotemporal characteristics of train operations with reinforcement learning elements. The state transition of a train is a stochastic process determined by the cumulative history of states, actions, and policies from the initial state to the previous state . Based on this theory, the interaction between the urban rail train and the environment in the MDP framework can be represented as . Through interaction with the specific environment, agents employ trial-and-error mechanisms guided by algorithmic logic, eventually converging to an optimal policy via heuristic algorithms.
The Multi-Agent Advantage Actor-Critic (MAA2C) algorithm is an extension of the single-agent A2C algorithm designed for multi-agent reinforcement learning environments. Adopting the Actor-Critic architecture, the Actor network is responsible for learning the policy, while the Critic network estimates the value function; these networks facilitate decision-making and evaluation. The implementation steps of the MAA2C algorithm, as illustrated in Figure 5, are as follows respectively. The implementation steps of the MAA2C algorithm are as follows:
Figure 5.
Schematic diagram of the A2C algorithm: data flow and framework.
Step 1: Environment Definition. Prior to agent-environment interaction, the simulation environment must be constructed. This section focuses on the interaction mechanism post-construction. Crucially, this step involves defining the multi-agent reinforcement learning environment, including the state space, action space, and reward function.
Step 2: Neural Network Architecture. We define the neural networks for the Actor and Critic. The Actor network generates actions based on the current state, while the Critic network evaluates the value function of the current state.
Based on these principles, this study employs a Deep Neural Network (DNN) to design the Actor network, as shown in Figure 6. Drawing upon Multi-Layer Perceptron (MLP) structures, the network comprises input, hidden, and output layers. Specifically, the input layer represents the current state. The hidden layers, designed to extract state features, consist of multiple convolutional layers, each containing 256 neurons. Biases are added after weighting between layers, followed by the ReLU activation function. In the output layer, a Softmax function maps the output of the final hidden layer to the action space, generating scores or probabilities (logits) for each category.
Figure 6.
Actor Network Architecture.
First, the environment is initialized with the initial state . For the Actor network, the input is the current state, and the output is the action distribution. At each time step t, during the interaction between the environment and the agents, let denote the local state of agent n. represents the normalized probability obtained via the Softmax classifier in the final layer, as shown in Equation (12).
Subsequently, an action is selected from the probability distribution using the -greedy strategy, where serves as the exploration parameter. Before selecting an action, a random number is generated from a uniform distribution between 0 and 1. If the number exceeds , the action with the highest probability is chosen; otherwise, an action is selected randomly from the uniform distribution U. To ensure sufficient exploration during the initial training phase, is linearly annealed, as described in Equation (13). Here, represents the global time step, is the threshold for terminating annealing, and and denote the lower and upper bounds of , respectively.
Upon obtaining the joint actions for all agents, the environment executes the system transition according to and computes the rewards for all agents. The experience tuple is then stored in the experience replay buffer D. The time step is updated to , and the process repeats. If all trains reach their destination stations , the environment reaches the terminal state . The total time step for the current episode is recorded, is reset to 0, and a new episode commences. Finally, each agent executes action based on the logit .
The Critic network evaluates the Actor network from a global perspective, supervising the learning process to facilitate the derivation of optimal cooperative policies among agents. In terms of architecture, the Critic network comprises an input layer, hidden layers, and an output layer, as illustrated in Figure 7.
Figure 7.
Critic Network Architecture.
Step 3: Network Parameter Initialization and Update. At each time step, each agent generates an action based on the current state using the Actor network, executes the action, observes the environmental feedback, calculates the Temporal Difference (TD) error, and uses it to update the Critic network parameters. Finally, the Actor network is updated using the current state and the updated Critic parameters. The process begins with parameter initialization. The parameters of the Actor and Critic networks are randomly initialized, assuming that the parameters follow a normal or uniform distribution. Next is the parameter update phase. All agents share the same Actor and Critic networks; each agent interacts with the environment independently, and the parameters of the local networks are updated using the policy gradient method.
Optimization via Experience Replay and Batch Updates. To enhance the stability and convergence speed of the algorithm, optimization techniques such as batch updates and experience replay are adopted for A2C training. This involves creating an experience replay mechanism and pool-based sampling. First, an empty experience replay buffer is created, with memory and parameter configurations set for Redis. Next, experience replay is implemented. The entire data interaction process is as follows: at each time step, when an agent interacts with the environment and generates experience data, this data tuple is added to the replay buffer, including , where represents the current state, denotes the action taken, indicates the reward, and S′ represents the next state. Finally, a certain number of experience samples are randomly sampled from the pool to update the parameters of the Actor and Critic networks.
2.3. Simulation Environment Setup: Physical Model Construction Based on Flatland
This section details the construction of the reinforcement learning model based on the Flatland simulation environment. The construction process is systematically organized into six distinct components: infrastructure generation, environment setup and interaction, baseline model creation, train timetable generation, stochastic delay injection, and route conflict resolution. The primary objective of this architecture is to enable agents to interact within the reinforcement learning environment subject to the specified objective functions and constraints, thereby achieving the goal of minimizing passenger dissatisfaction.
Step 1: Infrastructure Construction We construct a Flatland-based infrastructure model to serve as the foundation for agent-environment interaction. The process begins by defining the dimensions of the rectangular simulation area, which encapsulates the grid environment, followed by determining the specific two-dimensional coordinates for each cell within this rectangle. Prior to implementing the reinforcement learning model, a grid-based representation (referred to as the “model grid”) must be generated to simulate train operations across the railway network.
Step 2: Environment Setup and Interaction A critical component of reinforcement learning is the definition of the reward function. Flatland evaluates the algorithms controlling different agents by assessing their behaviors. This evaluation involves incentivizing desirable behaviors—such as reaching the destination within a specified timeframe—and penalizing undesirable ones, such as unnecessary stops, deviations, or deadlocks.
During the training process, agents learn via trial-and-error, utilizing the reward function as feedback. In the context of sparse rewards, feedback is not provided after every action but rather following a sequence of actions, or occasionally only upon the conclusion of an episode. In Equation (14), and represent customizable weight parameters. denotes the local reward for agent at time (assigned a value of 0 if the target is reached, and −1 otherwise). represents the global reward (assigned a value of 1 if all agents reach their targets, and 0 otherwise). represents the penalty for selecting an illegal action (defaulting to 0).
Within the Flatland environment, a simplified calculation for passenger dissatisfaction is adopted, as the platform does not natively model connecting trains or fixed headways unless explicitly programmed. Furthermore, dwell time and travel time are not distinguished; thus, they are aggregated into the duration between departure and arrival, utilizing the same penalty coefficient. Additionally, penalties for early departures are unnecessary, as trains in Flatland (Figure 8) remain in a “waiting” state and cannot enter the grid until their earliest scheduled departure time is reached.
where and are the penalty coefficients for travel time and delay, respectively. denotes the planned arrival time, represents the travel time, and indicates the actual arrival time. Consequently, the reward function is consistent with the formula, but the local reward is modified to increment at each time step. Considering the interaction between trains and the grid, this model adjusts the local reward such that it is 0 not only when the train completes its journey but also before the train’s departure time arrives.
Figure 8.
Schematic illustration of the grid-based infrastructure in Flatland.
This model also modifies the global reward . If an agent reaches its target during the event, each train receives a positive reward equal to the travel time on the shortest path under fault-free conditions. Defining the global reward in this manner enhances the comparability of scores. A score of 0 is theoretically possible only if all trains depart at the earliest time, utilize the shortest path, and encounter no faults. A significant advantage of this definition is the avoidance of a binary distinction (i.e., receiving a positive reward only if all trains succeed versus zero otherwise). Instead, the reward differentiation becomes progressive, reflecting the percentage of trains that successfully complete their journeys within an episode. A penalty term is employed to penalize trains that miss their scheduled arrival times; this is applied exactly once per train, based on the discrepancy between the planned and actual arrival times. Penalties are also incurred if a train has not reached its destination by the end of the episode or fails to depart entirely.
In the first scenario (late arrival), the penalty equals the difference between the planned arrival time and the estimated arrival time using the shortest path. In the second scenario (cancellation or non-arrival), the penalty is calculated as twice the travel time on the shortest path multiplied by a coefficient. Consequently, the minimum possible score is derived from the sum involving the number of n, the time steps per episode , the earliest departure time , and the negative cancellation penalty , aiming to minimize the total penalty as shown in Equation (16):
- (1)
- Baseline Controller Construction
The Baseline Controller is designed to govern the behavior of agents within the simulation. In the Flatland environment, the creation of baseline controllers must account for the probability of all agents successfully reaching their targets while mitigating potential conflicts, such as deadlocks occurring at specific locations within the rail network. Consequently, this study develops multiple baseline controllers, each aiming to prevent deadlocks and ensure safer, more efficient railway operations. These controllers include the Right-Hand Side Controller (RHSC), the Block Path Controller (BPC), and the Right-Hand Side and Cluster Controller (RHSCC).
The Right-Hand Side Controller (RHSC) mitigates the probability of conflicts by restricting train traffic to the right-side track relative to the direction of travel. This approach is particularly effective in scenarios involving two cities connected by only two tracks. However, it is important to note that deadlocks may still arise within complex urban areas where track configurations are less structured. Similarly, the Block Path Controller (BPC) guarantees a deadlock-free operation by permitting a train to proceed only if its entire designated path is completely clear of obstacles. While this ensures safety, the inherent conservatism of this mechanism may reduce overall transport efficiency in high-density networks:
- Inter-city Component: Contains all cells between cities, where trains are constrained to the right-side track.
- Intra-city Component: Contains all cells within cities, which are grouped into clusters (or sections). A train is permitted to enter a cluster only if its intended path does not require any cells currently occupied by the path of another train within that cluster. This mechanism renders the RHSCC more efficient than the BPC, as cells within a cluster are cleared immediately after a train departs, allowing subsequent trains to proceed without waiting for the predecessor to reach its final destination.
- (2)
- Train Timetable Generation
We introduce a timetable mechanism within the Flatland environment. Consequently, upon initialization, specific temporal attributes are assigned to each train, namely an earliest departure time and a latest arrival time. By default, the earliest departure time is sampled uniformly from the interval . Here, serves as a heuristic approximation, calculated to ensure that, on average, trains can successfully reach their destinations prior to the conclusion of the episode.
To determine the specific train schedules, two distinct strategies are implemented:
Strategy 1: Departure Time Shifting. This approach focuses on adjusting departure times to alleviate congestion. While trains are routed along their shortest paths, their departure times are shifted by a maximum of three minutes. This temporal staggering is designed to mitigate potential operational conflicts during transit.
Strategy 2: Conflict-Free Scheduling for Random Environments. This strategy is specifically tailored for randomly generated network environments. In this setting, each train selects the earliest possible departure time, subject to the constraint that the resulting timetable remains strictly conflict-free. Furthermore, a sequential constraint is imposed to maintain separation: the departure time of a new train must strictly succeed the departure time of the most recently scheduled train, augmented by a stochastic buffer time.
- (3)
- Stochastic Delay Injection
The computation mechanism for stochastic delays in this section consists of two distinct phases. Phase 1 involves determining the probability of a fault occurrence. Assuming that fault occurrences follow a Poisson process with parameter , the probability of a fault occurring at a given time step follows an exponential distribution, calculated as . Phase 2 involves the stochastic triggering mechanism. A random number is generated uniformly between 0 and 1 and compared against the calculated fault probability. If this random number exceeds the threshold, no fault occurs, and the halt duration (number of still steps) is set to 0. Conversely, if the random number falls within the probability range, a fault is triggered.
It is assumed that the duration of the fault (in time steps) follows a negative exponential distribution. The halt duration is a randomly generated integer within a specific interval defined by the model parameters. For the evaluation of solutions in the Flatland case, the lower and upper bounds are set to 20 and 50 time steps, respectively. Unlike the default malfunction model, and given that Flatland operates on discrete time steps, the negative exponential function must be discretized. Simultaneously, a maximum fault duration is introduced (capped at 50 time steps) to constrain the computational complexity. Consequently, given that the Cumulative Distribution Function (CDF) of the negative exponential distribution with parameter is for , we calculate the probability that a fault persists for time steps, where . Although the theoretical lower bound is 1, a duration of 1 time step is practically undetectable as it merely nullifies a single action of the train. Therefore, the minimum duration is increased to 2 to effectively model a tangible disruption.
Based on the formulation derived from Equation (17), two specific categories of delays are implemented:
Departure Time Delay: When a train is located at its origin, a fault probability of 0.05 is assigned upon entering the grid. This ensures that, on average, 5% of trains encounter delays at their departure stations. The expected delay is 0.2 min for short-distance trains and 0.5 min for long-distance regional trains.
Running Time Delay: This refers to delays occurring during transit. For this category, the fault probability is adjusted to for short-distance trains and for long-distance trains. Consequently, on average, 20% of short-distance trains and 50% of long-distance trains experience a 2 min delay during operation.
- (4)
- Route Conflict Resolution
In railway operations, conflicts between two trains can be fundamentally categorized into two types based on their relative directions of travel. The first scenario involves one train impeding the progress of another on the same track (e.g., a rear-end approach). The second scenario arises when two trains follow each other, and the leading train travels at a lower speed or experiences a malfunction. Figure 9 and Figure 10 illustrate a scenario based on Flatland, depicting two trains in a car-following situation where the leading train encounters a fault.
Figure 9.
Following Conflict.
Figure 10.
Head-on Conflict.
Type 1 (Temporary Obstruction): This conflict can be resolved by waiting. The trailing train pauses until the leading train resolves its fault or proceeds at a reduced speed, allowing the trailing train to resume its journey.
Type 2 (Deadlock/Head-on): Under this condition, the conflict cannot be resolved in situ (on the spot). Instead, it requires proactive prevention, such as altering the route of one train to strictly adhere to right-hand traffic rules, thereby preventing the conflict before it manifests.
The proposed model assumes that each train possesses a specific trajectory determined by the timetable and strictly considers pairwise conflicts (conflicts between two trains). The rationale for this assumption adheres to the fundamental operational principle of “timetable-based operation.” Furthermore, complex conflicts involving more than two trains can theoretically be decomposed into a series of pairwise conflicts.
Consequently, conflict detection is performed by comparing the specific infrastructure segments (resources) requested by each train at every time step. If a spatial overlap is detected, a distinction between a temporary blockage and a critical conflict is made by examining whether the trajectory of one train encompasses the trajectory of the other—specifically, whether the trajectory includes the opponent’s current position as the subsequent incremental step. Furthermore, by analyzing the magnitude of this overlap, the system ensures that a minimum safety headway is maintained between trains at all times.
3. Results
3.1. Experimental Case
As illustrated in the figure, this study references the open-source German railway case provided by Leichthammer [27]. The underlying map serves as a simulator representing a small-scale, realistic railway model. Based on this environment, we trained and tested various reinforcement learning algorithms on both the fixed base map and randomly generated railway topologies.
The network topology consists of three stations and two intermediate junctions. The stations are denoted as ZDMA (Left), ZDW (Center), and ZDK (Right), while the junctions are labeled ZDF (Left) and ZDBU (Right). The specific train timetable is presented in Table 2 below.
Table 2.
Model Operating Train Timetable.
3.2. Parameter Settings
To comprehensively evaluate the adaptability of the model across varying dimensions, four representative experimental scenarios were designed, corresponding to the results presented in Figure 11. The specific parameter configurations for each scenario are shown in Table 3:
Figure 11.
(a) Average reward value of the test in the two-track environment. (b) Average conflict resolution score in the two-track environment. (c) Average reward value tested in random environment 1. (d) Average conflict resolution score in random environment 1. (e) Average REWARD value for tests in randomised environment 2. (f) Average conflict resolution score in randomised environment 2. (g) Average REWARD value for tests under randomised environment 3. (h) Average score for conflict resolution under randomised environment 3.
Table 3.
Flatland Environment Hyperparameter Settings.
Basic Scenario (Dual-track): This scenario comprises 20 agents (trains) operating in a simplified dual-track environment with random delay parameters set to 0.2/15. It serves as a baseline to verify the model’s fundamental learning capability under low-complexity conditions.
Random Environment 1: While maintaining 20 agents, this scenario introduces randomly generated network topologies, and the fault frequency is increased to 0.5. This setting is designed to test the model’s generalization capabilities within non-fixed structural layouts.
Random Environment 2: The number of agents is increased to 35, with the fault frequency maintained at 0.5. This scenario simulates medium-density network pressure to assess the cooperative collision-avoidance abilities of the agents.
Random Environment 3: This high-density scenario involves 50 agents with a fault frequency of 0.5. Representing the most challenging setting, it is utilized to evaluate the model’s performance limits and computational efficiency in large-scale, high-conflict environments.
To train the Actor network, the loss function must first be defined. In this model, the Actor loss, denoted as , is formulated as follows:
where represents the probability of taking action a in state s, and A denotes the Advantage function, which evaluates how much better the current action is compared to the average baseline.
The objective of the Actor loss function is to maximize the expectation of the log-probability of actions weighted by their advantage values. Consequently, this encourages the agent to increase the probability of selecting actions that yield higher returns while decreasing the probability of those with lower returns. Regarding hyperparameters, the discount factor is set to 0.99, and the punishment factor is set to 100. Ultimately, the agent’s performance is improved by optimizing the policy to maximize expected returns. The specific structure and parameter settings of the Actor network are detailed in Table 4 and Table 5, respectively.
Table 4.
Actor network structure setup.
Table 5.
Actor network parameter settings.
During the practical training phase, the loss function is typically utilized in conjunction with the gradient descent algorithm to update the parameters of the Actor network by computing the gradient. Consequently, the Actor network continuously refines its policy based on the reward signals, thereby enhancing its performance within the environment.
Regarding the Critic network, the primary objective is to accurately approximate the value function. Following an optimization rationale similar to that of the Actor network, the Critic network updates its parameters by minimizing the loss function, denoted as . This minimization process results in a more precise value approximation, which in turn facilitates optimized policy selection. Similarly, the structure and parameter configurations of the Critic network are detailed in Table 6 and Table 7, respectively.
Table 6.
Critic network structure setup.
Table 7.
Critic network parameter settings.
In the MAA2C algorithm, the loss function of the Critic network utilizes the Temporal Difference (TD) error to quantify the discrepancy between the predicted value function and the target value function. The TD error captures the difference between the estimated value of the current state and the target value derived from the subsequent state. The loss function for this model is formulated as follows:
In this equation, for each time step t, the loss is calculated as the Mean Squared Error (MSE) between the value function estimated by the Critic network and the target value , based on the Bellman equation. Here, denotes the estimated value of the state ; represents the immediate reward received at time step ; is the discount factor; and is the estimated value of the next state .
3.3. Model Evaluation and Data Analysis
Performance Analysis of Figure 11a–h illustrate the training convergence curves (reward per episode) and conflict resolution scores of the MAA2C model across the four experimental environments. As observed in Figure 11a–d, the model demonstrates rapid convergence in low-density scenarios (20 agents). In the basic dual-track environment, the reward curve stabilizes around 300 episodes, while in Random Environment 1, convergence occurs even earlier, at approximately 250 episodes. This indicates that the MAA2C algorithm efficiently masters fundamental traffic rules and scheduling strategies in simple to moderately complex topologies.
With increasing environmental complexity, as shown in Figure 11e–h, the number of episodes required for convergence increases slightly. In Random Environment 3 (50 agents), convergence is reached at approximately 400 episodes. Despite significant initial fluctuations in reward values due to the expanded state space, the curve ultimately stabilizes at a high level. This demonstrates the robustness of the proposed MADRL framework in handling high-dimensional state spaces, effectively overcoming the “curse of dimensionality” through distributed agent collaboration.
Regarding conflict resolution, the score curves align closely with the reward curves. In all scenarios, the conflict resolution rate rises steadily and maintains a high level as training progresses. This suggests the model has not only learned destination routing but has also acquired the ability to avoid deadlocks and collisions in complex dynamic networks via local adjustments (e.g., deceleration, temporary holding). Notably, in Random Environment 3, the model maintains systemic order despite frequent random faults and dense traffic, validating its effectiveness for large-scale scheduling problems.
Comparison with Baselines We further compared the MAA2C framework against established baselines, including First-Come-First-Served (FCFS) and Deep Q-Network (DQN). While FCFS performs adequately in low-density scenarios, its performance degrades rapidly in random environments due to its myopic nature, often leading to deadlocks. In contrast, the MAA2C framework outperforms FCFS by reducing the total delay by approximately 35% in dense scenarios, proving its capability to perform global coordination. Even under significant stochastic disturbances in Random Environments 2 and 3, the proposed algorithm effectively resolves deadlocks and minimizes passenger wait times. Furthermore, the “offline training, online decision-making” paradigm allows for millisecond-level real-time responsiveness, which is significantly superior to the high computational costs associated with traditional mathematical programming methods during online re-planning.
The experimental results demonstrate the impact of environmental complexity on model convergence and conflict resolution performance.
Comparison with Baselines: We compare our MAA2C framework against two established baselines:
First-Come-First-Served (FCFS): A standard heuristic widely used in real-world dispatching, where the train arriving first at a junction gets priority. This serves as the “Real Application Domain” baseline.
DQN (Deep Q-Network): A value-based DRL method, representing the standard learning approach.
Analysis: As shown in Table 8, while FCFS performs adequately in low-density scenarios, its performance degrades rapidly in random environments due to its myopic nature, leading to deadlocks. MAA2C outperforms FCFS by reducing the total delay by 35% in dense scenarios, proving its capability to perform global coordination.
Table 8.
Comparison of model performance in different environments based on Flatland.
Basic Scenarios: In the double-track environment with 20 agents (random delay parameter: 0.2/15), the model stabilizes around 300 episodes and achieves full convergence near 400 episodes, with a training duration of only 25 s. In Random Environment 1 (20 agents, delay frequency: 0.5), convergence is reached earlier at 250 episodes, taking 76 s. In both scenarios, the agents demonstrate high stability in resolving scheduling conflicts.
Complex Scenarios: As the environment complexity increases, the computational cost rises accordingly. In Random Environment 2 (35 agents, delay frequency: 0.5), the model converges at 350 episodes with a training time of 672 s. In the most dense setting, Random Environment 3 (50 agents, delay frequency: 0.5), convergence occurs around 400 episodes, requiring 1259 s.
Overall Analysis: In the high-density Random Environments 2 and 3, although minor fluctuations are observed in the conflict resolution strategies, the model effectively resolves deadlocks and restores normal operation. This indicates that even under significant stochastic disturbances, the proposed algorithm successfully minimizes passenger wait times and maximizes overall passenger satisfaction.
Crucially, this calculation time pertains solely to the offline training phase; once deployed, the model’s forward inference mechanism based on deep neural networks enables millisecond-level real-time responsiveness. This “offline training, online decision-making” paradigm is significantly superior to traditional mathematical programming methods, as it not only avoids the high computational costs of online re-planning but also ensures sub-second decision-making capabilities in the face of sudden disturbances, fully satisfying the real-time requirements of metro operation scheduling. Furthermore, compared to baseline models, MAA2C maintains excellent convergence speeds without introducing significant computational overhead due to multi-agent collaboration, confirming the efficiency of the algorithmic architecture.
4. Conclusions
In this study, we proposed a novel Multi-Agent Deep Reinforcement Learning (MADRL) framework to address the high-dimensional and large-scale Train Timetable Rescheduling (TTR) problem in urban metro systems. By integrating the MAA2C algorithm with the Flatland simulation environment, we successfully modeled the TTR process as a decentralized cooperative task. The main contributions of this study are threefold: (1) we established a comprehensive objective function that explicitly models passenger satisfaction alongside operational efficiency; (2) we constructed a high-fidelity training environment capable of simulating complex arbitrary topologies; and (3) we demonstrated that the distributed MAA2C framework significantly outperforms traditional heuristics and single-agent DRL methods in terms of convergence speed and computational efficiency. The experimental results validate that our approach can effectively minimize total delays and enhance robustness against stochastic disturbances, confirming the feasibility of DRL for real-time metro rescheduling.
Despite the promising results, this study has several limitations that warrant acknowledgment. First, the current model architecture assumes full-length routing for all trains. Consequently, it does not currently account for the complex operational paradigms frequently employed in modern metro networks, such as short-turn loops, skip-stop patterns, or dynamic train coupling. Second, while the Flatland framework provides a robust abstraction of railway operations, the validation was primarily conducted within simulated environments. Real-world physical infrastructure inherently possesses unpredictable stochasticity—such as SCADA system latency or variable traction power limitations—that is not fully captured in the current simulation grid. Finally, passenger dissatisfaction was modeled macroscopically; microscopic passenger dynamics (e.g., platform crowding effects, dynamic route choice during disruptions) were simplified.
To address these limitations, future research will focus on three primary avenues. First, we aim to extend the action space of the multi-agent framework to support diverse and flexible routing strategies, enabling the algorithms to execute dynamic turning and skip-stop scheduling in real-time. Second, we plan to integrate microscopic passenger flow models to more accurately capture the bidirectional impact between train scheduling and passenger route-choice behaviors during major network disruptions. Finally, a critical next step involves validating the proposed MAA2C model using empirical operational data and dispatch logs from physical metro lines to thoroughly assess its practical applicability and deployability in real-world cyber-physical systems.
Author Contributions
Conceptualization, H.Y.; Methodology, H.Y.; Data curation, W.W.; Writing—original draft, H.Y.; Project administration, C.X.; Funding acquisition, J.Y. All authors have read and agreed to the published version of the manuscript.
Funding
Project supported by the National Natural Science Foundation of China (Grant No. 52302438) “Research on behavior pattern and human error of emergency response of multi-functional personnel for fully automatic metro”.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.
Conflicts of Interest
The authors declare no conflict of interest.
References
- Feng, S.; Sun, H.; Yan, X.; Zhu, H.; Zou, Z.; Shen, S.; Liu, H.X. Dense reinforcement learning for safety validation of autonomous vehicles. Nature 2023, 615, 620–627. [Google Scholar] [CrossRef] [Scilit]
- Zhou, X.; Zhong, M. Single-track train timetabling with guaranteed optimality: Branch-and-bound algorithms with enhanced lower bounds. Transp. Res. Part B Methodol. 2007, 41, 320–341. [Google Scholar] [CrossRef] [Scilit]
- Brännlund, U.; Lindberg, P.O.; Niu, A.; Nilsson, J. Railway timetabling using Lagrangian relaxation. Transp. Sci. 1998, 32, 358–369. [Google Scholar] [CrossRef] [Scilit]
- Cacchiani, V.; Toth, P. Nominal and robust train timetabling problems. Eur. J. Oper. Res. 2012, 219, 727–737. [Google Scholar] [CrossRef] [Scilit]
- Caprara, A.; Fischetti, M.; Toth, P. Modeling and solving the train timetabling problem. Oper. Res. 2002, 50, 851–861. [Google Scholar] [CrossRef] [Scilit]
- Caprara, A.; Monaci, M.; Toth, P.; Guida, P.L. A Lagrangian heuristic algorithm for a real-world train timetabling problem. Discret. Appl. Math. 2006, 154, 738–753. [Google Scholar] [CrossRef] [Scilit]
- Kaspi, M.; Raviv, T. Service-oriented line planning and timetabling for passenger trains. Transp. Sci. 2013, 47, 295–311. [Google Scholar] [CrossRef] [Scilit]
- Niu, H.; Zhou, X. Optimizing urban rail timetable under time-dependent demand and oversaturated conditions. Transp. Res. Part C Emerg. Technol. 2013, 36, 212–230. [Google Scholar] [CrossRef] [Scilit]
- Yin, J.; Tang, T.; Yang, L.; Gao, Z.; Ran, B. Energy-efficient metro train rescheduling with uncertain time-variant passenger demands: An approximate dynamic programming approach. Transp. Res. Part B Methodol. 2016, 91, 178–210. [Google Scholar] [CrossRef] [Scilit]
- Chow, A.H.; Pavlides, A. Cost functions and multi-objective timetabling of mixed train services. Transp. Res. Part A Policy Pract. 2018, 113, 335–356. [Google Scholar] [CrossRef] [Scilit]
- Carey, M.; Crawford, I. Scheduling trains on a network of busy complex stations. Transp. Res. Part B Methodol. 2007, 41, 159–178. [Google Scholar] [CrossRef] [Scilit]
- Kuppusamy, P.; Venkatraman, S.; Rishikeshan, C.A.; Reddy, Y.P. Deep learning based energy efficient optimal timetable rescheduling model for intelligent metro transportation systems. Phys. Commun. 2020, 42, 101131. [Google Scholar] [CrossRef] [Scilit]
- Sutton, R.S.; Barto, A.G. Reinforcement learning. J. Cogn. Neurosci. 1999, 11, 126–134. [Google Scholar]
- Watkins, C.J.; Dayan, P. Q-learning. Mach. Learn. 1992, 8, 279–292. [Google Scholar] [CrossRef] [Scilit]
- Hou, Y.; Liu, L.; Wei, Q.; Xu, X.; Chen, C. A novel DDPG method with prioritized experience replay. In Proceedings of the 2017 IEEE International Conference on Systems, Man, and Cybernetics (SMC), Banff, AB, Canada, 5–8 October 2017; pp. 316–321. [Google Scholar]
- Babaeizadeh, M.; Frosio, I.; Tyree, S.; Clemons, J.; Kautz, J. Reinforcement learning through asynchronous advantage actor-critic on a GPU. arXiv 2016, arXiv:1611.06256. [Google Scholar]
- Carta, S.; Ferreira, A.; Podda, A.S.; Recupero, D.R.; Sanna, A. Multi-DQN: An ensemble of Deep Q-learning agents for stock market forecasting. Expert Syst. Appl. 2021, 164, 113820. [Google Scholar] [CrossRef] [Scilit]
- Li, W.; Ni, S. Train timetabling with the general learning environment and multi-agent deep reinforcement learning. Transp. Res. Part B Methodol. 2022, 157, 230–251. [Google Scholar] [CrossRef] [Scilit]
- Su, B.; Wang, Z.; Su, S.; Tang, T. Metro train timetable rescheduling based on Q-learning approach. In Proceedings of the 2020 IEEE 23rd International Conference on Intelligent Transportation Systems (ITSC), Rhodes, Greece, 20–23 September 2020; pp. 1–6. [Google Scholar]
- Šemrov, D.; Marsetič, R.; Žura, M.; Todorovski, L.; Srdic, A. Reinforcement learning approach for train rescheduling on a single-track railway. Transp. Res. Part B Methodol. 2016, 86, 250–267. [Google Scholar] [CrossRef] [Scilit]
- Arulkumaran, K.; Deisenroth, M.P.; Brundage, M.; Bharath, A.A. Deep reinforcement learning: A brief survey. IEEE Signal Process. Mag. 2017, 34, 26–38. [Google Scholar] [CrossRef] [Scilit]
- Ning, L.; Li, Y.; Zhou, M.; Song, H.; Dong, H. A deep reinforcement learning approach to high-speed train timetable rescheduling under disturbances. In Proceedings of the 2019 IEEE Intelligent Transportation Systems Conference (ITSC), Auckland, New Zealand, 27–30 October 2019; pp. 3469–3474. [Google Scholar]
- Liao, J.; Yang, G.; Zhang, S.; Zhang, F.; Gong, C. A deep reinforcement learning approach for the energy-aimed train timetable rescheduling problem under disturbances. Complex Intell. Syst. 2021, 7, 3096–3109. [Google Scholar] [CrossRef] [Scilit]
- Obara, M.; Kashiyama, T.; Sekimoto, Y. Deep reinforcement learning approach for train rescheduling utilizing graph theory. In Proceedings of the 2018 IEEE International Conference on Big Data (Big Data), Seattle, WA, USA, 10–13 December 2018; pp. 4525–4533. [Google Scholar]
- Yang, G.; Zhang, F.; Gong, C.; Zhang, S. Application of a deep deterministic policy gradient algorithm for energy-aimed timetable rescheduling problem. Energies 2019, 12, 3461. [Google Scholar] [CrossRef] [Scilit]
- Kubosawa, S.; Onishi, T.; Sakahara, M.; Tsuruoka, Y. Railway operation rescheduling system via dynamic simulation and reinforcement learning. arXiv 2022, arXiv:2201.06276. [Google Scholar] [CrossRef] [Scilit]
- Leichthammer, L. Evaluating planning-based machine learning algorithms for scheduling railway operations. Transp. Res. Part B Methodol. 2022, 17, 230–251. [Google Scholar]
- Mohanty, S.; Nygren, E.; Laurent, F.; Schneider, M.; Scheller, C.; Bhattacharya, N.; Watson, J.; Egli, A.; Eichenberger, C.; Baumberger, C. Flatland-RL: Multi-agent reinforcement learning on trains. arXiv 2020, arXiv:2012.05893. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.










