Abstract
In most urban subway networks, passengers may make a transfer at night or in the early morning to arrive at their destinations. Given that passengers may confronted with transfer failure at night or long waiting in the morning, scheduling overnight trains is beneficial to both the last and first train services in the urban metro network, in particular, to minimize the number of failed transfer passengers in the last train service and the transfer waiting time for the first train service. Then, we formulate the overnight train scheduling problem as a mixed integer linear programming model based on a well-designed time-discretized space–time network. To handle large-scale applications, we decompose the proposed model into two space–time path-searching sub-problems and a semi-assignment problem through Lagrangian relaxation–based decomposition and solution framework. Finally, we adopt Beijing Subway Network as a practical case study. The results show that both the number of failed transfer passengers for last train service and the passenger transfer waiting time for first train service decrease significantly if the operators can schedule the overnight trains in Beijing Subway Network according to the optimization results of the proposed model.
Introduction
Motivation
The development of the urban subway system has been thriving over the last decade, and many urban subway networks have become the most important transportation mode in cities 1 due to its security, wide accessibility, high-energy performance, reliable service, convenience, and low-carbon consumption.2,3 Most subway systems are usually not operating for 24 h. For example, in the Beijing Subway Network, trains are running from about 5:00 to 24:00 continuously. However, passengers may suffer inconvenience at night or in the early morning when the trains in the urban subway network nearly end or just start for operation. Figure 1(a) shows the situation of failed transfer for last train service, and Figure 1(b) shows the situation of long transfer waiting time for first train service. In response to this situation, the solution presented in this article is “overnight trains”: an overnight train is arranged by the operators to provide a transfer service for passengers who failed to transfer after the last train at night and passengers who waited for the first train in the morning for a long time, and stops at a specific non-service station during this period. Therefore, scheduling overnight train can be an efficient method for improving service levels for both last and first train services in an urban subway network.

(a) Situation of failed transfers at night; (b) situation of long waiting time in the early morning.
Figure 2 shows an example in the Beijing Subway network for the failed transfer and the long-time transfer latency existing in the last and first train timetables. Both XiErQi and GongZhufen are transfer stations. The former connects the Line CP and Line 13, and the latter connects the Line 10 and Line 1. Figure 2(a) shows that the last train on Line ChangPing arrives at XiErQi station at 23:26; then there are no trains on Line ChangPing when passengers from Line 13 go to Line ChangPing at XiErQi station, which leads to a failed transfer. Figure 2(b) shows the train timetable of GongZhuFen station. The first feeder train on Line 1 arrives at GongZhuFen station at 5:18, and the first connection train on Line 10 arrives at GongZhufen at 6:27; passengers must wait more than 1 h to board the first train on Line 10.

The example of long transfer waiting time and failed transfer in Beijing subway: (a) train timetable for XiErQi station at night; (b) train timetable for GongZhuFen station in the morning.
According to the existing timetable in Beijing subway network, there are more than 108 failed transfer directions for last train service and the total waiting time for the first train service is more than 2600 min. 4 The reason can be explained that there are operation time and maintenance time window constraints for each line considering passenger demand, train and track maintenance requirement, and also working time for crew. Therefore, this study takes the actual passenger demand at night and in the early morning into consideration and aims to minimize the number of failed transfer passengers at night and the total transfer waiting time in the early morning by scheduling overnight trains in the subway network. Figure 3 shows the flow chart of this study. First, the physical urban subway network, the existing train timetables at night and in the early morning, and the corresponding passenger demand are the inputs of the model. Then, we propose a MILP model to optimize the overnight train schedule and simultaneously assign passengers into the subway network to evaluate the overnight train schedule in a space–time network. The proposed model can be solved by a Lagrangian relaxation (LR) decomposition and solution framework, which is tested on a large-scale case of Beijing Subway Network.

