Abstract
Train timetables provide trains’ departure and arrival times at each space node, and electric multiple unit circulation and maintenance schedules assign the tasks of trips and maintenance to electric multiple units. Forming two schedules independently could bring infeasible solutions in both phases of forming and practice, so the purpose of this study is to avoid infeasibilities and generate a better integrated solution. To illustrate the two problems in one mathematical model, we introduce a space–time–state framework, which can show not only electric multiple units’ trajectories, but also their accumulative running distance (the core factor in maintenance) as the state dimension simultaneously. Due to the occurrence of the disruptions, delays might be caused in both trains’ traveling and maintenance. Therefore, the buffer time should be inserted into the activities such as running in sections, electric multiple unit circulation and maintenance in order to guarantee robustness. A 0-1 nonlinear integer programming model is built, which integrates the formulations of both robust train timetabling and electric multiple unit circulation and maintenance scheduling problems. It is verified by GAMS solver within small-scale instance. However, due to the large scale of the real-world cases, the GAMS solver cannot deal with that in a receivable computational time. In order to solve this integrated model effectively, we propose an improved ant colony algorithm. This algorithm provides solutions not only as good as GAMS in small-scale cases, but also of high quality in large-scale cases. We obtain the robust train timetables and electric multiple unit assignment and maintenance schedules of Beijing–Shanghai high-speed railway in a relatively short time using the proposed ant colony algorithm.
Keywords
Introduction
In recent years, due to the high safety and efficiency of high-speed railways (HSR), more and more passengers are attracted to take its services. Also the studies on train timetabling and electric multiple unit (EMU) circulation and maintenance scheduling in HSR are becoming more focused. Traditionally, railway corporations construct these two schedules independently. Train timetables are generated first with the input data of line plans, and then EMU circulation and maintenance schedules are made based on train timetables. In this way, a good train timetable might be obtained. But some infeasibilities could also be brought into the EMU circulation and maintenance schedules. Therefore, we propose an integrated model of train timetabling and EMU circulation and maintenance scheduling. The terminologies of the line plan, the train timetable, and the EMU circulation and maintenance schedule are illustrated as follows.
Line plans specify a set of routes (paths) in a network of tracks, operated at a given frequency. 1 It serves as the input data of timetabling.
For example, Figure 1 shows the line plans of weekdays and weekends that are made based on the passengers’ demand data.

Line plan of Friday and Saturday.
Train timetables define trains’ arrival and departure times at yards, terminals, and sidings along the routes of trains. 2 Based on the line plan shown in Figure 1, the train timetables of Friday and Saturday are displayed with the space–time graph in Figure 2.

Train timetables of Friday and Saturday.
EMU circulation and maintenance schedules assign the tasks of trips and maintenances to EMUs, aiming to minimize the total operating cost. The blue and orange lines in Figure 2 can be regarded as tasks of train trips. Once EMU’s cumulative running distance is near to a specified value, it must be sent to the depot to undertake maintenance. The maintenance will take at least several hours represented by the red block in Figure 3, during which EMUs are unavailable for working. After maintenance, its accumulative running distance is set to zero again. Before the end of the day, EMUs have to return to its belonging depot after finishing all today’s work.

