Model of Wagons’ Placing-In and Taking-Out Problem in a Railway Station and Its Heuristic Algorithm

1 󵄨󵄨󵄨󵄨 p ij 󵄨󵄨󵄨󵄨 Cmax, 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 O(n), to find the available satisfactory order of wagons’ placing-in and taking-out. Complex problems, such as placing-in and transferring combined, taking-out and transferring combined, placing-in and taking-out combined, or placing-in, transferring, and taking-out combined, could also be resolved with the extended algorithm. A representative instance was given to illustrate the reliability and efficiency of our results.


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' placing-in and taking-out 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 placing-in and taking-out 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 placing-in and takingout wagons in branch-shaped 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 branch-shaped railway siding and suggested two fast and simple algorithms.Shi et al. [3] and Yu and Li [4] turned placing-in and taking-out on branch-shaped 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 pick-up and delivery, which includes the additional constraint that delivery customers must be visited before any pick-up customers.Nenad and colleagues presented a variable neighborhood search approach for solving the one-commodity pick-up and delivery traveling salesman problem.They adapted a collection of neighborhood structures, -opt, double-bridge, and insertion operators, mainly used for solving the classical traveling salesman problem [6].Renaud and colleagues proposed three mathematical models for the pick-up and delivery problem with shuttle routes and a branch-andcut-and-price algorithm to solve it [7].Rais and colleagues described mixed integer-programming 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 placing-in and takingout wagons problem mostly establishes its model on certain ideal conditions.For example, some scholars considered wagons' placing-in and taking-out 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' placing-in and taking-out problem as a single machine scheduling problem 1|  | max , 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' placing-in and taking-out.In addition, we study complex problems: placing-in and transferring combined or taking-out and transferring combined; placing-in and takingout combined; and placing-in, transferring, and taking-out 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' placing-in 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.

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 wagon-group to one goods operation site, it must go back to the railway station before running on to the next site.Accordingly, every wagon-group reaches its corresponding site at a different time and returns to the railway station at a different time too.For a branch-shaped station, the shunting locomotive does not need to return to the station before placing-in another wagon-group.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 placing-in wagons, taking-out wagons, and transferring wagons between the station or operation sites.Because of the diversity of assignment operations and several combinations, the pattern of placing-in and taking-out wagons is summarized as placing-in separately, taking-out separately, placing-in and taking-out combined, placing-in and transferring combined, taking-out and transferring combined, and placing-in, transferring, and taking-out 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.

Wagons' Placing-In Separately or Taking-Out Separately
Wagons' placing-in 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 placing-in separately comprises the following steps: selecting wagon-group, running to the sites, placing wagons, and returning the station.Taking-out 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' taking-out separately comprises the following steps: running to the sites, taking-out 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.

Mathematical Model.
In this paper, we will discuss the wagons' placing-in problem in a branch-shaped 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 placing-in (or taking-out) 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 wagon-groups should be sent to corresponding goods sites.In Figure 1, point V 0 is considered as the railway station and points 3 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 placing-in wagon-groups to the site  as processing workpiece   and wagons placing-in completion is considered to be workpiece   processing accomplishment; the wagons' placing-in problem can be regarded as a single machine scheduling problem 1|  | max .If workpiece   is the predecessor of workpiece   , then the processing time of   is   ( ̸ = , ,  = 0, 1, 2, 3, 4).Accordingly,  = 0 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' placing-in separately can be regarded as a single machine scheduling problem 1|  | max .  is machine processing time, which corresponds to   in this paper. max is completed time of the last workpiece, which is the time in which the shunting locomotive returns to the railway station.Scheduling problem 1|  | max can be solved by transforming it into the well-known problem of the shortest circle in a Hamilton graph.
We can convert wagons' placing-in separately into the problem of the shortest circle in a Hamilton graph  = [, , ].In the Hamilton graph  shown in Figure 2,  signifies the point set and  expresses shunting locomotive running time set {  | ,  ̸ = 0, 1, . . ., 4}.We regard vertex V 0 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 V 0 , 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, 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 ( − 1)! 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 NP-complete 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 branch-and-bound, cutting planes, 2-opt, simulated annealing, neural network, and tabu search.Some of these methods are exact algorithms and the others are near-optimal or approximate algorithms [11][12][13][14][15][16][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' placing-in and taking-out.
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 starting-point of one arrow and the end-point of another.Some characteristics of assignment problem in integer programming problems afflict the Hamilton circle.Assigning V  to V  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: Table 1: Time coefficient of assignment problem.According to the above analysis, the Hamilton graph of wagons' placing-in separately can be relaxed as an assignment problem, and its linear model is shown as follows:

Start-point
Equation ( 2) is the objective function which indicates that we want to minimize the whole locomotive running time of a series of placing-in 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.

Solving Method.
Solving the model of wagons' placing-in 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.

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' placing-in separately-the assignment problem.

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  ( > 1) bipartite graph, then we break the circles and connect them as follows.
Assuming that the point set of one bipartite graph is  = { 1 ,  2 , . . .,   ,   , . . .,   } and that of another is  = {V 1 , V 2 , . . ., V  , V  , . . ., V  }, we select randomly two point pairs (  ,   ) and (V  , V  ) 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  − 1 bipartite graph.If this process continues, we gradually obtain a connected graph.Finally, a satisfactory circle of a Hamilton graph can be obtained.