The flow chart of solving the problem.
Literature review
Several scholars have provided excellent surveys of the inherent connections among different optimization problems in the field of rail transit routing and scheduling.5,6 In an urban subway network, timetable synchronization problem has been widely studied from different perspective. Wong et al. 7 proposed a mixed integer programming optimization model to minimize the passengers transfer waiting time in railway network for the timetable synchronization problem. Shafahi and Khani 8 established a mixed integer programming model to minimize the waiting time considering the extra stopping time of vehicles at transfer stations. Niu et al. 9 proposed a non-linear optimization model to minimize passenger waiting time at station and crowding disutility in the trains when passengers have a transfer between two interconnected high-speed rail lines. Tian and Niu 10 proposed a bi-objective integer programming model integrated with irregular headways to optimize the train timetables for transfer synchronization, in order to minimize the total waiting time and maximize the number of connections. Shang et al. 11 formulated a demand-driven timetable synchronization and optimization model to minimize passenger total travel time, the model aimed to adjust the departure time, running time, stopping time, and headway of all trains on each line which can be computed by the genetic algorithm.
With the development of smart card automatic fare collection (AFC) systems, more detailed data of passenger demand and characteristic can be obtained, including passenger origin and destination stations and corresponding departure times and arrival times. A trend toward demand-driven transit rail timetable optimization has emerged.12,13 For instance, Niu and Zhou 14 constructed a binary integer programming model to optimize a passenger train timetable when the passengers cannot board the trains because of the maximum loading capacity of previous trains. Niu et al. 15 formulated a mathematically rigorous and algorithmically tractable non-linear mixed integer programming model for both real-time scheduling and medium-term planning applications to minimize the total waiting time of passengers at stations. Canca et al. 16 formulated a non-linear integer programming model, which fits the arrival and departure time of trains for a dynamic behavior of demand to solve the problem of timetable determination. Canca et al. 17 focused on the design and optimization of train timetables to minimize the average passenger waiting time at the stations with two mathematical programming formulations which adapt the non-periodic train timetabling problem on a single line under a dynamic demand pattern. Yin et al.18,19 proposed models for rescheduling and scheduling trains considering energy-efficiency and time-dependent passenger demand. Shi et al. 20 established an integrated integer linear programming model to optimize the train timetable and accurate passenger flow control strategies on an oversaturated metro line, aimed to minimize the total passengers waiting time. Shang et al. 21 formulated a space–time–state network based on multi-commodity flow formulation to solve an equity-oriented skip-stopping schedule problem in an oversaturated urban rail transit network. Then the linear programming model can be effectively decomposed to a least-cost sub-problem with positive arc costs for each individual passenger and a least-cost sub-problem with negative arc costs under LR framework. Shang et al. 22 proposed a model which aimed to minimize the total passenger travel time with the dynamic passenger demand. Shang et al. 23 formulated an approach to estimate the passengers flow state based on the space–time–state network by integrating Lagrangian and Eulerian observations.
Timetable optimization for the last and first train services are two important problems, and several optimization models are proposed to offer optimized timetables in previous studies. For the last train problem, Kang et al. 24 focused on the last train transfer problem in the urban subway network; they formulated a last-train network transfer model to maximize passengers transfer connection headway, which can decrease the number of passengers failed transfer. Kang et al. 25 established a rescheduling model for last trains, which focused on the train delays because of incidents that occurred in train operations; the model was to minimize the dwell time and the running time, and to maximize the average transfer redundant time and the network accessibility. Yin et al. 26 focused on the last-train timetabling problem and proposed a bi-level programming model to maximize the social service efficiency and minimize the revenue loss for the operating companies by a genetic algorithm. Kang et al. 27 connected the last and bus bridging service problem in the urban railway transit networks; they proposed a last and bus bridging coordination mixed integer linear programming (MILP) model to maximize the last train connections and minimize waiting time for rail-to-bus passengers. For the first train problem, Kang et al. 4 optimized the first-train timetable with a mixed integer programming model to minimize the arrival time difference of trains and the number of missed trains. Guo et al. 28 proposed a model to coordinate first-train timetable in the urban railway network with a sub-network connection method. Kang and Zhu 29 used the mixed integer variables to calculate the waiting time for the “first available” train correctly, which can minimize the passengers transfer waiting time. Kang and Zhu 30 presented two practical optimization models to minimize the standard deviation of transfer redundant times and to balance the last train transfers in subway networks, which can be solved by a new heuristic algorithm.
Table 1 shows the comparisons of previous last-train, first-train studies, and the overnight train problem in this study.
The comparisons of the previous last/first-train studies, and the overnight train problem in this study.
Contribution
Based on the literature review above, the last and first train problems are studied independently with different objectives. This study proposes a novel strategy, which schedules overnight trains as a bridge to coordinately minimize the number of transfer failed passengers for last train service and the transfer waiting time for first train service. The contribution of this study can be summed in the following.
We propose a solution to improve service levels for both last and first train services, which schedules overnight train on each line in the urban subway network that departs its depot after the last train to serve some failed transfer directions, and stays at a station during non-service hours, finally continues to finish the remaining trip before the first train.
We propose a space–time network to formulate the overnight train schedule and passenger assignment. In the proposed space–time network, candidate overnight train traveling and stopping arcs are built to represent the possible overnight train schedule, including the departure time from the depot at night, overnight stopping station, and another departure time from the stopping station in the early morning.
A MILP model is proposed to optimize the overnight train schedule and simultaneously assign passengers to evaluate the overnight train schedule. The proposed MILP model can be directly solved by CPLEX for simple case. To handle large-scale case, for example, Beijing Subway Network, we propose a Lagrangian-based decomposition and solution framework, within which the original model can be decomposed into two space–time path-searching sub-problems and a semi-assignment problem, which can be efficiently solved for large-scale cases.
The remainder of this article is organized as follows. The “Key concepts for model formulation” section presents some key concepts for model formulation, including the problem statement, construction of the space–time network for existing timetables, and possible overnight train schedule. The “Model formulation and solution approach” section formally proposes the MILP model for the overnight train scheduling problem and a LR decomposition and solution framework to decompose the MILP model into sub-problems. The proposed MILP model and solution algorithm are demonstrated through a simple case and a real-world case based on Beijing Subway Network in the “Numerical examples” section. The “Conclusions” section summaries the findings.
Key concepts for model formulation
Notations
The notations used in this article are listed in Table 2.
Indices, sets, parameters, and variables.
Problem statement
We propose a novel strategy to improve service levels for both last and first train services, which schedules overnight train on each line that departs a depot after the last and stays at a station for non-service period and continues to finish the remaining trip before the first train. Therefore, the study problem in this article is stated formally in the following. Given (a) physical urban subway network, (b) current timetables at night before (including) the last and in the early morning after (including) the first train, and (c) according to the passengers demand at night and in the early morning, we aim to determine the overnight train schedule, including departure time from the depot at night, overnight stopping station, and another departure time from the stopping station in the early morning, to minimize the number of failed transfer passengers for last train service and the transfer waiting time for first train service in an urban subway network.
Space–time network construction based on the current first and last train services
A space–time network representation has been widely used in transportation route optimization, various scheduling applications, and general dynamic network flow modeling.21,31 Considering a physical urban rail transit network with a set of nodes (stations) N and a set of links L (segments between adjacent stations) shown in Figure 4, each link can be denoted as a directed link
Waiting arcs
Existing traveling arcs
Transfer arcs
Dummy arcs
Penalty arcs

