Research Article  Open Access
Yajing Zheng, Wenzhou Jin, "Optimization Method of Locomotive Working Diagram Layout", Journal of Advanced Transportation, vol. 2019, Article ID 1315638, 9 pages, 2019. https://doi.org/10.1155/2019/1315638
Optimization Method of Locomotive Working Diagram Layout
Abstract
Rational scheduling of locomotive paths (the locus of the locomotive point in the train working diagram) is an important step in drawing a locomotive working diagram by a computer. But there are some problems in this process, such as the computer usually drawing a locomotive path that overlaps with another locomotive path (in the circumstances, the actual users of the locomotive working diagrams often misread the locomotive planning). At present, there are many studies about assigning sets of locomotives to each train in a preplanned train schedule; in contrast, the studies of visualizing the locomotive planning are relatively rare. Through investigating the locomotive working diagram users, this paper points out that the layout of locomotive paths should put the distance between lines being as large as possible and should put the number of the intersection between lines being as few as possible as the optimization aim which is based to solve the problem of the lines overlap or the problem of the lines beyond the margins for drawing the locomotive paths. This paper also builds the optimization model of locomotive working diagram layout. Based on determining the position of locomotive paths which can be delineated, a genetic algorithm is used to solve the optimizing model of locomotive working diagram layout in this paper. An example of a train working diagram with 36 trains is given at the end of the paper, which indicates that the optimization model of locomotive working diagram layout can better solve the problem of locomotive planning visualization.
1. Introduction
Chinese railways now not only have the computational ability for automatic train scheduling [1–3], but have also made relatively good progress in automatically compiling locomotive scheduling ([4, 5]). Locomotive scheduling involves optimally assigning a set of locomotives to trains while simultaneously satisfying a variety of business constraints and minimizing the total scheduling cost [6–8]. It is usually composed of twostep process: ① assigning sets of locomotives to each train in a preplanned train schedule (it is also commonly referred to as the locomotive planning problem, [9, 10]); ② visualizing the locomotive planning to the locomotive working diagram (a graphic form of locomotive planning).
Previous research in this field has focused mainly on step 1 (for example, Ghoseiri and Ghannadpour [11] consider the locomotive planning problem with homogeneous locomotives; Nourbakhsh and Ouyang [12] and Raviv and Kaspi [13] study the optimal fueling strategies for locomotives; Piu and Speranza [14] give a comprehensive review on the locomotive planning problem; Xu et al. [15, 16] make train timetabling and locomotive planning decisions simultaneously), whereas studies on step 2, which is just as important, remain fairly scarce.
However, addressing the key theme of this paper visualizes the locomotive planning and depends essentially on optimizing the graphic representation of the locomotive planning. Although the problem resembles the train flow diagram (a train flow diagram is a direct graphic form which shows the category, path and number of all kinds of passenger, and freight train flow in railway network, which includes railway network and train flow line [17–19]), given the very different approach that needs to be taken in this case, available train flow diagram solutions cannot be adapted to the problem of locomotive planning visualization.
The locomotive path, which includes the train paths and the connection lines (a connection line means a locomotive from an inbound train to an outbound train at the same station in practice), is the locus of the locomotive point in the train working diagram. The difficulty in visualizing locomotive planning is that quantifying the layout of connection lines. Consequently, this paper proposes a method for automatically optimizing locomotive working diagrams based on a detailed investigation into the practices actually employed by those who use the locomotive working diagram. This method can contribute to making better and more systemic automatically generated the locomotive working diagram.
2. The Position of the Connection Lines
There are three drawing areas in the locomotive working diagram for positioning connection lines (as shown in Figure 1): ① the top (hereinafter referred to as “upper section”); ② the bottom (hereinafter referred to as “lower section”); ③ the middle (hereinafter referred to as “middle section”). In reality, depending on the situation, areas called “middle section” in this paper may not exist at all or there may be several of them at one time. For simplicity and actuality, this paper assumes that there is only one middle section. In general, as shown in Figure 1, each section is equal in height ( in this paper indicates the height of each section), and the line position of each connection line is a series of equally spaced horizontal lines in each section. In this paper, each horizontal line, representing the line positions, is numbered as shown in Figure 1. If represents the distance between adjacent horizontal lines, then (where in the formula is the maximum value of the horizontal lines’ number; this value is derived from the train schedule and the locomotive planning and is explained in detail in Section 3.2 of this paper).
Generally, a “complete” connection line consists of three segments (as shown in Figure 2): ① the initial segment of the connection line is the left vertical line (hereinafter referred to as “LL”); ② the middle segment of the connection line is the horizontal line (hereinafter referred to as “ML”); ③ the end segment of the connection line is the right vertical line (hereinafter referred to as “RL”).
(a)
(b)
(c)
(d)
The four types shown in Figure 3 show all the possible types of a “complete” connection line. In general, upper sections only display the type shown in Figure 3(a), while lower sections only display the type shown in Figure 3(b). Middle sections may display any of the four types. In order to automatically draw the four types of connection lines according to the locomotive planning on the basic train diagram, the most efficient approach is to confirm a location of the connection lines as drawing the ML of the connection line on the smallest number line position which does not conflict with any ML. In this paper, the above method is referred to as the “smallest distribution” method. However, applying the smallest distribution method to generate locomotive working diagrams by some diagrams editing systems in practice frequently produces cases where the LL or the RL overlap during parallel operation at both ends of a station (as shown in Figure 3(a), two RLs overlap as trains are dispatched simultaneously from this station at each end of the station).
(a)
(b)
(c)
(d)
This situation will affect the way that locomotive working diagram users interpret the locomotive planning; therefore, to avoid this becoming a problem, overlapping LLs or RLs can be handled in the way illustrated in Figures 3(b) and 3(c): ① Figure 3(b) swaps the position of the two lines representing the parallel operations and then adapts the other affected connection lines. ②Figure 3(c) adds a new line position, which is used to replace one of the connection lines in the parallel operation. The visual impact of these modifications on the locomotive diagram is clear: in Figure 3(b) the spacing between the MLs is larger, whereas in Figure 3(c), there are fewer crossover points between the connection lines. As such, there are two ways to solve the problem, in visualizing the locomotive planning, caused by parallel operations being conducted at both ends of the station. ① Maximize the spacing between each line position. ② Minimize the number of crossover points between connection lines. According to the data collected for this paper through surveys from the actual users of the locomotive working diagrams, the majority of respondents said that when there were fewer connection lines on the diagram, minimizing crossover points was more important than maximizing the space between lines, whereas the opposite was true when there were a large number of connection lines. Figure 3(d) is an optimized version of the diagram in Figure 3(a), where minimizing crossover points was more important than maximizing the space between lines. In addition, determining the number of the line positions before generating a planning diagram is a precondition to studying the optimization of visualizing the locomotive planning.
Therefore, the issue of visualizing the locomotive planning discussed in this paper can be summarized as follows: assuming that the locomotive planning is known, when adding the necessary connection lines to the train diagram, it is necessary to avoid overlapping LLs and RLs due to parallel operations at both ends of a station. To this end, it is necessary to ensure maximum spacing between adjacent MLs and minimize the number of crossover points between connection lines. In order to give this problem a general nature, for the purposes of this study a reallife locomotive planning (results of a train schedule) was used, which means that it was not a cycle diagram.
3. Mathematical Modeling
3.1. Symbol Definition
To facilitate explanations, the count time (start and stop time of the train working diagram) of the locomotive planning in this paper was set to 0:00. The symbol represents sections where connection lines can be positioned in the locomotive working diagram. In this paper, the value of is 0, 1, and 2 corresponding to the upper section, the lower section, and the middle section, respectively (if there are two or more middle sections, the value can be further increased). Let be the number set of the connection lines in the range of in a certain locomotive working diagram; any “complete” connection line () may consist of two lines shown in Figure 4 (in this paper, this is referred to as the four “basic lines”). For example, the connection line shown in Figure 2(a) is composed of two basic lines from Figures 4(a) and 4(c).
(a)
(b)
(c)
(d)
In general, if a connection line does not cross the count time 0:00, it consists of two basic lines in Figure 4, and if a connection line crosses the count time 0:00, it is constituted by one basic line in Figure 4. For convenience, in this paper, all the connection lines across 0:00 will be completed as being formed of two basic lines (generally speaking, there are two ways of completion; each can be chosen arbitrarily), so that all the connection lines will contain the following three attributes: ① , time corresponding to LL or start time of connection line , ② , time corresponding to RL or end time of connection line , and ③ representing the number of the line position of the connection line . Variables , , , and are defined as 01: if the connection line contains the types of line shown in Figure 4(a), . If the connection line contains the types of line shown in Figure 4(b), . If the connection line contains the types of line shown in Figure 4(c), . If the connection line contains the types of line shown in Figure 4(d), . Take the connection line in Figure 2(a) as an example: , , , and .
is the set of numbered line positions within section , according to the numbering rules of this paper, which define as offset multiplier relative to the horizontal line (the center of intermediate train distancing point).
Variable is defined as 01 within section ; if the connection line and the connection line have an overlap in time, apply 1; otherwise, apply 0.
Variable is defined as 01; if the connection line and the connection line are all in the range of and , apply 1; otherwise, apply 0.
Variable is defined as 01; if the connection line and the connection line are all in the range of and , apply 1; otherwise, apply 0.
Define 01 variable ; if the variable is 1, it means that within section , connection line will select line position . If the variable is 0, it means that connection line will not select line position . Then, clearly satisfies the relative formula .
Define the function ; when is true, , and when is false, . Table 1 summarizes the situation for all eight connection line crossover points.

