Research Article  Open Access
Model of Wagons’ PlacingIn and TakingOut Problem in a Railway Station and Its Heuristic Algorithm
Abstract
Placingin and takingout wagons timely can decrease wagons’ dwell time in railway stations, improve the efficiency of railway transportation, and reduce the cost of goods transportation. We took the locomotive running times between goods operation sites as weights, so the wagons’ placingin and takingout problem could be regarded as a single machine scheduling problem, , which could be transformed into the shortest circle problem in a Hamilton graph whose relaxation problem was an assignment problem. We used a Hungarian algorithm to calculate the optimal solution of the assignment problem. Then we applied a broken circle and connection method, whose computational complexity was , to find the available satisfactory order of wagons’ placingin and takingout. Complex problems, such as placingin and transferring combined, takingout and transferring combined, placingin and takingout combined, or placingin, transferring, and takingout combined, could also be resolved with the extended algorithm. A representative instance was given to illustrate the reliability and efficiency of our results.
1. Introduction
After a wagon has been loaded in a loading station, it should be taken out from the goods yard (or railway siding) and coupled to its departure train by a shunting locomotive. When the train arrives at an unloading station, some wagons are removed and placed on their operation sites.
The total time of the process of transporting a wagon from origin to destination can be split into three parts: time spent in the loading station and unloading station, transit time in the marshalling station, and time on the run. According to Chinese statistics, stay time in loading and unloading stations occupies more than 70 percent of the total time [1]. Therefore, organizing wagons’ placingin and takingout timely can decrease wagons’ dwell time in loading and unloading stations, improve the efficiency of railway transportation, and reduce the cost of goods transportation.
The placingin and takingout problem has puzzled scholars since the 1950s, and a number of helpful studies have been published. Lei et al. [1] formulated a mathematical model of optimizing operation for placingin and takingout wagons in branchshaped sidings and depicted it as a typical traveling salesman problem (TSP). A combination of a genetic algorithm and an ant colony algorithm called GACA was presented. Li and Du [2] built a graph and a scheduling theory model of the fetching and delivering wagon problem in a branchshaped railway siding and suggested two fast and simple algorithms. Shi et al. [3] and Yu and Li [4] turned placingin and takingout on branchshaped sidings into a searching Hamilton circle with minimum weights. Heuristic algorithms were used to resolve the problem. Du and Li [5] built a model of scheduling theory for fetching and delivering vehicles on radial sidings and provided a fast algorithm.
Another related problem is TSP with pickup and delivery, which includes the additional constraint that delivery customers must be visited before any pickup customers. Nenad and colleagues presented a variable neighborhood search approach for solving the onecommodity pickup and delivery traveling salesman problem. They adapted a collection of neighborhood structures, opt, doublebridge, and insertion operators, mainly used for solving the classical traveling salesman problem [6]. Renaud and colleagues proposed three mathematical models for the pickup and delivery problem with shuttle routes and a branchandcutandprice algorithm to solve it [7]. Rais and colleagues described mixed integerprogramming formulations for the problem with and without time windows for services [8]. Another helpful research is cited in the reference list [9, 10].
The published research on the placingin and takingout wagons problem mostly establishes its model on certain ideal conditions. For example, some scholars considered wagons’ placingin and takingout as two separate operations, which were difficult to apply to actual situations. In addition, the accuracy of the heuristic algorithms provided deserves further consideration. In this paper, we take the locomotive running time between goods operation sites as weights, regard the wagons’ placingin and takingout problem as a single machine scheduling problem , and transform it into the shortest circle problem in a Hamilton graph, whose relaxation problem is an assignment problem. We use a Hungarian algorithm to calculate the optimal solution of the assignment problem. Then, we use a broken circle and connection method to find a satisfactory order of wagons’ placingin and takingout. In addition, we study complex problems: placingin and transferring combined or takingout and transferring combined; placingin and takingout combined; and placingin, transferring, and takingout combined.
The remainder of the paper is organized as follows. The problem description is shown in Section 2. In Section 3, we provide a single machine scheduling problem for wagons’ placingin separately operation and transform it into the shortest circle problems in a Hamilton graph, and a broken circle and connection method is used to resolve it. We extend our research to other operation patterns in Section 4. A representative numerical example is presented in Section 5. Section 6 concludes.
2. Problem Description
Railway sidings and freight yards are places where goods are loaded and unloaded. In this paper, we refer to them as goods operation sites. Depending on their layout in a railway station, we can divide them into three types: radial, branchshaped, and mixed. In a radial station, after the shunting locomotive has sent a wagongroup to one goods operation site, it must go back to the railway station before running on to the next site. Accordingly, every wagongroup reaches its corresponding site at a different time and returns to the railway station at a different time too. For a branchshaped station, the shunting locomotive does not need to return to the station before placingin another wagongroup. That is to say, all groups’ arrival times are different, but their return times are the same. As regards the mixed goods operation site, the wagon operation shares some common features with the two types above.
In the loading station or the unloading station, a shunting locomotive is assigned to certain tasks, which include placingin wagons, takingout wagons, and transferring wagons between the station or operation sites. Because of the diversity of assignment operations and several combinations, the pattern of placingin and takingout wagons is summarized as placingin separately, takingout separately, placingin and takingout combined, placingin and transferring combined, takingout and transferring combined, and placingin, transferring, and takingout combined.
Considering that trains leave the station on time as much as possible, this paper discusses how the dispatcher optimizes the operation sequence of related sites to minimize the total running time of the locomotive. Only in this way can we reduce the possibility of train delay to a meaningful extent, decrease the cost of locomotive operation to a minimum, and cut down wagons’ dwell time in the station.
3. Wagons’ PlacingIn Separately or TakingOut Separately
Wagons’ placingin separately means that a shunting locomotive couples all wagons, sends them to the operation sites one by one, puts the wagons in the right place, and then goes back to the station alone. Regardless of whether the wagons waiting to be sent are loaded or empty, the operation process of wagons placingin separately comprises the following steps: selecting wagongroup, running to the sites, placing wagons, and returning the station. Takingout separately means that the shunting locomotive goes to goods sites to retrieve the required wagons one by one and goes back to the railway station. The operational process of wagons’ takingout separately comprises the following steps: running to the sites, takingout wagons, returning the station. It can be concluded from the above that the two operational processes have some identical features, and, hence, we can unite them in one mathematical model.
3.1. Mathematical Model
In this paper, we will discuss the wagons’ placingin problem in a branchshaped railway station. To fit the actual circumstance of a railway station, the following conditions below are set.(1)There is only one shunting locomotive in the railway station. The locomotive should send wagons to relevant operation sites, visit every site only once, and return to the railway station after its work has been accomplished.(2)Numbers of the wagons waiting for placingin (or takingout) are known beforehand.(3)The locomotive running times between all sites are obtained from actual data.(4)The number of wagons coupled by the locomotive has no influence on the locomotive running times between operation sites.
In what follows, we describe a series of tasks involving four goods sites in a railway station. Several wagongroups should be sent to corresponding goods sites.
In Figure 1, point is considered as the railway station and points are related goods sites. are representations of turnout between rail lines. Notations refer to locomotive running times between points (operation sites, turnouts, or the station), which can be gained from actual measurement data. Although there is a slight time discrepancy between the times the locomotive runs back and forth on the same line, we regard them as the same for the sake of simplicity.
If we think of the shunting locomotive as a machine, the operation of placingin wagongroups to the site as processing workpiece and wagons placingin completion is considered to be workpiece processing accomplishment; the wagons’ placingin problem can be regarded as a single machine scheduling problem . If workpiece is the predecessor of workpiece , then the processing time of is (). Accordingly, means that there is no predecessor workpiece. In other words, the shunting locomotive starts from the station en route to its first operation site. Our objective is to optimize the shunting locomotive operation to achieve minimum operation time after it has accomplished all its tasks. Therefore, the problem of wagons’ placingin separately can be regarded as a single machine scheduling problem . is machine processing time, which corresponds to in this paper. is completed time of the last workpiece, which is the time in which the shunting locomotive returns to the railway station. Scheduling problem can be solved by transforming it into the wellknown problem of the shortest circle in a Hamilton graph.
We can convert wagons’ placingin separately into the problem of the shortest circle in a Hamilton graph . In the Hamilton graph shown in Figure 2, signifies the point set , is presentation of edge set , and expresses shunting locomotive running time set .
We regard vertex as the railway station, which is the starting vertex of Hamilton graph . We consider related operation sites of a series of tasks, which should be visited only once by the locomotive, as vertices of Hamilton. If we can find a circle which goes through all related operation sites only once and its origin and destination are , a Hamilton circle will be achieved. Shunting locomotive running time between any two sites is shown in Figure 1. Corresponding weights of Hamilton circle are the aggregation of locomotive running time on the lines. For example, is a Hamilton circle which has path length of .
Since all vertices of Hamilton graph in Figure 2 are connected, it is a complete graph. On the other hand, it is an undirected graph on condition that the time the locomotive spends running back and forth between two sites is considered to be the same. A Hamilton graph composed of goods operation sites (including the station) has Hamilton circles. It is obvious that it is not easy to obtain the optimal solution with the enumeration method. Hence, it is essential to choose a simple method to select the optimal scheme from the many schemes available.
The problem of the shortest circle in a Hamilton graph is a classic NPcomplete combinatorial problem and therefore there is no known polynomial time algorithm (unless = NP) that is able to solve all instances of the problem. Consequently, heuristic algorithms are used to provide solutions that are of high quality but not necessarily optimal. Since the 1990s, various approaches have been proposed to solve the problem, such as branchandbound, cutting planes, 2opt, simulated annealing, neural network, and tabu search. Some of these methods are exact algorithms and the others are nearoptimal or approximate algorithms [11–17]. In this paper, we provide a broken circle and connection method to find a satisfactory circle in a Hamilton graph easily, that is, the satisfactory available order of wagons’ placingin and takingout.
In a Hamilton circle, as seen in Figure 2, an arrow’s head connects with another arrow’s tail. In other words, a vertex is the startingpoint of one arrow and the endpoint of another. Some characteristics of assignment problem in integer programming problems afflict the Hamilton circle. Assigning to as its source point is equivalent to task being assigned to worker to do. Accordingly, the weights of edge correspond to the quantity of resource costs.
Introduce the variable and define it as follows: According to the above analysis, the Hamilton graph of wagons’ placingin separately can be relaxed as an assignment problem, and its linear model is shown as follows: Equation (2) is the objective function which indicates that we want to minimize the whole locomotive running time of a series of placingin wagon operations. Constraints (3) and (4) signify that the shunting locomotive goes forward to an operation site and returns only once, respectively. Constraint (5) denotes that is a binary variable.
The transformed time coefficient of Hamilton graph in Figure 2 is shown in Table 1. All vertices of graph lack a ring. On the other hand, because the shortest circle problem is a minimization problem, we suppose that () is equal to ( is a sufficient positive number), in order to ensure that no vertex can be assigned to itself as source point.