Solution Procedure.
According to the analysis above, we perform a computational procedure for the wagons' placingin separately problem as follows.
Step 1. Transform wagons' placing-in 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 (V  , V  ).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,  :=  − 1.If  = 1, go to Step 5.If  > 1, go to Step 3.
Step 5. Output optimal order of wagons' placing-in to goods operation sites.The computation ends.
Wagons' taking-out separately operation has some same characters with wagons' placing-in separately.Therefore, the model and algorithm of wagons' placing-in separately are also suitable for the problem of wagons' taking-out separately.

Complexity Analysis.
If there are  vertices in the Hamilton graph, there are /2 subcycles in the worst case.We should execute a broken circle (/2)-1 times to form only one circle.We should make comparisons /2 times and similarly each circle has /2 vertices at most.Therefore, the complexity of the algorithm in this paper is ( 2 ).

Placing-In and Transferring Combined and Taking-Out and Transferring
Combined.Placing-in and transferring combined means that the shunting locomotive transfers wagons during the process of placing-in wagons and then returns to the railway station.The subprocedures are choosing wagon-groups, 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 taking-out operation and one placing-in operation.Transferring operations can reduce the computational complexity of the algorithm to some extent.Placing-in and transferring combined and taking-out 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 V  to loading site V  , the shunting locomotive should visit unloading site V  beforehand, and then it can visit site V  at some other time.That is to say, site V  has visiting priority over site V  , that is, V  ≻ V  (≻ signifies priority).
The placing-in and transferring combined operation is composed of placing-in operations and transferring operations.Assuming that there is a point set which comprises all placing-in sites, the station, and placing-in sites of all transferring operations, with the broken circle and connection method above we can obtain a satisfactory wagons' placing-in circle for the point set.
Then insert taking-out site of transferring operation into the segments which is behind its placing-in operation site in the circle.For example, we need to transfer wagons from unloading site V  to loading site V  .It is assumed that we have already obtained the placing-in order If we insert taking-out site V  of the transferring operation in segment (V  , V  ), 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 taking-out and transferring combined operation consists of taking-out operation and transferring operation.Similarly, we form a point set including all taking-out operation sites, the station, and all taking-out 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 placing-in site of the transferring operation between the end-points of each segment in front of its taking-out operation site in the circle.We select the circle with minimum increment in terms of route length.Then we can obtain a satisfactory taking-out and transferring combined operation order.

Placing-In and Taking-Out Combined and Placing-In,
Transferring, and Taking-Out Combined.For placing-in and taking-out combined operations, we first formulate a placingin circle and a taking-out circle, respectively, and transform them into a circle with the broken circle and connection method above.Then a satisfactory operation order of placingin and taking-out combined operation can be obtained.The placing-in and taking-out 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 placing-in, transferring, and taking-out combined operation, we form a set which includes all taking-out sites and all taking-out sites of transferring operations.On the other hand, we formulate another set which comprises all placing-in sites and all placing-in sites of transferring operations.Then we can obtain a satisfactory placing-in circle and a satisfactory taking-out 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 taking-out circle, with the segments in the placing-in 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 V  to loading site V  .On condition that a taking-out circle been gained, we only need to exchange segments of section V  V  V  ⋅ ⋅ ⋅ V  V 0 for segments of the placing-in circle.

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 taking-out 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.Taking-out three empty wagons and transferring them to site V 10 8 V 8 Placing-in two wagons 9 V 9 Taking-out three wagons 10 V 10 Receiving three empty wagons from site V 7 All operation sites (including the station) are divided into two groups: placing-in operation site set {V 1 , V 4 , V 5 , V 8 , V 10 } and taking-out operation site set {V 0 , V 2 , V 3 , V 6 , V 7 , V 9 }.The priority relations required are V 2 ≻ V 4 and V 7 ≻ V 10 .
Time coefficients for all sites in the railway station are calculated and shown in Table 3, where we set  = 80.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):  110 = 1,  45 = 1,  54 = 1,  81 = 1,  108 = 1,  09 = 1,  23 = 1,  32 = 1,  67 = 1,  76 = 1, and  90 = 1.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 placing-in circle and a taking-out 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 (V 2 , V 3 ) and (V 8 , V 1 ), we can obtain a circle with minimum weights, as shown in Figure 6.Hence, the satisfactory wagons' placing-in and taking-out order is which has total weights of 450.

Conclusion
Taking the locomotive running times as weights, the problem of wagons' placing-in or taking-out separately can be regarded as a single machine scheduling problem, 1|  | max , 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' placing-in and taking-out.We

Figure 1 :
Figure 1: Layout station with branch-shaped goods operation sites.

Figure 3 :
Figure 3: Layout of a railway station.

Figure 4 :
Figure 4: Optimal result of assignment problem.

Figure 5 :
Figure 5: Placing-in circle and taking-out circle (bold lines denote placing-in circle and thin lines denote taking-out circle).

Table 2 :
Tasks of the shunting locomotive.