3.2. Confirming the Line Positions
The premise for optimizing the layout of locomotive working diagrams is to confirm the line positions in each section, that is, to determine the largest in the set . This can be done following the steps set out as follows.
Step 1. Let , .
Step 2. Sort all and within section in ascending order by time, forming sequence ; when the time is the same, in addition to , should be ranked first, and in the other situations, the order can be determined randomly.
Step 3. Let , scanning time sequence sequentially; if is scanned, , . If is scanned, , .
Step 4. ; if the value of is larger than the number of the line positions on the locomotive working diagram, go to step 5. Otherwise, go to step 2.
Step 5. Construct the number set of the line positions in the range of , in which , .
At this point, the line positions of each drawing area have been determined, and that means the set is known.
3.3. Model Construction and Solution
3.3.1. Constraint Conditions
① One connection line can only select one line position:
② Connection lines cannot overlap
③ When , if two locomotives are engaged in parallel operations at both ends of a station, this is reflected in the locomotive working diagram; that is, the LL or RL of a certain connection line and the LL or RL of another connection line are at the same time, and it is obvious that the two vertical lines, which are at the same time, cannot overlap in the diagram.
Parameter is defined as 01; if and , apply 1; otherwise, apply 0. Define 01 parameter ; if and , apply 1; otherwise, apply 0. Parameter is defined as 01; if and , apply 1; otherwise, apply 0. There are four cases shown in Table 2.