EMU circulation and maintenance schedule.
Figure 3 also presents the minimum turn-around time. After EMU completes a task trip, it needs some time to do the preparation for the next trip, such as cleaning the cars and checking the EMUs’ statuses.
There is some relevant literature about line plans, train timetables, and EMU circulation and maintenance schedules (we call them rolling stock schedules in conventional railways).
Goossens et al. 1 focused on the line planning with the aim of decreasing the total operating costs. It was solved by a branch-and-cut approach, which was developed using a variety of valid inequalities and reduction methods. Lin et al. 3 proposed an integer programming model and a systematic approach to determining the optimal train stopping patterns for a railway company. Then an integer-coded genetic algorithm with new encoding mechanism and genetic operators was proposed, which was used to solve real-world problems in Taiwan.
In the train timetabling field, Zhou and Zhong2,4 and Niu et al. 5 made many contributions to the modeling and proposed effective algorithms. These three papers dealt with train timetabling problem in single-track, double-track, and railway corridor scenarios, respectively, aiming at minimizing the waiting and traveling times of trains and passengers. Branch-and-bound and Lagrangian relaxation technologies were utilized in the proposed algorithms.
Kroon et al. 6 studied on rolling stock rescheduling undertaken. Also Nielsen et al. 7 presented the online rolling stock rescheduling based on the dynamic passenger flows. Moreover, it was performed on real-life instances of Netherlands Railways, with different settings for the trade-offs between solution quality and computation time.
Papers with respect to both line plans and train timetables are listed below.
Yang et al. 8 focused on collaborative optimization of the line plan and the train timetable generation. They built a multi-objective mixed integer linear programming model on a single-track HSR corridor and then used GAMS to solve it.
Yue et al. 9 aimed to develop train timetables to take full advantage of the HSR system’s capacity. They proposed a column-generation-based heuristic algorithm to simultaneously consider both passenger service demands and train scheduling. Finally, they optimized stopping patterns and schedules in Beijing–Shanghai high-speed railway.
Kaspi and Raviv 10 formulated an integrated line planning and timetabling model with the objective of minimizing both user inconvenience and operational costs, which was solved using a cross-entropy metaheuristic. The method was testified in Israel Railways as a benchmark, with an average 20% reduction in passengers’ traveling time.
In this article, we integrate the optimization of train timetables and EMU circulation and maintenance schedules. Besides the advantage of avoiding infeasible solutions, we also consider both directions of trains’ trajectories. However, in some preceding literature it is assumed that trains’ trajectories are the same and independent in the two directions, so the trajectories are solved only in one direction.
Table 1 shows some literature focusing on the line plan, train timetable, and rolling stock schedule or any two of them together. For example, the contents of the cells under the Line planning row and the Line planning column indicate that the corresponding papers study only line planning. The contents of the cells under the Train timetabling column and the Line planning row indicate that these papers focus on both train timetabling and rolling stock scheduling.
Focus of the literature.
With respect to the robustness of the timetable, Bešinović et al. 11 presented a framework for timetable design which combined a microscopic and a macroscopic model to generate a feasible and stable timetable with the trade-off between minimal travel times and maximal robustness. In this article, we insert a suitable buffer time into traveling and maintenance activities.
The contributions of this article are listed as follows:
We build a mathematical model integrating both train timetabling and EMU circulation and maintenance scheduling problems. Moreover, we introduce the time–space–state framework to represent EMUs’ instant trajectories and the state of accumulative running distances (the core factors in maintenance).
Finally, we obtain the train timetable and the EMU circulation and maintenance schedule simultaneously with more robustness and less EMUs than the traditional methods.
Our model includes more constraints of EMUs’ management in reality: (1) all EMUs must return to their belonging depots at night; (2) all EMUs must get maintenance after running for a certain running distances. These two constraints make the model more difficult to build or even generate infeasibilities in the solving process.
We consider both running directions of trains, as in the real world the trajectories of two directions might not be symmetrical, but they have some relations with each other.
Aiming to obtain the result effectively and efficiently, we propose several improvements to traditional ant colony algorithm. In practice, the problem cannot be solved by GAMS directly due to the large scale, so the improved ant colony is designed.
In the remaining parts, the advantages of integrating the train timetable and the EMU circulation and maintenance schedule are described in detail in section “Problem description.” The mathematical model is then demonstrated in section “Model description.” Section “Illustrative example” gives an illustrative example to testify the mathematical model. The algorithm used in the large-scale problem is proposed in section “Solution algorithm.” Section “Numerical experiment” studies the real-world cases and then we present the conclusions in section “Conclusion.”
Problem description
Currently, railway corporations construct train timetables and EMU circulation and maintenance schedules following a process shown in Figure 4(a). It means that the timetable is viewed as the input in the EMU circulation and maintenance scheduling even though there is a feedback to the timetable at last. Both of these plans are finally constructed through several iterations of the same process. However, from Figure 4(b) it is observed that our approach solves these two problems in an integrated way. They are generated at the same time without any feedbacks. We make a comparison between these two methods through a simple case from Figures 5–9.