Physical urban subway network.

Space–time network construction.
In the proposed space–time network, the cost of waiting, traveling, and transfer arcs are set as the actual time cost. The costs of dummy arcs are set as minimum values, that is, 0.01. And the costs of penalty arcs are set as very large values, that is, 10000. Therefore, passengers will choose the shortest feasible path in the space–time network, when the total traveling cost of all passengers is minimized in the objective function.
For illustration purpose, we offer a timetable (Table 3) for last and first train services based on the given physical urban subway network (Figure 4), and corresponding space–time network can be built as shown in Figure 5. All the travel times of all links are set to be one-time unit. Dummy arcs and penalty arcs are also shown partially in Figure 5.
The timetable of current last and first train services.
Constructing candidate arcs in the space–time network for scheduling overnight trains
To schedule overnight trains in an urban subway network, candidate overnight train operations arcs need to be further built into the space–time network. We construct the candidate overnight operations arcs into the set E. Two types of overnight train operation arcs should be built.
Candidate traveling arcs
Candidate stopping arcs
Figure 6 shows the construction for candidate overnight train operation arcs on Line 1.

Space–time network with candidate overnight-train operation arcs.
Benefit analysis based on the illustrated example
As stated above, Figure 4 depicts a simple physical urban subway network with eight stations and three lines, and Figure 5 shows the space–time networks constructed based on given timetables of last and first train services listed in Table 3. We assume an overnight train schedule plan on Line 1 as shown in Table 4.
An overnight train schedule plan on Line 1.
Figure 7 shows the space–time network with an illustrated overnight train service plan. To demonstrate the benefits of scheduling the overnight train, we load three passenger groups into the space–time network with specific volume, origin–destination (OD) pair, and departure time (Table 5). For last train service, passenger groups 1 and 2 can arrive at their destinations only when the overnight train is scheduled on Line 1. For first train service, the total waiting time can decrease from