The assignment problem, which should be pointed out, is only a relaxation problem of the Hamilton graph discussed. The shortest circle in a Hamilton graph must be a connected graph which requires all arrows’ heads and tails to be connected rather than divided. Therefore, the complete form of the Hamilton graph model should include the following two constraints too: where in the above constraints is a proper subset of set . denotes the number of elements. Constraints (6) are subtour elimination constraints which prohibit the formation of subtours, that is, tour subsets of fewer than vertices.
3.2. Solving Method
Solving the model of wagons’ placingin separately in the railway station should be performed in two steps. First, a classical algorithm of the assignment problem, the Hungarian algorithm, is used to calculate the lower bound . Second, with the help of a broken circle and connection method, we can obtain a satisfactory circle in a Hamilton graph, which corresponds to the satisfactory wagons’ placingin order for related operation sites.
3.2.1. Assignment Problem Method
As a classical algorithm of assignment problems, the Hungarian algorithm can obtain a global optimal solution. With an increasing coefficient matrix dimension, the algorithm’s running time becomes a little longer, but it can reduce computational efforts much more than any enumeration method. In this paper, the Hungarian algorithm is selected to resolve the relaxation problem of wagons’ placingin separately—the assignment problem.
3.2.2. Broken Circle and Connection Method
The solution obtained with the Hungarian algorithm, which should be pointed out, is only a solution to the relaxation problem. If it has formed a Hamilton circle, the optimal solution regarding the shortest cycle of the Hamilton graph is obtained. If it is still a bipartite graph, then we break the circles and connect them as follows.
Assuming that the point set of one bipartite graph is and that of another is , we select randomly two point pairs () and () and exchange their heads and tails. Corresponding weight increments can be computed as follows: Compare weight increments of all point pairs, select the point pairs which have minimal increments, and connect them together. In this case, an bipartite graph is transformed into an bipartite graph. If this process continues, we gradually obtain a connected graph. Finally, a satisfactory circle of a Hamilton graph can be obtained.
3.2.3. Solution Procedure
According to the analysis above, we perform a computational procedure for the wagons’ placingin separately problem as follows.
Step 1. Transform wagons’ placingin order problem in the railway station into the shortest circle in Hamilton graph .
Step 2. Compute the relaxation problem to obtain the optimal solution with the Hungarian method. If a connected graph is obtained, go to Step 5. Otherwise, go to Step 3.
Step 3. Randomly select two parts from the bipartite graph. Choose a point pair from the two selected parts () and (). Find other point pairs and calculate their corresponding values .
Step 4. Compare all values of point pairs. Select the minimum pairs and exchange their heads and tails. Then, . If , go to Step 5. If , go to Step 3.
Step 5. Output optimal order of wagons’ placingin to goods operation sites. The computation ends.
Wagons’ takingout separately operation has some same characters with wagons’ placingin separately. Therefore, the model and algorithm of wagons’ placingin separately are also suitable for the problem of wagons’ takingout separately.
3.2.4. Complexity Analysis
If there are vertices in the Hamilton graph, there are subcycles in the worst case. We should execute a broken circle ()1 times to form only one circle. We should make comparisons times and similarly each circle has vertices at most. Therefore, the complexity of the algorithm in this paper is .
4. Complex Problems
4.1. PlacingIn and Transferring Combined and TakingOut and Transferring Combined
Placingin and transferring combined means that the shunting locomotive transfers wagons during the process of placingin wagons and then returns to the railway station. The subprocedures are choosing wagongroups, running to goods sites, aligning wagon location, gathering wagons, transferring wagons, and turning back.
One transferring operation can be regarded as a combination of one takingout operation and one placingin operation. Transferring operations can reduce the computational complexity of the algorithm to some extent. Placingin and transferring combined and takingout and transferring combined could be considered as the shortest circle problems in a Hamilton graph with visiting priority.
For instance, if we transfer wagons from unloading site to loading site , the shunting locomotive should visit unloading site beforehand, and then it can visit site at some other time. That is to say, site has visiting priority over site , that is, (≻ signifies priority).
The placingin and transferring combined operation is composed of placingin operations and transferring operations. Assuming that there is a point set which comprises all placingin sites, the station, and placingin sites of all transferring operations, with the broken circle and connection method above we can obtain a satisfactory wagons’ placingin circle for the point set.
Then insert takingout site of transferring operation into the segments which is behind its placingin operation site in the circle. For example, we need to transfer wagons from unloading site to loading site . It is assumed that we have already obtained the placingin order . If we insert takingout site of the transferring operation in segment , its corresponding route length is increased by . We select the circle with minimum increment. Then, a satisfactory placingin and transferring combined order is obtained.
The takingout and transferring combined operation consists of takingout operation and transferring operation. Similarly, we form a point set including all takingout operation sites, the station, and all takingout operation sites of transferring operations. We can obtain a satisfactory takingout circle with the broken circle and connection method for the point set. Then we insert the placingin site of the transferring operation between the endpoints of each segment in front of its takingout operation site in the circle. We select the circle with minimum increment in terms of route length. Then we can obtain a satisfactory takingout and transferring combined operation order.
4.2. PlacingIn and TakingOut Combined and PlacingIn, Transferring, and TakingOut Combined
For placingin and takingout combined operations, we first formulate a placingin circle and a takingout circle, respectively, and transform them into a circle with the broken circle and connection method above. Then a satisfactory operation order of placingin and takingout combined operation can be obtained. The placingin and takingout operation order gained is relatively centralized, but it can reduce extra shunting work. Although it may prolong running time for the locomotive, it fits with the actual work rather better.
For the placingin, transferring, and takingout combined operation, we form a set which includes all takingout sites and all takingout sites of transferring operations. On the other hand, we formulate another set which comprises all placingin sites and all placingin sites of transferring operations. Then we can obtain a satisfactory placingin circle and a satisfactory takingout circle with the broken circle and connection method above. Then we use the method once again. As a result, only one circle is gained in the end. During the process of the last broken circle and connection, we only need to exchange the segments, which are behind the takingout sites in the takingout circle, with the segments in the placingin circle. This ensures a visiting priority relation in which the transferring operation requires and reduces the computational effort. For instance, there is an assignment of transferring some wagons from unloading operation site to loading site . On condition that a takingout circle has been gained, we only need to exchange segments of section for segments of the placingin circle.
5. Numerical Example
The layout of a railway station is shown in Figure 3. The station is equipped with a shunting locomotive to deliver wagons. There are several tasks in terms of wagons’ placingin and takingout to do. The tasks are listed in Table 2. The corresponding running times in every line are marked in Figure 3. Now it is necessary to gain the operation order of the shunting locomotive within the least possible time.