(a) Conventional method and (b) proposed method.

Example of line plan.

Example of train timetable.

Example of EMU circulation and maintenance schedule.

The train timetable.

The EMU circulation and maintenance schedule.
There are four stations along the railway line. Stations A and D have EMU depots for maintenance. Figure 5 shows the trajectories and stopping patterns of six trains in the line plan. Based on the line plan, the train timetable (in Figure 6) gives trains’ departure and arrival times at each station. Then the timetable is viewed as the input of EMU circulation and maintenance schedules. From Figure 7, it is observed that at least three EMUs are needed to perform task trips. However, there would be the possibility of improvement.
In Figure 6, the blue circle indicates that even if the two trains do not have conflicts, their arrival and departure times are too “close.” Hence, if the arrival of the preceding train is delayed, the next departure train will be affected. Moreover, in Figures 6 and 7, the purple circles indicate that these trips can share the same EMUs, and then the total cost of EMUs can be saved.
Finally, if we solve these two schedules in a traditional way, even though the train timetable is generated with less traveling time, it might bring risks of delays in turn-around or additional costs in EMU circulation and maintenance schedules. Therefore, we should try to solve them in an integrated way.
When we integrate these two schedules, the results are shown in Figures 8 and 9, in contrast to Figures 6 and 7, respectively.
From Figures 8 and 9, we can save one EMU and increase robustness in the turn-around period. If we are faced with a more extreme situation that the EMUs are insufficient for the train timetable in Figure 6, only constructing train timetables and EMU circulation and maintenance schedules together could generate a feasible solution.
Our process of the integrated method is shown in Figure 10. It indicates that the physical railway network and line plans are seen as the input data, and robust train timetables and EMU circulation and maintenance schedules are the output.

Input and output of the method.
Model description
Notations and terminologies
For modeling clearance, Table 2 lists all the subscripts, input parameters, and decision variables used in this article.
Notations and definitions.
EMU: electric multiple unit.
Time–space–state graph can be adopted to present the real-time positions and running statuses of EMUs. The state dimension can be used to display the accumulative running distances of EMUs, which is the core factor in maintenance. There are two types of arcs in the time–space–state graph:
Traveling arcs, where s and s + 1 are two adjacent stations or depots;
Waiting arcs, where
For example, in Figures 11–13, the EMUs are traveling from the depot

Railway line.

Time–space–state graph of time from 0 to t + 4.

Time–space–state graph of time from t + 4 to t + 8.
Assumptions
Assumption 1. All the railway lines are double-track. The capacities of both tracks are sufficient.
Assumption 2. Deadheading between stations is not allowed.
Assumption 3. The EMU can undertake maintenance in any depots, but it must return to its belonging depot at the end of the day.
Assumption 4. The velocities of all the EMUs are the same. Namely, in each section, the running times of all the EMUs are the same.
Assumption 5. we do not consider the extra travel time caused by acceleration and deceleration in train timetable.
Assumption 6. Due to the specific station facility distribution, train speed, and signal system, we assume that headways for departure and arrival are the same. Therefore, only the headway for departure is considered.
Objective
Railway companies aim to operate trains with high robustness and low cost. To achieve these goals, we can maximize the robustness by minimizing the operational cost of possible delay and minimize the cost of using EMUs. Therefore, the objective function can be formulated as shown in equation (1). The
These two parts of the objective function can be presented as the following formulations
where
Let us consider the calculation of

Calculation of
Constraints
Headway constraint
To guarantee the safety of two adjacent trains in the same direction, the interval time between two departures should be greater than a regulation value