Space–time network with an illustrated overnight train service plan.
The comparison of travel time between two situations.
OD: origin–destination.
Model formulation and solution approach
In this section, we formally propose the optimization model for the overnight train scheduling problem in an urban subway network and its solution approach.
Model formulation
We aim to minimize the number of failed transfer passengers for last train service and minimize the transfer waiting time for first train service by adopting the strategy of scheduling the overnight train on each line in an urban subway network. Two sets of passengers are taken into consideration: one set denotes passengers departing their origins at night, who concern that whether they can arrive at their destinations successfully; another set denotes passengers departing their origins in the early morning, who concern that whether they can avoid long transfer waiting time and arrive at their destinations as fast as possible. Typically, we adopt the linear weight method to handle these two sets of problems, and introduce
Objective function
Subject to,
Passenger flow balance constraints
Overnight train flow balance constraint
Passenger flow and overnight train flow coupling constraints
Binary variable constraints
The first part of the objective function (equation (1)) aims to minimize the total travel time of passengers at night. The second part of the objective function gives penalties to passengers who cannot arrive at their destinations due to failed transfers. The third part of the objective function aims to minimize the total travel time of passengers in the early morning. Equations (2) and (3) give the standard passenger flow balance constraints. Overnight train flow balance constraint is formulated in equation (4). Equations (5) and (6) define the coupling relationship between passengers and overnight trains. Equations (7)–(9) define the binary variables for the model formulation.
Considering about the maintenance time window
Considering that the maintenance operations at certain stations during the night would affect the service of the overnight train. Therefore, we further consider the maintenance time window constraint in our proposed model. In previous, many researchers studied the problem of connection between train dispatching and maintenance operations. Zhang et al. 32 formulated an MILP model to select the time window of the regular maintenance on high-speed railway; the objective of the model is to minimize the total travel time of sunset-departure and sunrise-arrival trains (SDSA-trains). Aken et al. 33 proposed an MILP model to solve the Timetable Adjustment Problem, which can get an alternative timetable with re-timing, re-ordering, short-turning, and cancelation under the condition of maintenance. Lidén et al. 34 proposed a mixed integer programming model to minimize the total cost of maintenance and train operations which coordinate the railway maintenance and train traffic.
In this article, we schedule the overnight trains to minimize the number of failed transfer passengers for the last train service and minimize the transfer waiting time for the first train service; therefore, the overnight train must stay in a station for a whole night. In actual, not all stations can offer the stopping operation because of the maintenance operation. In order to avoid the conflict between the train schedule and maintenance time window, the maintenance constraint can be further formulated into the proposed model as follow
In this equation,
Problem decomposition
In this section, we propose an LR framework to solve the model. We set up a multiplier
Objective function
Subject to constraints (2)–(4) and (7)–(10).
The above problem can be decomposed into three sub-problems
Sub-problem
Objective function
Subject to constraints (2) and (7).
Sub-problem
Objective function
Subject to constraints (3) and (8).
Sub-problem
Objective function
Subject to constraints (4), (9) and (10).
Solution process
Based on the model decomposition, we propose a LR-based solution framework to solve the proposed model iteratively. The specific procedure is described as follows:
In the LR framework, sub-problems