All operation sites (including the station) are divided into two groups: placingin operation site set and takingout operation site set . The priority relations required are and .
Time coefficients for all sites in the railway station are calculated and shown in Table 3, where we set . According to the computational procedure of the Hungarian algorithm, we can obtain the optimal solution to the assignment problem (relaxation problem of the shortest circle in the Hamilton graph): , , , , , , , , , , and . The total weight is 316. The corresponding graph of the result is shown in Figure 4.

After the broken circle and connection process has been executed three times, we can obtain a placingin circle and a takingout circle and they are shown in Figure 5. Then we execute the last broken circle and connection procedure and compare the total weights of all circles. Exchanging edges () and (), we can obtain a circle with minimum weights, as shown in Figure 6. Hence, the satisfactory wagons’ placingin and takingout order is , which has total weights of 450.
6. Conclusion
Taking the locomotive running times as weights, the problem of wagons’ placingin or takingout separately can be regarded as a single machine scheduling problem, , which can be transformed into the shortest circle problem in a Hamilton graph. The Hungarian algorithm was applied to obtain the optimal solution to the assignment problem. The broken circle and connection method was applied to find a satisfactory order of wagons’ placingin and takingout. We estimated the computational complexity of the algorithm to be .
We extended the model to other operation patterns: placingin and transferring combined, takingout and transferring combined, placingin and takingout combined, and placingin, transferring, and takingout combined. All these were regarded as the shortest circle problems in a Hamilton graph with visiting priority and could be solved with the extended algorithm provided.
Many experiments also proved that the model and algorithm were feasible on condition that other layouts (radial and mixed goods operation sites) had been converted into branchshaped form.
The research also provides a new method for solving the problem of the shortest circle in a Hamilton graph. We gained a satisfactory solution with the designed algorithm.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
References
 Y. C. Lei, Z. Y. Tu, W. H. Gui, Z. Wu, and F. Yan, “Optimization of placingin and takingout wagons on branchshaped railway lines based on genetic and ant colony algorithm,” Journal of Central South University (Science and Technology), vol. 48, no. 8, pp. 2356–2361, 2011. View at: Google Scholar
 W. Q. Li and W. Du, “Mathematical models and algorithms for the problem of fetching and delivering wagons on treelike railway individual line,” Journal of Henan University (Natural Science), vol. 27, pp. 1–8, 1997. View at: Google Scholar
 H. Shi, Q. Peng, and H. Guo, “Algorithm by using Hamilton graph to resolve wagon placingin and takingout on branchshaped sidings,” China Railway Science, vol. 26, no. 2, pp. 132–135, 2005. View at: Google Scholar
 S. H. Yu and X. M. Li, “The model of placingin and takingout for working wagons and the calculation method,” Railway Transport and Economy, vol. 24, pp. 46–48, 2002. View at: Google Scholar
 W. Du and W. Q. Li, “An algorithm for the problem of fetching and delivering vehicles of throughrunning train on radial individual line,” Journal of Southwest Jiaotong University, vol. 30, pp. 503–508, 1995. View at: Google Scholar
 N. Mladenović, D. Urošević, S. Hanafi, and A. Ilić, “A general variable neighborhood search for the onecommodity pickupanddelivery travelling salesman problem,” European Journal of Operational Research, vol. 220, no. 1, pp. 270–285, 2012. View at: Publisher Site  Google Scholar  MathSciNet
 M. Renaud, R. Stefan, L. Fabien, and P. Olivier, “A branchandcutandprice approach for the pickup and delivery problem with shuttle routes,” European Journal of Operational Research, vol. 236, pp. 849–862, 2014. View at: Publisher Site  Google Scholar
 A. Rais, F. Alvelos, and M. S. Carvalho, “New mixed integerprogramming model for the pickupanddelivery problem with transshipment,” European Journal of Operational Research, vol. 235, no. 3, pp. 530–539, 2014. View at: Publisher Site  Google Scholar  MathSciNet
 H. HernándezPérez and J. SalazarGonzález, “Heuristics for the onecommodity pickupanddelivery traveling salesman problem,” Transportation Science, vol. 38, no. 2, pp. 245–255, 2004. View at: Publisher Site  Google Scholar
 J. Renaud, F. F. Boctor, and J. Ouenniche, “A heuristic for the pickup and delivery traveling salesman problem,” Computers & Operations Research, vol. 27, no. 9, pp. 905–916, 2000. View at: Publisher Site  Google Scholar
 M. Held and R. M. Karp, “A dynamic programming approach to sequencing problems,” SIAM Journal on Applied Mathematics, vol. 10, pp. 196–210, 1962. View at: Google Scholar  MathSciNet
 J. D. C. Little, K. G. Murty, D. W. Sweeney, and C. Karel, “An algorithm for the traveling salesman problem,” Operations Research, vol. 11, pp. 972–989, 1963. View at: Google Scholar
 M. Padberg and G. Rinaldi, “A branchandcut algorithm for the resolution of largescale symmetric traveling salesman problems,” SIAM Review, vol. 33, no. 1, pp. 60–100, 1991. View at: Publisher Site  Google Scholar  MathSciNet
 M. Grötchel and O. Holland, “Solution of largescale symmetric travelling salesman problems,” Mathematical Programming, vol. 51, no. 2, pp. 141–202, 1991. View at: Publisher Site  Google Scholar  MathSciNet
 G. Laporte, “The traveling salesman problem: an overview of exact and approximate algorithms,” European Journal of Operational Research, vol. 59, no. 2, pp. 231–247, 1992. View at: Publisher Site  Google Scholar
 D. Gamboa, C. Rego, and F. Glover, “Implementation analysis of efficient heuristic algorithms for the traveling salesman problem,” Computers and Operations Research, vol. 33, no. 4, pp. 1154–1172, 2006. View at: Publisher Site  Google Scholar  Zentralblatt MATH
 C. Rego, D. Gamboa, F. Glover, and C. Osterman, “Traveling salesman problem heuristics: leading methods, implementations and latest advances,” European Journal of Operational Research, vol. 211, no. 3, pp. 427–441, 2011. View at: Publisher Site  Google Scholar  MathSciNet
Copyright
Copyright © 2014 Chuijiang Guo and Dingyou Lei. 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.