Explanation for headway constraint.
EMU maintenance constraints
EMUs must undergo maintenance before their accumulative running distances reach the maximum value. From equation (8), it can be observed that during any time period
where
Furthermore, maintenance must be performed at the depot within a specified time period
EMU turn-around connection constraint
It defines the minimum time between two consecutive task trips performed by the same EMU
Station (or depot) sidetrack capacity constraint
Capacity of the sidetracks in stations and depots is assured by this constraint
Flow balance constraint
This constraint maintains flow conservation of the EMUs at each node in the network. Three equations in (12) ensure the flow balance in origins, destinations, and intermediate stations, respectively
Task covering constraint
Trains must stop at intermediate stations ruled in the line plan to ensure the route accessibilities for passengers. Stop at the origins
Stop at the destinations
Stop at the intermediate stations
Train trips must travel in specified segments
The whole train trip must be finished by only one EMU
Illustrative example
There are three stations located in the railway line shown in Figure 16. Stations 1 and 3 own depots. Three EMUs are belonging to the two depots, respectively. The numbers in Figure 16 represent the running distances and times, respectively. We consider the time period of 20 h, with the other parameters listed below (Table 3). The GAMS solver is used to solve this illustrative example to testify the feasibility of the mathematical model. As reported by Rosenthal, 12 in the GAMS user guide, the GAMS model representation is in a form that can be easily read by people and by computers. This means that the GAMS program itself is the documentation of the model.

The railway structure.
Parameters in the illustrative experiment.
What is more, from Wikipedia 13 the GAMS system is available for use on various computer platforms. Models are portable from one platform to another. And it has users from various backgrounds, from economics and management science to engineering and science (Table 4).
The belonging EMU and sidetrack number of depots.
EMU: electric multiple unit.
As shown in the line plan (Tables 5 and 6), “•” represents the stations for passengers’ pickup and drop-off, which could be the origins, destinations, or intermediate stations; “–” indicates that those stations are not in the trains’ routes.
The line plan of the up direction.
The line plan of the down direction.
Due to the existence of the nonlinear objective function and six dimensions of variables
Comparison between two calculation methods.
So we only show the feasible solution in Figure 17 to demonstrate that the model is feasible. The numbers above the lines are the index of train task trips. Finally, we need three EMUs to perform the tasks in the train timetable.