3.3.2. Objective Function
① Minimum number of connection line crossover points:
② To improve the visual aspect of locomotive working diagrams, connection lines should occupy the smaller delineable line positions as far as possible:
3.4. Model Solution
The model constructed above in this paper is a nonlinear pureinteger programming model with multiple objects. These two objective functions are incommensurable, which means they have different units and cannot be solved by linear weighting methods effectively. However, these two objective functions can be solved using a delaminating sequence method in order of priority: First, solve the singleobject optimized model applying formula (3) as the objective function, and formulae (1) and (2) as constraint conditions. Then, under the conditions of the above calculation results, solve the singleobject optimized model, with formula (4) as the objective function, and formulae (1) and (2) as constraint conditions.
It is very difficult to obtain these solutions using this method with oftheshelf commercially available software (such as Lingo), and even if this kind of software could produce an optimal solution, the computation time required to reach the solution would be too long to be practically viable (take the 4th section of this paper for example; the layout of the connection lines in the middle section was generated by Lingo, with Intel Core i3 CPU and 4G memory, and it still took 4 hours to reach the optimal solution). To this end, the genetic algorithm is used to solve the model in this paper. Although it is impossible to guarantee that the output will be the optimal solution, it is effective enough for practical purposes. The algorithm is described as follows.
3.4.1. Chromosome Encoding and Initialization
Chromosome encoding uses digital string coding. In the drawing section, each chromosome represents one combination of all the selected line positions selected by connection lines. The number of chromosome genes is equal to the number of connection lines in the drawing area. The genes of each chromosome are sorted according to the given sequence of the connection line numbers, and each gene corresponds to the drawing area of the corresponding connecting line. For example, the chromosome “2, 1, 2” indicates that there are 3 connection lines, and the corresponding solution is , , . It means that the connection line numbered 1 corresponds to the line position 2, the connection line numbered 2 corresponds to the line position 1, and the connection line numbered 3 corresponds to the line position 2.
The integer is defined as the number of chromosomes in the population; at the beginning of the genetic algorithm, the chromosomes need to be initialized.
Step 1. Randomly generate an unmarked integer between 1 and .
Step 2. According to the smallest distribution method, draw the connection line to the smallest line position label that does not conflict with other connection lines. And the labeling value of the line position was filled in the corresponding position of the chromosome.
Step 3. Mark the integer .
Step 4. Verify if all integers in 1100 are marked or not. If so, turn to Step 5; otherwise, turn to Step 1.
Step 5. The obtained chromosomes are tested and placed into the initial population if the constraints of Section 2 model construction are satisfied. Otherwise, restart the first step to construct a new chromosome. When the initial population reaches the size of a chromosome, the initialization of the population is completed.
When the initial population reaches chromosomes, the population initialization stage is complete.
3.4.2. Calculation of Chromosome Fitness
First, calculate the value defined by the following formula for each chromosome, which reflects the pros and cons of the two objective functions of a certain chromosome:
In the formula, is a sufficiently large real number, set at 10,000 in this paper.
Then the chromosomes are sorted according to their value (ascending) to obtain the chromosomal sequence . Then the orderbased evaluation function is defined:
In the formula, means the chromosome is best, and means worst.
3.4.3. Chromosome Selection Process
The chromosome selection process is based on its fitness; the greater the fitness of a chromosome, the greater the probability that it will be selected. The selection process steps are as follows.
Step 1. For each chromosome , calculate the cumulative probability :
Step 2. Generate a random number from the interval .
Step 3. If , select chromosome as No. .
Step 4. Repeat step 2 and step 3 for a total of times to obtain replicated chromosomes.
3.4.4. Chromosome Crossover Operation
Define as the probability of a crossover operation, indicating an average of chromosome crossover operations in each population. The crossover operation uses a partial matching crossover method, so the chromosomes after crossover must be viable. Since chromosome genes are sorted according to the number of connection lines, crossover operations are performed as follows.
Step 1. Generate a random number between from to repeatedly; if , choose as a parent.
Step 2. Pair the parents generated in Step 1 into groups randomly.
Step 3. Generate a random integer between randomly, then select a group of parent chromosomes that have not been selected in Step 2, and swap all the genes of these two chromosomes from to the end, as shown in the Figure 5.
If the generation of descendants is viable, they can replace the parent. Otherwise, keep the viable subject and regenerate a new random number and repeat the crossover operation until two viable descendants or a given number of cycles are used up. Only the viable descendant can replace the parent in the chromosome crossover operation.
3.4.5. Chromosome Mutation Operation
Define as the probability of mutation operation, which indicates that there is an average of chromosomes in each population mutating. Selecting the parent of a chromosome mutation is similar to parent selection in the crossover operation, and mutation is performed as follows.
Step 1. Generate two unequal random integers and between .
Step 2. Exchange the gene at the position with the gene at the position in the chromosome, as shown in Figure 6.
If the chromosome obtained after mutation is viable, the original chromosome will be replaced. Otherwise, repeat Step 1 and Step 2 until a viable chromosome mutation is achieved or the given number of cycles is used up.
4. Examples
Figure 7 shows a locomotive working diagram corresponding to a certain train operations diagram, which uses the smallest distribution method to draw the connection lines, and there is an overlap of two RLs caused by parallel operations in an intermediate station. As a comparison, the author used the method in this paper to optimize the layout of the locomotive working diagram shown in Figure 7.
When the size of the population is 30, the probability of crossover () is 0.3, the probability of mutation () is 0.2, and the number of random models is 1000, and the system calculates three traceable areas separately on a computer which has Intel Core i3 CPU and 4G memory. The middle area takes the longest time, about 1 minute, to get the best chromosome in this area (6, 5, 4, 1, 3, 2, 2, 6, 3, 5, 2, 1, 3, 1, 3, 4, 1, 5), and the target value of this chromosome is 24.0057, which means that the number of crossover points between connection lines in the optimal plan in the middle section is 24. According to the three chromosomes obtained, the locomotive turnover diagram as shown in Figure 8 can be obtained.
In the locomotive working diagram generated using the method in this paper, the number of crossover points between the connection lines is 42, 5 less than the number of crossover points in Figure 7 which was drawn manually. The displacement per connection line is 9mm, 2mm more than in Figure 7 (the height of the middle section in the original diagram was 63mm). With regard to the visualization of these examples, the locomotive working diagram generated using the method presented in this paper is clearer and easier to understand and is more relevant and more legible for the purposes of front line staff.
5. Conclusions
Up until now, there had been little research into the visual representation of locomotive working diagrams. This paper proposes an improved and more systematic planning method to solve some of the problems encountered with computergenerated plans, such as lack of capacity or overlapping of connection lines in locomotive working diagrams, and it also dramatically improves the legibility of locomotive working diagrams. In addition, by adjusting the model slightly, the proposed method could also be applied for other purposes, such as deadhead or light travel, indicating that this method can be very versatile.
Data Availability
No data were used to support this study.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
This work was supported by the National Natural Science Foundation of China (Grant No. 61603140).
References
 L. Nie, Y. Zhang, and X. Wu, “Key technologies for computer generation of cyclic train timetable. China Railway Science,” in Wu X. Key technologies for computer generation of cyclic train timetable. China Railway Science, vol. 35, pp. 114–121, 114121, 35(1, 2014. View at: Google Scholar
 Q. Y. Peng, M. L. Yang, and S. Q. Ni, “A system of making train working graph on singletrack lines with computer,” Journal of Southwest Jiaotong University, vol. 30, no. 5, pp. 537–542, 1995. View at: Google Scholar
 L. S. Zhou, S. J. Hu, J. Ma, and Y. X. Yue, “Network hierarchy parallel algorithm of automatic train scheduling,” Journal of The China Railway Society, vol. 20, no. 5, pp. 15–21, 1998. View at: Google Scholar
 F. D. He, X. Y. Liang, and D. Y. He, “Selfadaptive genetic algorithm for locomotive diagram,” Journal of Southwest Jiaotong University, vol. 41, no. 3, pp. 273–278, 2006. View at: Google Scholar
 H. F. Yan and Y. Cui, “Optimization model of locomotive working diagram,” China Railway Science, vol. 27, no. 4, pp. 123–128, 2006. View at: Google Scholar
 R. K. Ahuja, J. Liu, J. B. Orlin, D. Sharma, and L. A. Shughart, “Solving reallife locomotivescheduling problems,” Transportation Science, vol. 39, no. 4, pp. 503–517, 2005. View at: Publisher Site  Google Scholar
 B. Vaidyanathan, R. K. Ahuja, and J. B. Orlin, “The locomotive routing problem,” Transportation Science, vol. 42, no. 4, pp. 492–507, 2008. View at: Publisher Site  Google Scholar
 B. Vaidyanathan, R. K. Ahuja, J. Liu, and L. A. Shughart, “Reallife locomotive planning: new formulations and computational results,” Transportation Research Part B: Methodological, vol. 42, no. 2, pp. 147–168, 2008. View at: Publisher Site  Google Scholar
 J. M. P. Booler, “The solution of a railway locomotive scheduling problem,” Journal of the Operational Research Society, vol. 31, no. 10, pp. 943–948, 1980. View at: Publisher Site  Google Scholar
 M. A. Forbes, J. N. Holt, and A. M. Watts, “Exact solution of locomotive scheduling problems,” Journal of the Operational Research Society, vol. 42, no. 10, pp. 825–831, 1991. View at: Publisher Site  Google Scholar
 K. Ghoseiri and S. F. Ghannadpour, “A hybrid genetic algorithm for multidepot homogenous locomotive assignment with time windows,” Applied Soft Computing, vol. 10, no. 1, pp. 53–65, 2010. View at: Publisher Site  Google Scholar
 S. M. Nourbakhsh and Y. Ouyang, “Optimal fueling strategies for locomotive fleets in railroad networks,” Transportation Research Part B: Methodological, vol. 44, no. 89, pp. 1104–1114, 2010. View at: Publisher Site  Google Scholar
 T. Raviv and M. Kaspi, “The locomotive fleet fueling problem,” Operations Research Letters, vol. 40, no. 1, pp. 39–45, 2012. View at: Publisher Site  Google Scholar  MathSciNet
 F. Piu and M. G. Speranza, “The locomotive assignment problem: a survey on optimization models,” International Transactions in Operational Research, vol. 21, no. 3, pp. 327–352, 2014. View at: Publisher Site  Google Scholar
 X. Xu, C. Li, and Z. Xu, “Integrated train timetabling and locomotive assignment,” Transportation Research Part B: Methodological, vol. 117, pp. 573–593, 2018. View at: Publisher Site  Google Scholar
 X. Xu, K. Li, and X. Lu, “Simultaneous locomotive assignment and train scheduling on a singletrack railway line: a simulationbased optimization approach,” Computers & Industrial Engineering, vol. 127, no. 1, pp. 1336–1351, 2019. View at: Publisher Site  Google Scholar
 X. Q. Cheng and Y. Pu, “Automation for offset plot of train flow lines,” Journal of Southwest Jiaotong University, vol. 43, no. 6, pp. 692–696, 2008. View at: Google Scholar
 X. Q. Cheng, Y. Pu, Y. X. Lu, and C. Z. Yin, “Automatic plot algorithm of railway train flow diagram,” China Railway Science, vol. 28, no. 1, pp. 113–117, 2007. View at: Google Scholar
 F. Shi, P. Ren, J. Qin, Y. Chen, and W. L. Zhou, “Optimization methods for arranging train flow in rail network,” China Railway Science, vol. 27, no. 2, pp. 120–125, 2006. View at: Google Scholar
Copyright
Copyright © 2019 Yajing Zheng and Wenzhou Jin. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.