The solution framework based on Lagrangian decomposition.
Numerical examples
In this section, we construct a simple network and solve it by the proposed optimization model with both CPLEX solver and the LR-based solution approach. To demonstrate the advantages of the LR-based solution approach, we compare the computing time and gap between these two approaches.
A simple case
In this section, we initially test our proposed model and solution approach in a simple case. As shown in Figure 9, the test network contains 4 bi-direction lines and 16 stations. The minimum time interval is 1 min in the simple case; and the study time horizon is 60 min. The train capacity is set to be 1000 (because the train capacity is enough at night and in the early morning), and two sets of input passenger demand are listed in Tables 6 and 7. The timetables of existing trains for the last and first train services are listed in Table 8.

The physical urban subway network.
The demand of the last train service passengers.
OD: origin–destination.
The demand of the first train service passengers.
OD: origin–destination.
The timetable of existing trains.
In the simple case, we input a set of 72 passengers and 32 current trains. Four overnight trains are to be scheduled in four lines (Line 3 up direction, Line 3 down direction, Line 4 up direction, and Line 4 down direction). The simple case can be directly solved by CPLEX solver, from which the optimal schedules of the four overnight trains can be obtained are shown in Table 9. Figure 10 shows the space–time network, including space–time arcs of existing first and last and overnight trains.
The results of overnight trains.

The corresponding space–time network of the simple case (only train service arcs are shown).
We compare four indicators between the timetables with and without overnight trains, based on the same input demand, as shown in Table 10 and Figure 11. For the last train services, all eight passengers who cannot arrive at their destinations due to failed transfers can successfully complete their trips if the overnight trains are scheduled. For the first train services, the total travel time and waiting time of all passengers in the early morning can be decreased by 28.7% and 38.6%, respectively.
The comparison results of the simple case.

The comparison results of the simple case.
Then, we use the proposed LR-based solution framework to solve the same case for 100 iterations, from which the lower bound values can be obtained as approximate solutions. Figure 12 shows the optimal lower bound values for 100 iterations, from which a small gap 1.49% is reached between the optimal value and the lower bound value after 100 iterations. Therefore, the proposed LR-based solution framework can obtain the approximate optimal value compared with the optimal value obtained by CPLEX solver with a large amount of computing time saved, especially for more large-scale case. Table 11 compares the efficiency between CPLEX and Lagrangian-based decomposition method.

Lower bounds and optimal value for each iteration.
The methods efficiency comparison.
Considering the trade-off between the cost of the overnight trains and value of the objective, we do a test to analyze the relation between them. In the test, we remove different numbers of overnight trains to find the changes of the objective value. The cost of the overnight trains can be defined as a linear function (equation (15)) depending on their operational time, including traveling time between stations
Table 12 presents the value of the objective when some overnight trains are removed, and we set
The comparisons in five situations.
A real-world case
In this section, we apply the proposed model and LR-based solution approach into the Beijing Subway Network. The structure of Beijing Subway Network is shown in Figure 13, which includes 17 lines, 343 stations, and 3168 links in the physical network. The first train usually begins after 5:30 and the last train stops before 24:00 on each line. Therefore, we select the passengers who depart their origins after 22:00 as input passenger demand for last train service, and passengers who depart their origins before 6:00 as input passenger demand for the first train service. We assume that two overnight trains can be scheduled on each line, in the up and down direction, respectively, and the overnight trains can choose to stop at the stations which have no maintenance operation along the line during non-service period. In actual application, operators can determine some candidate stations to offer the opportunity for the overnight stopping operation of the overnight trains, which can be carried out by constructing candidate stopping arcs at allowable stations.