Solution generated by GAMS.
Therefore, we need a more effective algorithm to get a receivable good solution, which will be introduced in section “Solution algorithm.”
Solution algorithm
To fully address the NP-hard large-scale train timetabling and EMU circulation and maintenance scheduling problems in the real world, we have to propose an improved algorithm to ensure a relatively optimal result and the receivable computational time.
Terminologies and calculations of parameters
The ant colony algorithm is proposed as a new metaheuristic approach for solving hard combinatorial optimization problems. In railway filed, most of the literature uses ant colony algorithm to deal with complex problems: timetabling, 14 rolling stock planning, 15 railroad blocking problem, 16 and rescheduling. 17 In this article, we improve the ant colony to solve integrated timetabling and EMU circulation and maintenance scheduling problems. Terminologies and calculations of parameters are illustrated as follows.
Conflicts
For train
Enter the depot
If EMU cannot go back to the depot before the end of the day
If
These operations aim to ensure that
Choosing rule
It is a rule about how to choose the next train task trip of EMUs. The candidate tasks should be those that have not been carried out by any EMU before, and their departure station must be e’s last train task trip l’s arrival station. These candidate trips constitute a candidate set
Update pheromone
For every two train task trips in this solution, their corresponding pheromone increases by
Evaporate pheromone
Every pheromone will decrease by a certain percentage in each iteration.
Revise the buffer time
At the start of the iterations, the buffer time should be set as the same relatively large value. In the real world, delays occur most frequently in the turn-around period, then in the maintenance period, and least in the running period. To save the capacity, we decrease the buffer time step by step in the following sequence: first, decrease buffer between headway, then maintenance, and finally turn-around.
if (
else if (
else if (
Limit pheromone
If the pheromone exceeds the maximum pheromone, then we set the pheromone to the maximum value. Similarly, it will be set as the minimum value when it is less than that.
The pheromone

(a) and (b) Definition of pheromone.
Algorithm steps
The main steps of the proposed ant colony algorithm are as follows: (1) obtain the initial solution and (2) get the relative optimal solution by iterations.
Initial solution
(1) Initialize all pheromones with one initial value. Let
(2) For e = 1 to number of EMUs do
From the train trip candidate set, we get one
while
We continue to choose another train trip randomly, which departs from l’s arrival station. Then we denote it as
if (
e enters this depot to do maintenance.
else
We set
while (
End while
If
Else
e
End while
End for
(3)
(4)
Initialize the pheromone of each train.
Iteration
During the generation of the solution, two approaches can speed up the solving process and convergence.
Approach 1. If the train with long traveling time departs late, little time might be left for the following trains to use. For example, in the purple part of Figure 19, due to the late departure of train 1, the following train’s arrival time might exceed the end of the timetable. Therefore, we should arrange the long-distance train to depart as early as possible.
Approach 2. If the best solution’s objective value does not vary for many iterations, all the pheromones should be reset.
The iteration part is shown as follows:
For r = 1 to number of iterations do
For a = 1 to number of ants do
For e = 1 to number of EMUs do
Choose one train task trip by
Set its departure time at the start time of the timetable.
while
we choose another train task trip randomly, whose departure station is l’s arrival station, then defined as
if (
e enters the depot to undertake maintenance.
else
We set
while (
End while;
If
define
Else
e
End while
End for
If some train task trips are not carried out by an EMU, then
If the solution is better than the best solution, then restore it as the best solution;
If the best solution is the same for some iterations, then initialize the pheromones.
End for
End for.

Approach to speed up the solving process.
Comparison and analysis with GAMS
To compare with the result of the illustrative example, we list the solution generated by the improved algorithm below, with smaller EMU number than that produced by GAMS.
Trains’ trajectories are also shown below (Figure 20).

Solution generated by the developed ant colony algorithm.
The proposed algorithm could get a relatively good solution with shorter time and less computational resources. That is suitable for railway corporations in practice, which prefer more efficiency in calculation to costing much time to obtain the optimal solution, especially in the complicated Chinese HSR networks.
Numerical experiment
Background
In this part, we tackle the sophisticated train timetabling and EMU circulation and maintenance scheduling problems in Chinese HSR. The railway network consists of one main line (thick line in Figure 21) and seven feeder railway lines. Depots located on the mainline or feeder lines are equipped with 20 or 10 sidetracks, respectively. The two biggest stations Beijing and Shanghai have 30 sidetracks and others 20. The traveling time between the stations and the nearest depots is 10 min.

Railway network structure.
Because all of the trains are running on the main line, we consider only the trains’ departure and arrival times on the mainline. Then the departure and arrival times of feeder stations are easier to determine in practice.
The information on our computer’s CPU and RAM is as follows: the CPU—core i7-4770 3.40 GHz, and RAM—16 GB DDR3 1600 MHz.
Table 8 provides the running distance and time in each segment. Table 9 shows the line plan. The ant number is set to 30 and the iteration number is set to 30.
Running time and distance in segments.
The line plan.
Result
Five convergences of solutions are displayed in Figure 22.

Convergence graph.
From Table 10, the absolute gap between the minimum and maximum values is 1 and the relative gap is less than 1%. The computational time is nearly 21 sec for each calculation.
Five results of solutions.
The result of the best solution is shown in Figure 23, with 43 EMUs needed. The red connection lines represent the maintenance work and the green lines represent turn-around.

The result of the numerical experiment.
Conclusion
In this article, we build an integrated train timetabling and EMU circulation and maintenance scheduling model based on the space–time–state structure. The mathematical model is solved by an improved ant colony algorithm effectively and efficiently. In contrast to the separate train timetabling and EMU circulation and maintenance scheduling models, the proposed model and the algorithm have the following improvements.
Using the time–space–state framework, we can construct both train timetable and EMU circulation and maintenance schedule simultaneously, which is more optimized than the traditionally independent method in EMU number and robustness of turn-around, maintenance, and headway.
Through the illustrative example and numerical experiment, it is implied that our algorithm can save time and memory to get a relatively good solution. Moreover, facing the real-world problem with a large scale, the algorithm can also exhibit good performance.
Footnotes
Handling Editor: Fakher Chaari
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 work was financially supported by the Fundamental Research Funds for the Central Universities (No. 2014JBZ008) provided by the Ministry of Education of the People’s Republic of China and Major Project of Science of China Railway Corporation (No. 2016X006C).