The Beijing subway network (17 bi-direction lines, 343 stations, 52 transfer stations).
The passenger demand data are obtained from the smart card AFC system, and the total number of passenger demand in this case study is more than 30,000. Therefore, we group passengers according to their OD pairs and departure times. The capacity of each train is set to 1500. On account of the large number of vertices and arcs built in the space–time network, the scale of the Beijing Subway Network case is more extensive than the simple case tested in the section “A simple case.” It is impossible to solve the Beijing Subway Network case with CPLEX, so we use LR-based solution approach to solve it. We code the algorithm in Matlab platform with a PC (CPU: i7-7700HQ 2.80 GHZ with eight threads, 16 GB RAM) and run it for 20 iterations within about 5 h. We depict the schedule overnight trains in Figure 14 using the red and green triangles to denote the overnight stopping stations, and the two times near each triangle denote the starting and ending times of the overnight stopping operation for each overnight train. For example, the schedule of the overnight train in the up direction on Line 6 can be explained as follows: (1) the overnight train departs from Haidianwuluju Station (depot of Line 6) after the last and arrives at Beihaibei (BHB) station at 23:44; (2) the overnight train stops at BHB station from 23:44 to 5:12 for the non-service period; (3) the overnight train departs BHB station at 5:12 before the first train and finishes the remaining trip on Line 6.

Optimized overnight train schedule plan.
The comparison results are shown in Table 13 and Figure 15. In the Beijing Subway Network case, we can increase additional 8091 passengers (increased by 92.2%) to arrive at their destinations by scheduling overnight trains on each line for the last train service. The total travel time and total waiting time of passenger in the early morning can be decreased by 7.8% and 13.4%, respectively.
The comparison results of the Beijing subway case.

The comparison results of the Beijing subway case.
Conclusions
In this article, we propose a novel optimization model to schedule the overnight trains in an urban subway network. Compared with the last and first train problems,4,24 this study introduces the concept of the overnight train that departs the depot after the last and stops at the station for non-service period and continues to finish the remaining trip before the first train, which can benefit both first and last train services in the subway network, specifically, to minimize the number of failed transfer passengers for last train service and the transfer waiting time for first train service. Then, we formulate the overnight train scheduling problem as a MILP model based on a well-designed time-discretized space–time network, which can be directly solved by CPLEX for small cases. To handle large-scale applications, we propose a LR-based decomposition and solution framework, which decomposes the original model into three sub-problems and solve them parallelly. The proposed model and algorithm are evaluated by a small case and a large-scale case based on the Beijing Subway Network. Results show that the proposed model can improve service levels for both last and first train services. For example, we can increase additional 8091 passengers (increased by 92.2%) to arrive at their destinations by scheduling overnight train on each line for the last train service. The total travel time and total waiting time of passengers in the early morning can be decreased by 7.8% and 13.4%, respectively. In future research, we will consider multimodal public transport cooperation and integrate regular trains, night trains, and buses to study a large network to meet the growing needs of passengers.
Footnotes
Acknowledgements
The fourth author would like to thank the support from the China Scholarship Council and the Innovative Practice Program for Graduate Students of Tsinghua University, China.
Handling Editor: James Baldwin
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research is support by the project “Improving the technology of railway passenger and freight transport efficiency and service level” (Number: 2018YFB1201402).
