# Dynamic Automated Search of Shunting Routes within Mesoscopic Rail-Traffic Simulators

Authors: Antonin Kavička; Pavel Krýže
Journal: Journal of Advanced Transportation
 (2021)

---

## Abstract

Software tools using computer simulations are frequently used in the research and optimization of railway transport systems. Such simulations serve to examine different railway traffic scenarios (which typically reflect different timetables and railway infrastructure configurations). During the simulation experiments, it is necessary, among other things, to solve tasks related to the determination of track routes along which individual trains or parts of train sets are moved. Many simulation tools require the basic and alternative permissible track routes to be manually specified before starting the simulations, which is a relatively tedious and time-consuming process. Classical graph algorithms cannot be applied to solve the problem of automatic calculation of the routes because they are unable to take into account the length of the object being moved or recognise changes in the direction of its movement. This article presents original innovative algorithms focused on automated dynamic search of track routes (applying an appropriate optimization criterion), which is performed during simulation experiments within simulators working at the mesoscopic level of detail. The algorithms are based on a mathematical model (represented by a specifically designed weighted digraph) that appropriately reflects the actual track infrastructure. The dynamic calculation of each specific track route for a train or a group of railway vehicles considers both the total train set length and the current railway infrastructure occupancy, including blocked parts of the infrastructure due to intervention of the interlocking system. In addition, the places where the train set movement direction is changed can be identified on each route found. Applications of the algorithms and of the mathematical model of the track layout are demonstrated on a model track infrastructure.


---

## Body

## 1. Introduction

The research method of computer simulation is frequently used to examine and optimise the operation of railway systems. In this context, software simulators, or simulation tools, specialized to simulate railway traffic are used with advantages. Such tools require decisions associated with various types of operational tasks/situations to be automatically taken during the simulation experiments. Examples include decision on the assignment of alternative platform tracks to arriving delayed trains, search for admissible train routes available for train set shunting in a currently occupied trackage, and train selection (from a set of more than one waiting train) for permission to enter a specific line track.This article is mainly devoted to automated dynamic computations of track routes required to relocate rail vehicles on a rail infrastructure, intended for inclusion into traffic simulations. Addressing this problem was primarily motivated by efforts to improve the capabilities of current rail-traffic simulators, which often enable static specification of the above track routes to be made only manually (before starting the individual simulation experiments). The possibility of including dynamic computations of track routes for relocating objects (having a given length) into the run of a simulation experiment has a high potential to facilitate (and shorten) the process of simulation experiment parameterization. The dynamic track route computation procedures are based on original algorithms that clearly represent new (as yet unused) solutions in the rail-traffic simulation domain.For a simulator to be classified as a credible tool for practical uses, the traffic and decision processes used within the simulation experiments must be such that the simulation should approach the real railway system operation as best as possible. In other words, it is very important that the automated solutions implemented in the simulator should be based on suitable models and methods providing results applicable in real traffic situations.The present article describes an innovative automated solution of one type of operational problems, namely, determination of the train route topology or shunting route topology for relocation of a train/train set within the railway infrastructure. Information for the specification of the relocation encompasses the relocation object length, starting and final positions (tracks), and current railway yard occupation. The solution has been developed for use in rail-traffic simulators working at the mesoscopic level of detail.


## 2. Literature Review

The operation of railway systems is examined and optimized by employing a number of different methods and techniques that are supported by various software tools. The main goal of such optimizations is to find such solutions which can be used to help ensure quality traffic. The term quality traffic can be interpreted (with some simplifications) as traffic that (i) basically (with minor deviations) follows the timetable and (ii) uses the service resources economically, i.e., means of transport (such as shunting locomotives), elements of infrastructure (on which rail vehicles are moved), and human resources (e.g., technical personnel working in the field of rail yards). A number of specific optimization tasks can be identified in the complex of provisions to ensure quality traffic, and each task may use suitable models of the infrastructure and models of the traffic and traffic management systems.One of the important optimization tasks consists in solving the train routing problem. This extensive problem includes, for instance, the following partial tasks: rail line assignment to trains within the extensive areas of railway networks [1, 2]; coordinated assignment of track routes to more than one train in the railway station [3–6]; and identification of suitable track routes for rail vehicle shunting [7]. Among the relevant factors playing a role when solving such problems is the configuration of the specific infrastructure on which the traffic takes place. This implies that one should seek to select the best-fitting track infrastructure model and use the most suitable algorithms for each specific type of examination.Mathematical structures of the graph type (and their specific implementations), which fall in the graph theory domain, are frequently used when describing a particular track infrastructure. Infrastructure models can be constructed both on directed graphs (digraphs) and on undirected graphs. Original track layout models built on the double vertex graph [8] and polar graph [7, 9] concepts make possible distinction between track segments of switches and station track segments.Among typical tasks addressed by using graphs is the search for admissible (potentially shortest) track routes on which rail vehicles are shunted. The concept of the original Dijkstra’s algorithm [10–12], which is primarily aimed at searching for the single-source shortest paths on a weighted directed graph, can be used with advantage for such purposes. Numerous modifications of this algorithm have also been used when examining railway systems [13–15].One of the important methods used to investigate and optimise railway systems is computer simulation [16]. Different track layout models are used within software tools specialized to simulate rail traffic [7, 8, 14, 15]. Examples of relevant simulation tools in this domain include OpenTrack [17], RailSys [18], Villon [19], MesoRail [20], NEMO [21], and PULSim [22]. Such tools always apply the same level of detail—microscopic, mesoscopic, or macroscopic. On the contrary, different approaches can apply distinct levels of detail within different parts of a simulator—such simulations are referred to as multiscale simulations [23] or hybrid simulations [24, 25]. The existence of software platforms for combined traffic simulations, capable of examining interactions of different traffic modes (e.g., [26]), is also worth mentioning.In order to work, the above software tools require data description of the rail infrastructure, which can be available in various formats of the configuration files. A standard exists for this purpose, viz. railML [27, 28] (open-source railway markup language). This standard defines a recommended format of the files for the exchange of data for railway applications. The RailTopoModel [29, 30] is also available: this is a logical object model designed for standardization of the representation of railway infrastructure-related data.Continuation of that part of the research, the results of which were published in [7], was motivated by the need for specialized functions to be applied in the new simulation tool named MesoRail, serving rail-traffic simulations and working at the mesoscopic level of detail. Among such functions was automated computation of the topologies of the track routes on which relocation objects (such as trains and locomotives) will be moved within the track infrastructure model. For this, the appropriate original algorithms (which, however, have never been published so far) were redesigned and implemented. The algorithms were then tested with success within MesoRail for use in dynamic track route calculations. The track layout model used and the algorithms working on it make up original solutions that have never been used elsewhere (according to the available literature).


## 3. Models of the Rail Infrastructure

Automated dynamic search for train routes and shunting routes within the railway infrastructure uses a mathematical model, reflecting the track layout examined. The construction of such a model consists of 2 stages.


### 3.1. Primary Model

Stage 1 includes the creation of a primary model using an undirected edge-weighted graph as specified in Table1. The edges in the graph represent the individual tracks (or their parts) as well as the track segments of the switches. The edges reflecting the tracks are referred to as destination edges, while the remaining edges are referred to as connecting edges.Table 1
Specification of the weighted undirected graphG0—the primary model of the track infrastructure.
SymbolsSpecificationsG0The weighted undirected graph(i) G0 = (V, E, φ, ε)V(G0)The set of vertices of the graphG0(i) |V(G0)| = n0E(G0)The set of edges of the graphG0(i) |E(G0)| = m0(ii) E(G0) = Edest (G0) ∪ Econn (G0), Edest (G0) ∩ Econn (G0) = ∅(iii) The set Edest (G0) contains destination edges(iv) The set Econn (G0) contains connecting edgesφThe incidence function related to the graphG0(i) φ: E(G0) ⟶ {(vx, vy) | (vx, vy) ∈ V(G0) × V(G0) ∧ vx ≠ vy}εThe edge weight function related to the graphG0(i) ε: E(G0) ⟶  R+ (the set of positive real numbers)This terminology mirrors the fact that tracks can be viewed as targets for rail vehicle relocation whereas switches and track crossings cannot. The graph vertices represent the contact points of the track segments reflected by the edges.Where switches and crossings are modelled, their different types determining how they can be technically transited must be differentiated. Some examples of how different switches or crossings are represented in graphG0 are illustrated in Figure 1. Admissible transits in Figure 1 are specified in Table 2.Figure 1
The models of switches and crossings applied within undirected graphs.
(a)(b)(c)(d)Table 2
Admissible transits through several kinds of switches and crossings.
The type of switchAdmissible transitsSwitch(Figure 1(a))v1 ⟶ v2, v2 ⟶ v1, v1 ⟶ v3, v3 ⟶ v1Double slip switch(Figure 1(b))v1 ⟶ v5, v5 ⟶ v1, v1 ⟶ v4, v4 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2, v2 ⟶ v5, v5 ⟶ v2Single slip switch(Figure 1(c))v1 ⟶ v5, v5 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2, v2 ⟶ v5, v5 ⟶ v2Track crossing(Figure 1(d))v1 ⟶ v5, v5 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2Each edge in graphG0 has a weight assigned, expressing the metric length of the track segment. An example of a primary model mirroring a demonstration railway yard (total track length: 3049 m) is shown in Figure 2.Figure 2
Prototype track infrastructure—a primary model based on an undirected graphG0.
(a)(b)When a specific rail vehicle relocation within the rail infrastructure is required, the starting and final positions are assumed to be associated with specific tracks (represented by appropriate edges in graphG0). In order to make it possible to distinguish between the opposite track ends, either end of each edge in the graph can be assigned either the plus sign (+) or the minus sign (−). This enables us, for instance, to specify that end of the finish track through which the rail vehicle should reach the finish position. Such edge end labelling can also be interpreted as an alternative labelling of the vertex that is incident with the specific end of the specific edge. For example, the notation e−5 = v12 = e+20 can be used in Figure 2. The assignment of the signs to the opposite edge ends can be based on a rule (for instance, if the graph is placed in the two-dimensional coordinate system, then that track end having a lower value of coordinate x is assigned the plus sign, the opposite end, the minus sign).The use of this marking was partly inspired by the polar graph concept [7, 9]. Each vertex in a graph of this type is composed of two poles—the plus pole and the minus pole—and each edge incident with a vertex can be classed in one of the following two categories: edges incident with the plus pole and edges incident with the minus pole of the vertex. This principle was loosely applied to the marking of the opposite ends of the undirected edges in graph G0. Figure 2(b) also illustrates the graphical encapsulation of the groups of edges corresponding to the switch objects (designated with symbol Si, i = 1, …, 6).


### 3.2. Final Model

Stage 2 includes transformation of the primary modelG0 into the final model (Figure 3), which is represented by a specific weighted digraph G. The specification of this graph is presented in Table 3. If the transformation is used, an ordered pair of appropriate vertices vix ∈ V(G), i = 1, 2, is formed for each edge ex ∈ E(G0) (that is, the bijective transformation function τ: E(G0) ⟶ {[v1x, v2x] | v1x, v2x ∈ V(G), v1x ≠ v2x, [v1x, v2x], [v2x, v1x] ∉ E(G)} is applied). The two vertices representing a track in the digraph G mirror the fact that the track can be entered/left in two opposite directions.Figure 3
The final infrastructure model based on digraphG.Table 3
Specification of the weighted digraphG—the final model of the track infrastructure.
SymbolsSpecificationsGThe weighted digraph(i) G = (V, E, φ, ω, ε, κ)(ii) The digraph G represents a result related to the transformation of the relevant undirected graph G0V(G)The set of vertices of the digraphG(i) V(G) = {vkz|z = 1, …, n\2, k = 1, 2}, |V(G)| = n(ii) V(G) = Vdest (G) ∪ Vconn (G), Vdest (G) ∩ Vconn (G) = ∅(iii) The set Vdest (G) contains destination vertices of the digraph G(iv) The set Vconn (G) contains connecting vertices of the digraph GNote: symbol “\” denotes an integer divisionE(G)The set of directed edges of the digraphG(i) |E(G)| = m(ii) E(G) = Etrans (G) ∪ Erev (G), Etrans (G) ∩ Erev (G) = ∅(iii) The set Etrans (G) contains transit edges(iv) The set Erev (G) contains reverse edgesφThe incidence function related to the digraphG(i) φ: E(G) ⟶ {[vix, vjy] | [vix, vjy] ∈ V(G) × V(G) ∧ vix ≠ vjy; x, y ∈ <1, …, n\2>; i, j ∈ {1, 2}}Vout(vkz)The set of successors of the vertexvkz(i) Vout(vkz) = {vls | [vkz, vls] ∈ E(G)}, Vout(vkz) ⊂ V(G)(ii) Vout(vkz) = Vouttrans (vkz) ∪ Voutrev(vkz), Vouttrans(vkz) ∩ Voutrev(vkz) = ∅(iii) The set of transit successors of the vertex vkzVouttrans(vkz) = {vls| [vkz, vls] ∈ Etrans(G)}(iv) The set of reverse successors of the vertex vkzVoutrev(vkz) = {vls| [vkz, vls] ∈ Erev(G)}ωThe vertex weight function related to the digraphG(i) ω: V(G) ⟶ R+(ii) ∀ v1z, v2z ∈ V(G) (z = 1,..., n\2): ω (v1z) = ω(v2z)εThe edge weight function related to the digraphG(i) ε: E(G) ⟶ R+(ii) ∀ [vix, vjy] ∈ Etrans: ε ([vix, vjy]) = ω(vix)(iii) ∀ [vix, vjy] ∈ Erev: ε([vix, vjy]) = L, where L represents a parameter value reflecting the length of a relevant relocation objectκThe vertex vacancy function (vacant capacity function)(i) κ: V(G) ⟶ R0+(ii) If a track segment (reflected by a vertex vkz ∈ V(G)) is completely vacant, then κ(vkz) = ω(vkz)Furthermore, the vertices in digraphG can be categorised according to whether they can represent the relocation targets or not. Hence, we distinguish between destination vertices (represented by full circles in Figure 3) and connecting vertices (represented by empty circles).Edges in the digraphG can be categorised as transit edges (shown as full lines in Figure 3) and reverse edges (shown as dashed lines). Transit edge expresses the possibility of transiting through the track modelled with a vertex (that represents a starting point of the transit edge) to adjacent tracks. Reverse edge expresses the fact that a train can change the direction of its motion (=reversal) on the track that is modelled by the starting vertex of the reverse edge.Two transit edges representing the possibility of transiting between the tracks in 2 directions are constructed in graphG for each pair of adjacent edges (the edge construction methods are explained in Table 4). Reverse edges can start from destination vertices solely. Here, it is assumed that the whole relocation object stops on one track during the reversal operation. A situation where a train can occupy more than one track during reversal is not modelled in the digraph G. This simplification can be applied within simulators operating at the mesoscopic level of detail.Table 4
Construction of edges belonging to the digraphG transformed from a related graph G0.
Adjacent edgesφ (ex) ∩ φ (ey) ≠ ∅ex,ey ∈ E(G0), ex ≠ eyConstructed transit edgesEtrans (G)Constructed reverse edgesErev (G)Only ife+x = e−y[v1x, v1y], [v2y, v2x][v1y, v2x]v1y ∈ Vdest (G)[v2x, v1y]v2x ∈ Vdest (G)e−x = e+y[v2x, v2y], [v1y, v1x][v2y, v1x]v2y ∈ Vdest (G)[v1x, v2y]v1x ∈ Vdest (G)e+x = e+y[v1x, v2y], [v1y, v2x][v2y, v2x]v2y ∈ Vdest (G)[v2x, v2y]v2x ∈ Vdest (G)e+x = e−y[v2x, v1y], [v2y, v1x][v1y, v1x]v1y ∈ Vdest(G)[v1x, v1y]v1x ∈ Vdest(G)Applying the rule specified in Table4, a reverse edge is constructed for each transit edge whose end vertex is a destination vertex. For example (referring to the graph in Figure 2), the reverse edge [v25, v118] is formed to the transit edge [v218, v25].DigraphG is both vertex-weighted and edge-weighted, and the vacancies are preserved for the vertices. The following rules are applied to the weights and vacancies:(i)
The weights of the vertices in digraphG (expressed through function ω) represent the metric lengths of the track segments corresponding to the weights of the respective edges in graph G0.(ii)
The weights of transit edges (expressed through functionε) in digraph G are identical with the weights of the vertices they proceed from. The weight of a specific transit edge represents the distance run by the relocation object by transiting the track that mirrors the starting vertex of that edge.(iii)
The weights of reverse edges (expressed through functionε) are identical for all those edges and do not attain fixed values: instead, they are set (to value L) always before running the computing algorithm searching for a given train or shunting route (for a relocation object whose length is L). This weight is interpreted so that if the relocation object stops on a certain track (corresponding to the starting vertex of a reverse edge) for a time and then continues by moving in the opposite direction, then the used part of the track is that part whose length is identical with that of the relocation object (i.e., L).(iv)
Furthermore, every vertex in digraphG has an available vacancy (expressed through function κ), expressing the metric free capacity of the respective track. Since each track in digraph G is modelled with a pair of vertices, the vacancies of the vertices express the metric lengths of the vacant parts of the track from the two opposite ends. Function κ can be used to express the rail infrastructure occupation by rail vehicles and also the blocking if its parts are unreachable due to the operation of the interlocking system (for instance, if a certain track x is blocked, then the equation κ (v1x) = κ (v2x) = 0 holds for the graph vertices v1x,v2x ∈ V(G)).Examples of particular weight and vacancy values belonging to selected elements in digraphG are shown in the following (Example 1).


## 3.1. Primary Model

Stage 1 includes the creation of a primary model using an undirected edge-weighted graph as specified in Table1. The edges in the graph represent the individual tracks (or their parts) as well as the track segments of the switches. The edges reflecting the tracks are referred to as destination edges, while the remaining edges are referred to as connecting edges.Table 1
Specification of the weighted undirected graphG0—the primary model of the track infrastructure.
SymbolsSpecificationsG0The weighted undirected graph(i) G0 = (V, E, φ, ε)V(G0)The set of vertices of the graphG0(i) |V(G0)| = n0E(G0)The set of edges of the graphG0(i) |E(G0)| = m0(ii) E(G0) = Edest (G0) ∪ Econn (G0), Edest (G0) ∩ Econn (G0) = ∅(iii) The set Edest (G0) contains destination edges(iv) The set Econn (G0) contains connecting edgesφThe incidence function related to the graphG0(i) φ: E(G0) ⟶ {(vx, vy) | (vx, vy) ∈ V(G0) × V(G0) ∧ vx ≠ vy}εThe edge weight function related to the graphG0(i) ε: E(G0) ⟶  R+ (the set of positive real numbers)This terminology mirrors the fact that tracks can be viewed as targets for rail vehicle relocation whereas switches and track crossings cannot. The graph vertices represent the contact points of the track segments reflected by the edges.Where switches and crossings are modelled, their different types determining how they can be technically transited must be differentiated. Some examples of how different switches or crossings are represented in graphG0 are illustrated in Figure 1. Admissible transits in Figure 1 are specified in Table 2.Figure 1
The models of switches and crossings applied within undirected graphs.
(a)(b)(c)(d)Table 2
Admissible transits through several kinds of switches and crossings.
The type of switchAdmissible transitsSwitch(Figure 1(a))v1 ⟶ v2, v2 ⟶ v1, v1 ⟶ v3, v3 ⟶ v1Double slip switch(Figure 1(b))v1 ⟶ v5, v5 ⟶ v1, v1 ⟶ v4, v4 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2, v2 ⟶ v5, v5 ⟶ v2Single slip switch(Figure 1(c))v1 ⟶ v5, v5 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2, v2 ⟶ v5, v5 ⟶ v2Track crossing(Figure 1(d))v1 ⟶ v5, v5 ⟶ v1, v2 ⟶ v4, v4 ⟶ v2Each edge in graphG0 has a weight assigned, expressing the metric length of the track segment. An example of a primary model mirroring a demonstration railway yard (total track length: 3049 m) is shown in Figure 2.Figure 2
Prototype track infrastructure—a primary model based on an undirected graphG0.
(a)(b)When a specific rail vehicle relocation within the rail infrastructure is required, the starting and final positions are assumed to be associated with specific tracks (represented by appropriate edges in graphG0). In order to make it possible to distinguish between the opposite track ends, either end of each edge in the graph can be assigned either the plus sign (+) or the minus sign (−). This enables us, for instance, to specify that end of the finish track through which the rail vehicle should reach the finish position. Such edge end labelling can also be interpreted as an alternative labelling of the vertex that is incident with the specific end of the specific edge. For example, the notation e−5 = v12 = e+20 can be used in Figure 2. The assignment of the signs to the opposite edge ends can be based on a rule (for instance, if the graph is placed in the two-dimensional coordinate system, then that track end having a lower value of coordinate x is assigned the plus sign, the opposite end, the minus sign).The use of this marking was partly inspired by the polar graph concept [7, 9]. Each vertex in a graph of this type is composed of two poles—the plus pole and the minus pole—and each edge incident with a vertex can be classed in one of the following two categories: edges incident with the plus pole and edges incident with the minus pole of the vertex. This principle was loosely applied to the marking of the opposite ends of the undirected edges in graph G0. Figure 2(b) also illustrates the graphical encapsulation of the groups of edges corresponding to the switch objects (designated with symbol Si, i = 1, …, 6).


## 3.2. Final Model

Stage 2 includes transformation of the primary modelG0 into the final model (Figure 3), which is represented by a specific weighted digraph G. The specification of this graph is presented in Table 3. If the transformation is used, an ordered pair of appropriate vertices vix ∈ V(G), i = 1, 2, is formed for each edge ex ∈ E(G0) (that is, the bijective transformation function τ: E(G0) ⟶ {[v1x, v2x] | v1x, v2x ∈ V(G), v1x ≠ v2x, [v1x, v2x], [v2x, v1x] ∉ E(G)} is applied). The two vertices representing a track in the digraph G mirror the fact that the track can be entered/left in two opposite directions.Figure 3
The final infrastructure model based on digraphG.Table 3
Specification of the weighted digraphG—the final model of the track infrastructure.
SymbolsSpecificationsGThe weighted digraph(i) G = (V, E, φ, ω, ε, κ)(ii) The digraph G represents a result related to the transformation of the relevant undirected graph G0V(G)The set of vertices of the digraphG(i) V(G) = {vkz|z = 1, …, n\2, k = 1, 2}, |V(G)| = n(ii) V(G) = Vdest (G) ∪ Vconn (G), Vdest (G) ∩ Vconn (G) = ∅(iii) The set Vdest (G) contains destination vertices of the digraph G(iv) The set Vconn (G) contains connecting vertices of the digraph GNote: symbol “\” denotes an integer divisionE(G)The set of directed edges of the digraphG(i) |E(G)| = m(ii) E(G) = Etrans (G) ∪ Erev (G), Etrans (G) ∩ Erev (G) = ∅(iii) The set Etrans (G) contains transit edges(iv) The set Erev (G) contains reverse edgesφThe incidence function related to the digraphG(i) φ: E(G) ⟶ {[vix, vjy] | [vix, vjy] ∈ V(G) × V(G) ∧ vix ≠ vjy; x, y ∈ <1, …, n\2>; i, j ∈ {1, 2}}Vout(vkz)The set of successors of the vertexvkz(i) Vout(vkz) = {vls | [vkz, vls] ∈ E(G)}, Vout(vkz) ⊂ V(G)(ii) Vout(vkz) = Vouttrans (vkz) ∪ Voutrev(vkz), Vouttrans(vkz) ∩ Voutrev(vkz) = ∅(iii) The set of transit successors of the vertex vkzVouttrans(vkz) = {vls| [vkz, vls] ∈ Etrans(G)}(iv) The set of reverse successors of the vertex vkzVoutrev(vkz) = {vls| [vkz, vls] ∈ Erev(G)}ωThe vertex weight function related to the digraphG(i) ω: V(G) ⟶ R+(ii) ∀ v1z, v2z ∈ V(G) (z = 1,..., n\2): ω (v1z) = ω(v2z)εThe edge weight function related to the digraphG(i) ε: E(G) ⟶ R+(ii) ∀ [vix, vjy] ∈ Etrans: ε ([vix, vjy]) = ω(vix)(iii) ∀ [vix, vjy] ∈ Erev: ε([vix, vjy]) = L, where L represents a parameter value reflecting the length of a relevant relocation objectκThe vertex vacancy function (vacant capacity function)(i) κ: V(G) ⟶ R0+(ii) If a track segment (reflected by a vertex vkz ∈ V(G)) is completely vacant, then κ(vkz) = ω(vkz)Furthermore, the vertices in digraphG can be categorised according to whether they can represent the relocation targets or not. Hence, we distinguish between destination vertices (represented by full circles in Figure 3) and connecting vertices (represented by empty circles).Edges in the digraphG can be categorised as transit edges (shown as full lines in Figure 3) and reverse edges (shown as dashed lines). Transit edge expresses the possibility of transiting through the track modelled with a vertex (that represents a starting point of the transit edge) to adjacent tracks. Reverse edge expresses the fact that a train can change the direction of its motion (=reversal) on the track that is modelled by the starting vertex of the reverse edge.Two transit edges representing the possibility of transiting between the tracks in 2 directions are constructed in graphG for each pair of adjacent edges (the edge construction methods are explained in Table 4). Reverse edges can start from destination vertices solely. Here, it is assumed that the whole relocation object stops on one track during the reversal operation. A situation where a train can occupy more than one track during reversal is not modelled in the digraph G. This simplification can be applied within simulators operating at the mesoscopic level of detail.Table 4
Construction of edges belonging to the digraphG transformed from a related graph G0.
Adjacent edgesφ (ex) ∩ φ (ey) ≠ ∅ex,ey ∈ E(G0), ex ≠ eyConstructed transit edgesEtrans (G)Constructed reverse edgesErev (G)Only ife+x = e−y[v1x, v1y], [v2y, v2x][v1y, v2x]v1y ∈ Vdest (G)[v2x, v1y]v2x ∈ Vdest (G)e−x = e+y[v2x, v2y], [v1y, v1x][v2y, v1x]v2y ∈ Vdest (G)[v1x, v2y]v1x ∈ Vdest (G)e+x = e+y[v1x, v2y], [v1y, v2x][v2y, v2x]v2y ∈ Vdest (G)[v2x, v2y]v2x ∈ Vdest (G)e+x = e−y[v2x, v1y], [v2y, v1x][v1y, v1x]v1y ∈ Vdest(G)[v1x, v1y]v1x ∈ Vdest(G)Applying the rule specified in Table4, a reverse edge is constructed for each transit edge whose end vertex is a destination vertex. For example (referring to the graph in Figure 2), the reverse edge [v25, v118] is formed to the transit edge [v218, v25].DigraphG is both vertex-weighted and edge-weighted, and the vacancies are preserved for the vertices. The following rules are applied to the weights and vacancies:(i)
The weights of the vertices in digraphG (expressed through function ω) represent the metric lengths of the track segments corresponding to the weights of the respective edges in graph G0.(ii)
The weights of transit edges (expressed through functionε) in digraph G are identical with the weights of the vertices they proceed from. The weight of a specific transit edge represents the distance run by the relocation object by transiting the track that mirrors the starting vertex of that edge.(iii)
The weights of reverse edges (expressed through functionε) are identical for all those edges and do not attain fixed values: instead, they are set (to value L) always before running the computing algorithm searching for a given train or shunting route (for a relocation object whose length is L). This weight is interpreted so that if the relocation object stops on a certain track (corresponding to the starting vertex of a reverse edge) for a time and then continues by moving in the opposite direction, then the used part of the track is that part whose length is identical with that of the relocation object (i.e., L).(iv)
Furthermore, every vertex in digraphG has an available vacancy (expressed through function κ), expressing the metric free capacity of the respective track. Since each track in digraph G is modelled with a pair of vertices, the vacancies of the vertices express the metric lengths of the vacant parts of the track from the two opposite ends. Function κ can be used to express the rail infrastructure occupation by rail vehicles and also the blocking if its parts are unreachable due to the operation of the interlocking system (for instance, if a certain track x is blocked, then the equation κ (v1x) = κ (v2x) = 0 holds for the graph vertices v1x,v2x ∈ V(G)).Examples of particular weight and vacancy values belonging to selected elements in digraphG are shown in the following (Example 1).


## 4. Algorithms Focused on Searching Train Routes

Now, after the final railway infrastructure model has been introduced, the algorithms for calculating train routes or shunting routes can be described. The search of the routes was based on the optimization principle consisting in minimisation of the distance run by the relocation object in question.Dijkstra’s algorithm [10, 11] for searching the shortest routes between the vertices on an edge-weighted graph was selected as the starting algorithm. However, it had to be appreciably modified for use in the calculation of the relocation trajectories for trains or train sets (having a defined length) on the railway infrastructure.As mentioned earlier, the railway infrastructure was modelled by digraphG, specified in Table 3.Now, additional auxiliary sets, row vectors, and subroutines/functions to be used in the algorithms must be specified in order to enable the algorithms to be formalized. The specifications are listed in Tables5 and 6. The subroutines/functions utilise parameters applying the following convention: the symbol “↓” denotes an input parameter, symbol “↑” denotes an output parameter, and double symbol “↓↑” denotes an input-output parameter.Table 5
Specifications of auxiliary sets and row vectors.
SymbolsSpecificationsSVThe set of start vertices(i) SV ⊂ V(G)FVThe set of finish vertices(i) FV ⊂ V(G)XVThe set of forbidden vertices(i) XV ⊂ V(G)TVThe set of temporarily marked vertices(i) TV ⊂ V(G)UVThe set of ultimately marked finish vertices(i) UV ⊂ V(G)DThe row vector of distances(i) D = ||dkz||, dkz ∈ R0+, z = 1, …, n\2, k = 1, 2(ii) Each vertex vkz ∈ V(G) is tagged by a mark dkz, which expresses the length of the currently detected shortest path from a vertex vix ∈ SV to the vertex vkz(iii) If the above path to the vertex vkz ∈ V(G) does not exist, then dkz = d∞ (d∞ ∈ R0+, and it is equal to the value that is greater than the length of the longest admissible path in the graph G)Note: symbol “\” denotes an integer divisionPThe row vector of predecessors(i) P = ||pkz||, pkz ∈ V(G) ∪ {none}, z = 1, …, n\2, k = 1, 2(ii) Each vertex vkz ∈ V(G) is tagged by a mark pkz, which corresponds to a predecessor of the vertex vkz on the currently detected shortest path from a vertex vix ∈ SV to the vertex vkz(iii) If the above path to the vertex vkz ∈ V(G) does not exist, then pkz = none (the symbol none expresses the nonexistence of a relevant predecessor with regard to the vertex vkz)SeqThe linearly ordered set of the shortest path topology(i) Seq = {[i, vkz] |i = 0, ..., q − 1, vkz ∈ V(G), z ∈〈1, …, n\2〉, k ∈ {1, 2}, q = |Seq|}(ii) The element [0, vkz] represents a finish vertex (vkz ∈ FV) and the element [q − 1, vkz] a start vertex (vkz ∈ SV) of the shortest pathTable 6
Specifications of subprograms/functions.
Subprograms/functionsSpecificationsShortest_Path(↓SV, ↓FV, ↓L, ↑Topol)The calculation of the shortest path (the graphG)SV (the set of start vertices)FV (the set of finish vertices)L (the length of the relocation object)Topol (the topology of the shortest path)Start_Finish_Test(↓SV, ↓FV, ↓L, ↑↓okay)The test of correctness of start and finish verticesSV (the set of start vertices)FV (the set of finish vertices)L (the length of the relocation object)okay (the test result)General_Init()The execution of general initialisation activitiesThe initialisation of the sets TV and UVThe initialisation of the row vectors P and DStart_Finish_Init(↓SV, ↓FV)The initialisation activities reflecting start vertices and finish verticesThe initialisation of the set XVThe initialisation of the marks dix (dix = 0) related to the start vertices (vix ∈ SV)Start_Mark(↓SV,↓L)The initialisation activities focused on markings of the successors of start verticesThe update of the set TV and the row vectors P and DVert_Select(↑vkz)The selection of the vertexvkz (with the current minimal distance mark) for the processing in the next step of the algorithmThe vertex vkz is selected/removed from the set TVThe set UV is potentially updatedSucc_Mark(↓vkz, ↓L)The potential execution of admissibly rewriting the marks belonging to all successors of the vertexvkzThe potential update of the set TV and the row vectors P and DGet_Path(↑↓Seq)The delivery of the topology related to the found shortest pathSeq represents a sequence of verticesGet_Indexes(↓vix, ↑i, ↑x)The auxiliary function delivering indexes of a vertexvixMin_Dist(↓A, ↑vkz)The auxiliary function identifying a vertexvkz (within a set A) associated with the minimum value of the relevant mark dkzTry_Change_Mark(↓vkz, ↓vls)The auxiliary function potentially rewriting the marks belonging to the successor (the vertexvls) of the vertex vkzThe potential update of the set TV and the row vectors P and DPredecessor(↓vkz, ↑l, ↑t)The auxiliary function delivering indexes related to a predecessor (vlt) of the vertex vkz (on the relevant shortest path)


### 4.1. Basic Algorithm

The basic algorithm (formalized as Algorithm1) searches for the shortest route in the track layout from a specific start vertex to a specific finish vertex. The start vertex represents the end of the start track transited by the train (whole length is L) when starting its relocation procedure, while the finish vertex represents the end of the finish track transited by the train when approaching the finish position.Algorithm 1:Computation of the shortest path from SV = {vix} to FV = {vjy}
(1)
function Shortest_Path(↓SV, ↓FV, ↓L, ↑Topol)(2)
Topol ← ∅(3)
correct ← true(4)
Start_Finish_Test(↓SV, ↓FV, ↓L, ↑↓correct) // admissibility of the start/finish vertices(5)
ifcorrectthen(6)
General_Init() // setting initial marks of all vertices(7)
Start_Finish_Init(↓SV, ↓FV) // initialisation activities related to the start/finish vertices(8)
Start_Mark(↓SV, ↓L) // remarking of transit successors of the start/finish vertices(9)
repeat(10)
ifTV ≠ ∅ then(11)
Vert_Select(↑vkz) // selection of a new current vertex(12)
ifUV ≠ FVthen(13)
Succ_Mark(↓vkz, ↓L) // remarking successors of the current vertex vkz(14)
end(15)
end(16)
until (TV = ∅ orUV = FV) // algorithm termination testing(17)
Get_Path(↑↓Topol) // getting a topology of the shortest path(18)
end(19)
end(20)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(21)
if (SV = ∅ orFV = ∅) then(22)
okay ← false(23)
exit(24)
end(25)
for eachvix ∈ SVdo(26)
Get_Indexes(↓vix, ↑i, ↑x)(27)
for eachvjy ∈ FVdo(28)
Get_Indexes(↓vjy, ↑j, ↑y)(29)
if (x = yandi ≠ j) then(30)
okay ← false // inadmissible combination of the start and finish vertices(31)
exit(32)
end(33)
if (ω (vix) < Lorκ (vjy) < L) then(34)
okay ← false // inadmissible weights/vacancies of the start/finish vertices(35)
exit(36)
end(37)
end(38)
end(39)
end(40)
functionGeneral_Init()(41)
forz = 1 ton\2do // symbol “\” denotes an integer division(42)
fork = 1 to 2 do(43)
dkz ← d∞ // initialisation of the row vector of distance marks(44)
pkz ← none // initialisation of the row vector of marks-predecessors(45)
end(46)
end(47)
TV ← ∅(48)
UV ← ∅(49)
end(50)
functionStart_Finish_Init(↓SV, ↓FV)(51)
for eachvix ∈ SVdo(52)
Get_Indexes(↓vix, ↑i, ↑x)(53)
for eachvjy ∈ FVdo(54)
Get_Indexes(↓vjy, ↑j, ↑y)(55)
a ← (3 − i)(56)
b ← (3 − j)(57)
ifSV = FVthen(58)
XV ← {vax} // the forbidden vertex vax is a pair vertex to the start vertex vix(59)
else(60)
XV ← {vax, vby} // the forbidden vertex vby is a pair vertex to the finish vertex vjy(61)
dix ← 0 // initialisation of selected distance marks(62)
end(63)
end(64)
end(65)
end(66)
functionStart_Mark(↓SV, ↓L)(67)
for eachvkz ∈ SVdo(68)
for eachvlt ∈ Vouttrans (vkz) do(69)
if (vlt ∉ XVandκ (vlt) ≥ L) then(70)
TV ← TV ∪ {vlt} // insertion of admissible transit successors into the set TV(71)
dlt ← 0 // initialisation of selected distance marks(72)
plt ← vkz // initialisation of selected marks-predecessors(73)
end(74)
end(75)
end(76)
end(77)
functionVert_Select(↑vkz)(78)
ifTV ≠ ∅ then(79)
Min_Dist(↓TV, ↑vkz) // selection of a vertex vkz with the lowest distance mark dkz(80)
TV ← TV − {vkz}(81)
ifvkz ∈ FVthen(82)
UV ← UV ∪ {vkz}(83)
end(84)
end(85)
end(86)
functionTry_Change_Mark(↓vkz, ↓vls)(87)
Get_Indexes(↓vkz, ↑k, ↑z)(88)
Get_Indexes(↓vls, ↑l, ↑s)(89)
ifdls > dkz + ε ([vkz, vls]) then(90)
dls ← dkz + ε ([vkz, vls]) // remarking of the successor (vls) of the vertex vkz(91)
pls ← vkz(92)
ifvls ∉ TVthen(93)
TV ← TV ∪ {vls}(94)
end(95)
end(96)
end(97)
functionSucc_Mark(↓vkz, ↓L)(98)
for eachvlt ∈ Vouttrans (vkz)do(99)
if (vlt ∉ XVandκ (vlt) ≥ Landκ (vkz) = ω (vkz)) then(100)
Try_Change_Mark(↓vkz, ↓vlt) // potential remarking of the transit successor of vkz(101)
end(102)
end(103)
for eachvlr ∈ Voutrev(vkz) do(104)
if (vlr ∉ XVandκ (vlr) ≥ L) then(105)
Try_Change_Mark(↓vkz, ↓vlr) // potential remarking of the reverse successor of vkz(106)
end(107)
end(108)
end(109)
functionGet_Path(↑↓Seq)(110)
ifUV ≠ ∅ then(111)
Min_Dist(↓UV, ↑vjy)(112)
Get_Indexes(↓vjy, ↑j, ↑y)(113)
z ← y(114)
k ← j(115)
i ← 0(116)
while (pkz ≠ noneorvkz ∈ SV) do(117)
Seq ← Seq ∪ {[i, vkz]} // successive reconstruction of the shortest path topology(118)
ifvkz ∈ SVthen(119)
exit(120)
end(121)
Predecessor(↓vkz, ↑l, ↑t) // getting a predecessor of the vertex vkz(122)
z ← t(123)
k ← l(124)
i ← i + 1(125)
end(126)
end(127)
endThe main function,Shortest_Path, calculates the shortest relocation route for an object (whose length is L), given the start vertex (from the set SV) and finish vertex (from the set FV). The topology of this route is available through the parameter Topol. For Algorithm 1, the sets SV and FV include one vertex each. Further modifications of this algorithm, however, will permit one or two vertices to be included in either set.The following procedures are carried out within the subroutines/functions (called from the main functionShortest_Path).First, the functionStart_Finish_Test tests admissible combinations of the input parameter values for the route calculation. For the combination to be acceptable, the weight of the start vertex must not be lower than the relocation object length (L), and the finish vertex must have a sufficient vacancy. Furthermore, the Boolean expression (x = y ∧ i ≠ j) must not hold true for the start vertex vix and finish vertex vjy (the above expression describes a situation where the start and finish vertices refer to the same track from which the relocation procedure is started and which is entered by transiting the same end).Furthermore, the functionGeneral_Init is used for initialisation of the marks of distances and the marks of predecessors (through vectors D and P) for all vertices in the graph. The distance marks of all vertices in the digraph G are set at the value d∞ (which is larger than the longest distance between any vertices in the digraph G). The marks of predecessors are set at none for all vertices in the digraph G. The set TV of temporarily marked vertices and the set UV of ultimately marked finish vertices are initialised as empty sets.Additional initialisation procedures associated with the start and finish vertices are subsequently run (through the functionStart_Finish_Init). The start vertex is assigned a distance mark whose value is 0 (i.e., the length of the current shortest route is zero for the start vertex). Now, the set of forbidden vertices is constructed. The vertices from this set must not lie on the shortest route being sought. When the concept of forbidden vertices is applied, the relocation trajectory must not pass through vertices describing those ends of tracks over which it is inadmissible to reach the finish track (with respect to the input requirements for relocation).Next, the admissible successors of the start vertices that can be reached through transit edges are remarked (through the functionStart_Mark). These vertices-successors are assigned (i) distance marks with a value of 0 (through vector D) and (ii) marks of predecessor (in vector P) referring to the start vertex. The remarked vertices are also inserted into the set TV.The complex of initialisation procedures is followed by a computation cycle involving selection of a vertex (through the functionVert_Select) for processing in the current iteration step and the marking of all its admissible successors which is potentially changed (through the function Succ_Mark). This computation cycle is terminated if all the appropriate finish vertices have been ultimately marked or if TV—the set of temporarily marked vertices—is empty.TheVert_Select function always selects that vertex vkz from the set TV that has the lowest value of the distance mark dkz. The Succ_Mark function changes the marking of the accessible successors of the selected vertex vkz if those successors (i) have an available adequate vacancy; (ii) they are not members of the set of forbidden vertices; and (iii) the current values of their distance marks are higher than the new values mirroring their reaching through another route (via vertex vz). Moreover, the Boolean expression (κ (vkz) = ω (vkz)) must hold true for the transit successors to be accessible from the vertex vkz. This expresses the condition that the track to which the vertex vkz refers must be fully available for transiting. This means that the vacancy of the vertex vkz must be equal to the weight of that vertex.If the shortest route has been found, its topology is obtained through the functionGet_Path. The topology is constructed stepwise from the finish vertex to the start vertex by using marks about the vertex predecessors (saved in the row vector P) on the shortest route.At this point, the following comments should be added concerning the implementation of the above algorithm, transformation of its results, and an alternative view upon the start and finish points of the relocation trajectories:(i)
In view of the nature of the algorithm, a data structure called forward star [31] was used for implementation of the digraph G. The forward star structure consists of two basic arrays: a primary array that stores information on the graph vertices and a secondary array that stores information on the directed edges that start from the vertices (saved in the primary array). The secondary array is sorted by the starting edge vertices. This makes it possible for each vertex from the primary array to rapidly access (through its reference to the secondary array) the group of all its successors (which are always stored in the continuous part of the secondary array). For an effective work with the set TV, the Fibonacci heap [11], as a very efficient realization of a priority queue, was chosen for its implementation. The priorities of the elements (or vertices in the digraph G) expressed the values of the respective marks from the row vector D (the higher the priority of an element, the lower the value of its distance mark).(ii)
The configuration of the railway infrastructure can be specified for the needs of the MesoRail simulator [20], for example, within the TrackEd editor [24]. This editor stores infrastructure description in the XML format, which uses templates inspired by the railML standard [27, 28].(iii)
For the implementation approaches used (applying Dijkstra’s algorithm concept), the asymptotical computational complexity of Algorithm1 can be specified as O(m + n log n) [12], where m = |E(G)| and n = |V(G)|. Nevertheless, for typical track routes that are not searched for long distances in real operational conditions, the relevant computations (within rail-traffic simulators) are concentrated on subgraphs (of the digraph G) that are usually not very extensive.(iv)
The result of Algorithm1 computations for the shortest route found in the digraph G can be reversely transformed into the primary model, that is, into the undirected graph G0. This means that the shortest route in the digraph G corresponds to the shortest walk in the graph G0. The walks are outlined graphically in Figures 4–6, illustrating the solution of Examples 1–3 (see later).(v)
In standard parameterisation of theShortest_Path function within Algorithm 1, the start and finish positions of the relocation procedure are assumed to be represented by vertices in the digraph G. This, in fact, means that the relocation object (whose length is L) is located “precisely” at the end of the respective track both at the beginning and at the end of the relocation operation. If it is required that the relocation operation starts and/or finishes on another part of the track, then Algorithm 1 must be slightly modified. The modification will encompass both the marking of the start vertex (and potentially its transit successors as well) and the ultimate marking of the finish vertex. The values of the distance marks assigned to the vertices within the Start_Finish_Init and Start_Mark functions will be set at a value different from 0 (denoted, e.g., reloc1) describing the metric length of relocation to the postulated end of the start track. On the contrary, the value of the ultimate mark of the finish vertex of the relocation (denoted, for instance, val, and indicating the length of the shortest route found) will not describe the length of the relocation object trajectory precisely (denoted, for instance, dist). In fact, the length of the trajectory can be obtained as dist = val + reloc2, where reloc2 refers to the metric length of relocation from the postulated end of the finish track to the end position on that track.Figure 4
Train route related to Example1.
(a)(b)Figure 5
Train route related to Example2.
(a)(b)Figure 6
Train route related to Example3.
(a)(b)


### 4.2. Examples of Using the Basic Algorithm

A few examples of the application of the basic algorithm (Algorithm1) to the computation of various relocation actions are shown in the following. The first example concerns the transfer of a complete train between two station tracks.Example 1.
Computation of a shunting route topology for the train relocation (L = 120).
Figure4 shows two models of a demonstration railway yard represented by graphs G and G0. There is one train 120 m long (relocation object O1) on track #5 (reflected by edge e5 in graph G0) of the yard. The train stands at the track end, referred to as e−5. The requirement is to find a route for transferring the object O1 onto track #4 (represented by edge e4 in graph G0). The object O1 should leave track #5 via the track end referred to as e−5 and enter track #4 via its end referred to as e−4. This setup reflects a situation where track #5 should be made available for other trains and the train in question should be transferred to track #4, so it can leave the yard in the direction to a rail line accessible via track #11.
Parameterization of the algorithm for the track route computation (shortest route in the digraphG) is as follows:(i)
SV = {v25}, FV = {v14}, and L = 120
The weights are given for selected vertices and edges of the relevant graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v14) = ω (v24) = 280, κ (v14) = κ (v24) = 280, v14, v24 ∈ V(G), ε (e4) = 280, e4 ∈ E(G0)(ii)
ω (v15) = ω (v25) = 259, κ (v15) = 0, κ (v25) = 139, v15,v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(iii)
ε ([v14, v117]) = ε ([v24, v219]) = 280, v14,v24, v117, v219 ∈ V(G), [v14,v117], [v24,v219] ∈ Etrans (G)(iv)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 120
The topology of the train route found (which corresponds to the shortest route in the digraphG and can be retransformed into the shortest walk in the graph G0) is as follows:e4(350) ← e19(316) ← e7(276) ← e21(238) ← e8(118) ← e21(80) ← e7(40) ← e20(0) ← e5(0)
The numbers in parentheses (following each member of the walk) are the metric lengths of the relocation object’s trajectory to the points representing the input ends of the edges/tracks reached. The total length of the train’s trajectory during the relocation is 470 m. The value for the last member of the walk is additionally increased byL = 120 due to the fact that the relocation operation must be finished by a partial transfer of the whole object to the finish track (edge). For the computed shortest route in the digraph G, the figure shows the ultimate values of the distance marks for the relevant vertices.
Moreover, the reduced distance matrix (RDM) (forL = 120) between all the admissible couples of the destination vertices in the digraph G is shown in Table 7 (beyond the scope of Example 1). The RDM contains the results of differently parameterized computations made by using Algorithm 1. The matrix reflects the fact that, apart from the relocation object, which is always present on a different start track, the railway yard is entirely empty. The RDM is obtained by simple transformation of the complete distance matrix (CDM). This transformation removes from the CDM those rows and columns whose all elements attain only the d∞ value (i.e., no shortest routes for the given parameter L exist between relevant vertices).
The next example concerns the motion of a shunting engine along a rather complex route for attachment to a specified end of a train set.Table 7
Reduced distance matrix (RDM) for the parameterL = 120 and vacant track layout.
FromToe−1e−4e−5e−6e+6e−8e+8e−9e+9e+10e+11e+12v11v14v15v16v26v18v28v19v29v210v211v212e−1—15331539—193—17651116—19371964960v21e−41533—470733——232—235404431573v24e−51539470—739——238—241410437579v25e+6193———————————v16e−6—733739———965316—11371164160v26e+81765232238965————467——805v18e−8—————————153180—v28e+9—235241———467——639666—v19e−91116——316———————156v29e+1019374044101137—153——639—333977v110e+1119644314371164—180——666333—1004v111e+12960573579160——805156—9771004—v112Example 2.
Computation of a shunting route for the locomotive relocation (L = 20).
Figure5 shows diagrams of graphs G0 and G, which represent infrastructure models analogous to those in Figure 4. A 120 m-long train (object O2) stands on track #5 of the yard; a 100 m-long train set (object O3) stands on track #4; and a 20 m-long shunting locomotive (object O1) stands on track #10. This locomotive is to be moved to end A of train set O3; in other words, it must enter track #4 by transiting its end e+4.
The track route computation algorithm (identifying the shortest route in the digraphG) is parameterized as follows:(i)
SV = {v110}, FV = {v24}, and L = 20
The weights are given for selected vertices and edges in the graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v14) = ω (v24) = 280, κ (v14) = 160, κ (v24) = 20, v14, v24 ∈ V(G), ε (e4) = 280, e4 ∈ E(G0)(ii)
ω (v15) = ω (v25) = 259, κ (v15) = 139, κ (v25) = 0, v15,v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(iii)
ω (v110) = ω (v210) = 175, κ (v110) = 155, κ (v210) = 0, v110, v210 ∈ V(G), ε (e10) = 175, e10 ∈ E(G0)(iv)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 20
The topology of the train route found is as follows:e4(1635) ← e17(1601) ← e3(1581) ← e14(1543) ← e15 (1501) ← e2(1481) ← e15(1439) ← e16(1396) ← e6(669)  ← e24(629) ← e12(609) ← e23(573) ← e9(271) ← e22 (230) ← e7(210) ← e21(172) ← e8(33) ← e25(0) ← e10(0)
The total length of the locomotive’s relocation trajectory is 1655 m. The value given for the last member of the walk is increased byL = 20.
In the last example, shown in the following, a shunting locomotive should be moved from one end of a train set to the other end of that train set.Example 3.
Computation of a shunting route for reapproaching the same train set (L = 20).
A group of wagons, 200 m total length (objectO2), stands on track #5 of the yard whose models are shown in Figure 6. A 20 m-long shunting locomotive (object O1) was disconnected from wagon group end B in order to attach it to end A of that group because this is needed for the planned operations. This means that the locomotive should reapproach the wagon group by transiting the end e+5 of track #5.
The track route computation algorithm (identifying the shortest route in the digraphG) is parameterized as follows:SV = {v25}, FV = {v25}, and L = 20
The weights are given for selected vertices and edges in the graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v15) = ω (v25) = 259, κ (v15) = 0, κ (v25) = 39, v15, v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(ii)
ω (v110) = ω (v210) = 175, κ (v110) = 155, κ (v210) = 0, v110, v210 ∈ V(G), ε (e10) = 175, e10 ∈ E(G0)(iii)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 20
The topology of the train route found is as follows:e5(469) ← e18(428) ← e3(408) ← e17(374) ← e4(94) ← e19(60) ← e7(40) ← e20(0) ← e5(0)
The trajectory run by locomotiveO1 from the starting position (e−5) to the opposite end (e+5) of the same track (track #5) is 469 m long. If the complete length of the locomotive enters track #5, then it has run a trajectory of 489 m long. And it requires another 19 m for attachment to train set O2, whereby the total trajectory length is 508 m.
For demonstration reasons (beyond the scope of Example3), the RDM (for L = 20) for the destination vertices in the digraph G, containing results of the calculations for differently parameterized Algorithm 1, is included in Table 8. This matrix matches the situation where, apart from the relocation object (which is always present on a different start track), the railway yard is entirely empty. From this matrix, one can read that the trajectory of relocation between track #10 (its end e+10) and track #4 (its end e+4) is 664 m long. The shortest track route found passes through track #5. The route for the relocation (between the same tracks) is different (and differently long) from that in Example 2 because track #5 was occupied in that example.Table 8
The RDM for the parameterL = 20 and vacant track layout.
FromToe−1e−2e−3e+3e−4e+4e−5e+5e−6e+6e−7e+7e−8e+8e−9e+9e+10e+11e+12v11v12v13v23v14v24v15v25v16v26v17v27v18v28v19v29v210v211v212e−1—1981639298712352726359—931259658—736916739908935860v21e−2198—16511005141545281619391051271460—538928541710737872v22e+32981001751—1445—1451——2051371——14291028—16011628972v13e−316391651—17514145442861839——360—438—441610637779v23e+435215454—468—15051158932591425414—4921082495664691833v14e−47125144141445—4681141506533619—54—1321442135304331473v24e+535916161—1506115489—9082661432429—5071089510679706848v15e−572652842814511141505—489539633—60—1381456141310337479v25e+693105—2056192596332661044——565—643—646815842984v16e−6—939839—533893539908—1044459——517116—68971660v26e+7658460360—5441460429—5651731———1388———1332v17e−712591271—1371—1425—1432459——1731—58—61230257399v27e+8736538438142913249213850751764358———1466119——457v18e−8————————————————5380—v28e+9739541441—135495141510—64661——1191469—2913181413v19e−9916928—10281442108214561089116——1388—1466—14691638166556v29e+109087106101601304664310679689815230—53—1638291—133629v110e+119357376371628331691337706716842257—80—1665318133—656v111e+12860872779972473833479848609843991332—457561413629656—v112


### 4.3. Modifications of the Basic Algorithm

Conditions for the starting and destination positions different from those associated with Algorithm1 may be used in the parameterization of the dynamic search of routes within a railway yard. The algorithm uses a uniquely defined track end from which the sought-for-train/shunting route should start, and this also applies to the end of the finish track. From the point of view of the final mathematical model (digraph G), it is exactly determined by one start vertex and exactly one finish vertex for the t route sought (thus, the algorithm searches for a single-source single-destination shortest path). In other words, the relation | SV | = | FV | = 1 holds for the set of start vertices SV and the set of finish vertices FV.However, if the whole trackx must be specified as the starting element (hence, leaving it through either of its ends is permissible), then the appropriate parameter of the Shortest_Path function is defined as SV = {v1x, v2x}. The members of the set SV correspond to the opposite ends of the track x in the digraph G. Analogously, the set FV can be constructed as FV = {v1y, v2y} if the entire track is regarded as the destination element and entering it via either end is permissible. So, three different modifications of Algorithm 1, for different variants of construction of the sets SV and FV, are feasible. A summary overview of the Shortest_Path function parameterization options is presented in Table 9.Table 9
Variants of algorithms for calculating the shortest paths.
Start verticesSV ⊂ V(G)Finish verticesFV ⊂ V(G)Search typeAlgorithm1SV = {vix}FV = {vjy}Single-source single-destinationAlgorithm2SV = {v1x, v2x}FV = {v1y, v2y}Two-sources two-destinationsAlgorithm3SV = {v1x, v2x}FV = {vjy}Two-sources single-destinationAlgorithm4SV = {vix}FV = {v1y, v2y}Single-source two-destinationsAlgorithms2–4 differ from the basic Algorithm 1 only due to changes in two subroutines, Start_Finish_Test and Start_Finish_Init, while the remaining parts are identical. The differences in the subroutines include different procedures of testing the admissibility of combinations of the input parameter values and different ways of performing initialisation actions associated with the start and finish vertices.Algorithm 2: Modification of Algorithm 1 for SV = {v1x, v2x} and FV = {v1y, v2y}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orSV = FV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
if (ω (vix) < Lor (κ (v1y) < Landκ (v2y) < L)) then(8)
okay ← false(9)
exit(10)
end(11)
end(12)
end(13)
functionStart_Finish_Init(↓SV, ↓FV)(14)
for eachvjy ∈ FVdo(15)
ifκ (vjy) < Lthen(16)
FV = FV − {vjy} // exclusions of finish vertices with insufficient vacant capacities(17)
end(18)
end(19)
for eachvix ∈ SVdo(20)
Get_Indexes(↓vix, ↑i, ↑x)(21)
dix ← 0(22)
end(23)
XV ← ∅(24)
endThe first alternative to the basic algorithm is Algorithm2, which seeks the shortest admissible route between two two-member sets of vertices (SV and FV) in the digraph G (two-sources two-destinations shortest path). One run of this algorithm provides the required route (through the function Get_Path), and the start vertex (from the set SV) and finish vertex (from the set FV) of that route are uniquely identified. The vertices define the direction in which the start track is left and the direction from which the finish track is entered. The Start_Finish_Init function potentially eliminates (among other things) from the set of finish vertices that vertex whose vacancy is inadequate for accommodating the relocation object whose length is L.The next modification of the basic algorithm is Algorithm3, computing the routes from two start vertices to one finish vertex in the digraph G (two-sources single-destination shortest path). When the process is over, the shorter of the two potentially computed routes is identified. The vertex vby, which is the pair vertex to the vertex vjy ∈ FV, is included into the set of forbidden vertices through the Start_Finish_Init function.The last modification of the basic algorithm is Algorithm4, seeking the shorter of two routes proceeding from one start vertex to two different finish vertices in the digraph G (single-source two-destinations shortest path). That vertex whose vacancy is inadequate with respect to parameter L is potentially eliminated from the set of finish vertices by the Start_Finish_Init function. In addition, that function augments the set of forbidden vertices with the vertex vax—the pair vertex to the vertex vix ∈ SV.Algorithm 3: Modification of Algorithm 1 for SV = {v1x, v2x} and FV = {vjy}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orFV ⊂ SV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
for eachvjy ∈ FVdo(8)
if (ω (vix) < Lorκ (vjy) < L) then(9)
okay ← false(10)
exit(11)
end(12)
end(13)
end(14)
end(15)
functionStart_Finish_Init(↓SV, ↓FV)(16)
for eachvix ∈ SVdo(17)
Get_Indexes(↓vix, ↑i, ↑x)(18)
dix ← 0(19)
end(20)
Get_Indexes(↓vjy, ↑j, ↑y)(21)
b ← (3 − j)(22)
XV ← {vby} // a forbidden vertex vby represents a pair vertex to the finish vertex vjy(23)
endAlgorithm 4: Modification of Algorithm 1 for SV = {vix} and FV = {v1y, v2y}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orSV ⊂ FV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
if (ω (vix) < Lor (κ (v1y) < Landκ (v2y) < L)) then(8)
okay ← false(9)
exit(10)
end(11)
end(12)
end(13)
functionStart_Finish_Init(↓SV, ↓FV)(14)
for eachvjy ∈ FVdo(15)
ifκ (vjy) < Lthen(16)
FV = FV − {vjy} // exclusions of finish vertices with insufficient vacant capacities(17)
end(18)
end(19)
Get_Indexes(↓vix, ↑i, ↑x)(20)
dix ← 0(21)
a ← (3 − i)(22)
XV ← {vax} // a forbidden vertex vax represents a pair vertex to the start vertex vix(23)
end


### 4.4. Verification and Validation

The life cycle of simulation studies/projects consists of a number of partial phases, as described in detail in [32, 33]. Discussed in the following is a part of the life cycle (consisting of several sequentially linked phases), with focus on the construction, verification, and validation of models that are typically used in simulation studies.(a)
Phase of designing and forming a conceptual model(b)
Conceptual model validation phase(c)
Phase of designing and building up a computerized model(d)
Computerized model verification phase(e)
Operational computerized model validation phaseThe models can be briefly characterized as follows:(i)
The conceptual model reflects (with an appropriate degree of abstraction) the object of investigation(ii)
The computerized model represents an implementation of the conceptual model on a computerIn view of the scope of this article, attention (with respect to verification and validation) will not be paid to the whole target rail-traffic simulator (as implemented within the MesoRail tool): instead, only a part of it will be targeted, viz. that part that mirrors the rail infrastructure of the object of investigation and functions determined for computing track routes along which the rail vehicles in question can move on the rail infrastructure.The conceptual model, which reflects the rail infrastructure of the object of investigation (representing the railway system in question) and the functions calculating track routes, uses the following:(i)
A mathematical model weighted digraph, as described in the Final Model section. The digraph is a result of transformation of the primary mathematical model—a weighted undirected graph. The primary model reflects rather intuitively the topological and metric situation of the rail infrastructure associated with the object of investigation.(ii)
The concept of Dijkstra’s algorithm for searching for the shortest paths in graphs. The algorithm had to be modified appreciably for use in problems of determining track routes on the final infrastructure model.Validation of the conceptual model included, in particular, assessment of suitability of both mathematical models for description of the relevant part of the object of investigation and of the algorithms reflecting the selected operations on the object of investigation. This phase used the IV&V (independent verification and validation) approach [33], applied after completing the development of the conceptual model. This implied in practice that the validation was made by an independent third-party professional (from the Czech Railway Infrastructure Administration, State Organization), who was a renowned expert in the railway traffic domain and in the application of computer simulations for the needs of railway traffic optimizations (and was the second author of this paper). The face validation (expert validation) [33] method was used, requiring that the professional performing the validation has deep knowledge of the relevant application domain (railway traffic in this case). The conclusions from the conceptual model validation process were as follows: (i) the designed mathematical models of the rail infrastructure adequately reflect the characteristics of the real railway infrastructure; and (ii) the algorithms for track route computations relating to rail vehicle shunting and train runs have been correctly logically designed so as to be able to provide outputs (i.e., specific track routes) usable in actual railway systems.When developing the computerized model, data structures (mentioned in the conclusion of the Basic Algorithm section) were selected so as to be applicable to the implementation of the weighted digraph (reflecting the rail infrastructure) and to enable effective computations of the implemented track route searching algorithms.The computerized model verification phase included testing of the model’s logical correctness. This means that the track routes found for the specific objects of relocation were tested especially with respect to the following conditions: (i) the length of the relocation object is respected; (ii) those infrastructure elements that are currently occupied by rail vehicles or blocked by the interlocking system are not used; and (iii) reversals are performed on admissible track segments. The testing was made on different data instances (describing 3 different rail yards) applying different relocation object lengths and differently occupied track layouts. Verification was made by the person who had developed the computerized model (and is the first author of this paper). The performance of the algorithms was found to be logically correct (after eliminating a few minor errors).The IV&V approach and the face validation method were also applied (by the same expert as during the conceptual model validation phase) during the operational validation of the computerized model. The expert assessment of results of the track route computations (using the same track layout variant as in the computerized model verification phase) included, in particular, assessment of the operational and technical usability of the track routes identified (for different relocation object lengths) for the track layouts as currently occupied. Following analysis of all the cases of track routes examined (as obtained by using the original algorithms for the computations of the shortest paths on the weighted digraph), the expert concluded that the algorithms performed correctly from both operational and technical aspects. Based on that, this partial computerized model was embedded in the target simulator within the MesoRail software tool.


### 4.5. Technical Notes for Practical Use of Algorithms within Rail-Traffic Simulators

A few technical comments should be added regarding practical use of the algorithms within software tools serving to simulate railway traffic (at the mesoscopic level of detail):(a)
A combined approach can be applied in the simulators when searching for the optimal train routes and shunting routes. This may include selecting from a precalculated static set of essential train routes (constructed before starting the simulation experiments) and application of dynamic computation during the simulation when seeking for the optimum shunting routes. In this manner, the simulation will not be burdened by dynamic search for selected (very frequently repeating) train routes.(b)
It is typical of railway traffic that dedicated track routes are not set on the infrastructure between extremely distant start and finish tracks. Instead, the approach of stepwise construction of several shorter routes is preferred. Taking this into account, the algorithms discussed can be augmented with a limitation regarding the maximum admissible length of the track route being sought. This limitation can be used to put restrictions to the spread of the computation within the appropriate graph. This approach can eliminate undesirable instances of very complex and long shunting routes (found, e.g., in a densely occupied part of the track infrastructure). This means in practice that the algorithm may include identification of the lowest value (dmin) among all distance marks for the vertices currently included in the set TV. The dmin value can be indicated simply when withdrawing a vertex from the set TV through the function Vert_Select. If this value exceeds an expertly defined limiting value dmax, the computation is terminated with the result that no route was found. For the relocation object, this means that, given the current traffic situation, it will have to stay where it is for some time until the traffic situation changes (e.g., when the relevant tracks become available for the operation), and the search for the track route can be repeated.(c)
Given the degree of abstraction applied, the algorithms presented work with a simplification against reality, mainly concerning reversals within the motion of a relocation object. A reversal is defined as a situation where the relocation object stops at a certain position and then continues its motion in the direction opposite to the initial direction. As mentioned above, the infrastructure model presented and the appropriate algorithms always consider a reversal as an operation occurring on one track. In reality, however, more than one track (and switch) can be engaged in the reversal of a relocation object. The simplification is appropriate for simulators working at the mesoscopic level of detail (intended, e.g., for examining the capacity of the infrastructure) because shunting operations, in particular, are not supposed to be examined in great detail. However, when examining railway traffic at the microscopic level, such simplification might provide an unsatisfactory solution, unusable for application.(d)
For practical use of the algorithms in simulation experiments, one must have an idea of how much real time the computations take—such information is important for the assessment of their usability in the simulations because they should not be very time consuming. By way of illustration of the time demands, computation experiments were performed for Algorithm1 (with the highest potential for use in traffic simulations) in a model of a basic railway yard (shown in Figure 3) and in a more extensive model of a larger real railway marshalling yard in Teplička nad Váhom, Slovakia. The latter model (represented by a digraph) contained 1178 vertices (reflecting 589 track segments) and 1905 edges (the total length of tracks in the infrastructure was 75,958 m). Different values of parameter L (reflecting the relocation object lengths) were applied, viz. L = 0, 20, 50, 100, 200, 300, 400, and 500. The shortest routes were computed for all admissible vertex couples, which satisfied the condition that their weight (or vacancy) was not lower than the applied value of parameter L (both models reflected empty railway yards). This, however, also means that—particularly for the more extensive model—such complex routes were computed as would never be actually computed within the simulators. Such routes were included in the experiments for testing purposes only. And in addition, connecting vertices were also considered as the start vertices and finish vertices (except for destination vertices) in order to increase the number of the routes computed.The results of the calculations providing mean durations (tmean) of searches for the shortest route are listed in Table 10. Generally, the mean time of computation of one shortest route within a more extensive demonstration model does not exceed 6 milliseconds, which is a very good figure with respect to the needs of railway traffic simulators. The computations were made on a common PC equipped with an Intel i7-8550U CPU@1.80 GHz processor and 16.0 GB RAM.Table 10
Mean calculation times of Algorithm1 related to searching a shortest path.
|V(G)| (—)|E(G)| (—)L (—)Calculated paths (—)tmean (ms)Demonstration railway yardTotal length of tracks: 3.05 km527802,6520.02202,6520.02504620.031003800.0320056< 0.0130012< 0.01Real railway yardTotal length of tracks: 75.96 km1178190501,386,5065.4020184,4705.305071,5565.0010038,2204.8020023,5624.8030017,2924.8040012,8824.7050011,9904.60The results also reflect computations that did not find the shortest route because none exists. The search for the shortest route between the verticesv25 and v110 for L = 100 in the model shown in Figure 3 is an example: although both vertices have a sufficient vacancy, the vertex v110 is inaccessible because it mirrors that end of track #10 that constitutes the boundary of the model.


## 4.1. Basic Algorithm

The basic algorithm (formalized as Algorithm1) searches for the shortest route in the track layout from a specific start vertex to a specific finish vertex. The start vertex represents the end of the start track transited by the train (whole length is L) when starting its relocation procedure, while the finish vertex represents the end of the finish track transited by the train when approaching the finish position.Algorithm 1:Computation of the shortest path from SV = {vix} to FV = {vjy}
(1)
function Shortest_Path(↓SV, ↓FV, ↓L, ↑Topol)(2)
Topol ← ∅(3)
correct ← true(4)
Start_Finish_Test(↓SV, ↓FV, ↓L, ↑↓correct) // admissibility of the start/finish vertices(5)
ifcorrectthen(6)
General_Init() // setting initial marks of all vertices(7)
Start_Finish_Init(↓SV, ↓FV) // initialisation activities related to the start/finish vertices(8)
Start_Mark(↓SV, ↓L) // remarking of transit successors of the start/finish vertices(9)
repeat(10)
ifTV ≠ ∅ then(11)
Vert_Select(↑vkz) // selection of a new current vertex(12)
ifUV ≠ FVthen(13)
Succ_Mark(↓vkz, ↓L) // remarking successors of the current vertex vkz(14)
end(15)
end(16)
until (TV = ∅ orUV = FV) // algorithm termination testing(17)
Get_Path(↑↓Topol) // getting a topology of the shortest path(18)
end(19)
end(20)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(21)
if (SV = ∅ orFV = ∅) then(22)
okay ← false(23)
exit(24)
end(25)
for eachvix ∈ SVdo(26)
Get_Indexes(↓vix, ↑i, ↑x)(27)
for eachvjy ∈ FVdo(28)
Get_Indexes(↓vjy, ↑j, ↑y)(29)
if (x = yandi ≠ j) then(30)
okay ← false // inadmissible combination of the start and finish vertices(31)
exit(32)
end(33)
if (ω (vix) < Lorκ (vjy) < L) then(34)
okay ← false // inadmissible weights/vacancies of the start/finish vertices(35)
exit(36)
end(37)
end(38)
end(39)
end(40)
functionGeneral_Init()(41)
forz = 1 ton\2do // symbol “\” denotes an integer division(42)
fork = 1 to 2 do(43)
dkz ← d∞ // initialisation of the row vector of distance marks(44)
pkz ← none // initialisation of the row vector of marks-predecessors(45)
end(46)
end(47)
TV ← ∅(48)
UV ← ∅(49)
end(50)
functionStart_Finish_Init(↓SV, ↓FV)(51)
for eachvix ∈ SVdo(52)
Get_Indexes(↓vix, ↑i, ↑x)(53)
for eachvjy ∈ FVdo(54)
Get_Indexes(↓vjy, ↑j, ↑y)(55)
a ← (3 − i)(56)
b ← (3 − j)(57)
ifSV = FVthen(58)
XV ← {vax} // the forbidden vertex vax is a pair vertex to the start vertex vix(59)
else(60)
XV ← {vax, vby} // the forbidden vertex vby is a pair vertex to the finish vertex vjy(61)
dix ← 0 // initialisation of selected distance marks(62)
end(63)
end(64)
end(65)
end(66)
functionStart_Mark(↓SV, ↓L)(67)
for eachvkz ∈ SVdo(68)
for eachvlt ∈ Vouttrans (vkz) do(69)
if (vlt ∉ XVandκ (vlt) ≥ L) then(70)
TV ← TV ∪ {vlt} // insertion of admissible transit successors into the set TV(71)
dlt ← 0 // initialisation of selected distance marks(72)
plt ← vkz // initialisation of selected marks-predecessors(73)
end(74)
end(75)
end(76)
end(77)
functionVert_Select(↑vkz)(78)
ifTV ≠ ∅ then(79)
Min_Dist(↓TV, ↑vkz) // selection of a vertex vkz with the lowest distance mark dkz(80)
TV ← TV − {vkz}(81)
ifvkz ∈ FVthen(82)
UV ← UV ∪ {vkz}(83)
end(84)
end(85)
end(86)
functionTry_Change_Mark(↓vkz, ↓vls)(87)
Get_Indexes(↓vkz, ↑k, ↑z)(88)
Get_Indexes(↓vls, ↑l, ↑s)(89)
ifdls > dkz + ε ([vkz, vls]) then(90)
dls ← dkz + ε ([vkz, vls]) // remarking of the successor (vls) of the vertex vkz(91)
pls ← vkz(92)
ifvls ∉ TVthen(93)
TV ← TV ∪ {vls}(94)
end(95)
end(96)
end(97)
functionSucc_Mark(↓vkz, ↓L)(98)
for eachvlt ∈ Vouttrans (vkz)do(99)
if (vlt ∉ XVandκ (vlt) ≥ Landκ (vkz) = ω (vkz)) then(100)
Try_Change_Mark(↓vkz, ↓vlt) // potential remarking of the transit successor of vkz(101)
end(102)
end(103)
for eachvlr ∈ Voutrev(vkz) do(104)
if (vlr ∉ XVandκ (vlr) ≥ L) then(105)
Try_Change_Mark(↓vkz, ↓vlr) // potential remarking of the reverse successor of vkz(106)
end(107)
end(108)
end(109)
functionGet_Path(↑↓Seq)(110)
ifUV ≠ ∅ then(111)
Min_Dist(↓UV, ↑vjy)(112)
Get_Indexes(↓vjy, ↑j, ↑y)(113)
z ← y(114)
k ← j(115)
i ← 0(116)
while (pkz ≠ noneorvkz ∈ SV) do(117)
Seq ← Seq ∪ {[i, vkz]} // successive reconstruction of the shortest path topology(118)
ifvkz ∈ SVthen(119)
exit(120)
end(121)
Predecessor(↓vkz, ↑l, ↑t) // getting a predecessor of the vertex vkz(122)
z ← t(123)
k ← l(124)
i ← i + 1(125)
end(126)
end(127)
endThe main function,Shortest_Path, calculates the shortest relocation route for an object (whose length is L), given the start vertex (from the set SV) and finish vertex (from the set FV). The topology of this route is available through the parameter Topol. For Algorithm 1, the sets SV and FV include one vertex each. Further modifications of this algorithm, however, will permit one or two vertices to be included in either set.The following procedures are carried out within the subroutines/functions (called from the main functionShortest_Path).First, the functionStart_Finish_Test tests admissible combinations of the input parameter values for the route calculation. For the combination to be acceptable, the weight of the start vertex must not be lower than the relocation object length (L), and the finish vertex must have a sufficient vacancy. Furthermore, the Boolean expression (x = y ∧ i ≠ j) must not hold true for the start vertex vix and finish vertex vjy (the above expression describes a situation where the start and finish vertices refer to the same track from which the relocation procedure is started and which is entered by transiting the same end).Furthermore, the functionGeneral_Init is used for initialisation of the marks of distances and the marks of predecessors (through vectors D and P) for all vertices in the graph. The distance marks of all vertices in the digraph G are set at the value d∞ (which is larger than the longest distance between any vertices in the digraph G). The marks of predecessors are set at none for all vertices in the digraph G. The set TV of temporarily marked vertices and the set UV of ultimately marked finish vertices are initialised as empty sets.Additional initialisation procedures associated with the start and finish vertices are subsequently run (through the functionStart_Finish_Init). The start vertex is assigned a distance mark whose value is 0 (i.e., the length of the current shortest route is zero for the start vertex). Now, the set of forbidden vertices is constructed. The vertices from this set must not lie on the shortest route being sought. When the concept of forbidden vertices is applied, the relocation trajectory must not pass through vertices describing those ends of tracks over which it is inadmissible to reach the finish track (with respect to the input requirements for relocation).Next, the admissible successors of the start vertices that can be reached through transit edges are remarked (through the functionStart_Mark). These vertices-successors are assigned (i) distance marks with a value of 0 (through vector D) and (ii) marks of predecessor (in vector P) referring to the start vertex. The remarked vertices are also inserted into the set TV.The complex of initialisation procedures is followed by a computation cycle involving selection of a vertex (through the functionVert_Select) for processing in the current iteration step and the marking of all its admissible successors which is potentially changed (through the function Succ_Mark). This computation cycle is terminated if all the appropriate finish vertices have been ultimately marked or if TV—the set of temporarily marked vertices—is empty.TheVert_Select function always selects that vertex vkz from the set TV that has the lowest value of the distance mark dkz. The Succ_Mark function changes the marking of the accessible successors of the selected vertex vkz if those successors (i) have an available adequate vacancy; (ii) they are not members of the set of forbidden vertices; and (iii) the current values of their distance marks are higher than the new values mirroring their reaching through another route (via vertex vz). Moreover, the Boolean expression (κ (vkz) = ω (vkz)) must hold true for the transit successors to be accessible from the vertex vkz. This expresses the condition that the track to which the vertex vkz refers must be fully available for transiting. This means that the vacancy of the vertex vkz must be equal to the weight of that vertex.If the shortest route has been found, its topology is obtained through the functionGet_Path. The topology is constructed stepwise from the finish vertex to the start vertex by using marks about the vertex predecessors (saved in the row vector P) on the shortest route.At this point, the following comments should be added concerning the implementation of the above algorithm, transformation of its results, and an alternative view upon the start and finish points of the relocation trajectories:(i)
In view of the nature of the algorithm, a data structure called forward star [31] was used for implementation of the digraph G. The forward star structure consists of two basic arrays: a primary array that stores information on the graph vertices and a secondary array that stores information on the directed edges that start from the vertices (saved in the primary array). The secondary array is sorted by the starting edge vertices. This makes it possible for each vertex from the primary array to rapidly access (through its reference to the secondary array) the group of all its successors (which are always stored in the continuous part of the secondary array). For an effective work with the set TV, the Fibonacci heap [11], as a very efficient realization of a priority queue, was chosen for its implementation. The priorities of the elements (or vertices in the digraph G) expressed the values of the respective marks from the row vector D (the higher the priority of an element, the lower the value of its distance mark).(ii)
The configuration of the railway infrastructure can be specified for the needs of the MesoRail simulator [20], for example, within the TrackEd editor [24]. This editor stores infrastructure description in the XML format, which uses templates inspired by the railML standard [27, 28].(iii)
For the implementation approaches used (applying Dijkstra’s algorithm concept), the asymptotical computational complexity of Algorithm1 can be specified as O(m + n log n) [12], where m = |E(G)| and n = |V(G)|. Nevertheless, for typical track routes that are not searched for long distances in real operational conditions, the relevant computations (within rail-traffic simulators) are concentrated on subgraphs (of the digraph G) that are usually not very extensive.(iv)
The result of Algorithm1 computations for the shortest route found in the digraph G can be reversely transformed into the primary model, that is, into the undirected graph G0. This means that the shortest route in the digraph G corresponds to the shortest walk in the graph G0. The walks are outlined graphically in Figures 4–6, illustrating the solution of Examples 1–3 (see later).(v)
In standard parameterisation of theShortest_Path function within Algorithm 1, the start and finish positions of the relocation procedure are assumed to be represented by vertices in the digraph G. This, in fact, means that the relocation object (whose length is L) is located “precisely” at the end of the respective track both at the beginning and at the end of the relocation operation. If it is required that the relocation operation starts and/or finishes on another part of the track, then Algorithm 1 must be slightly modified. The modification will encompass both the marking of the start vertex (and potentially its transit successors as well) and the ultimate marking of the finish vertex. The values of the distance marks assigned to the vertices within the Start_Finish_Init and Start_Mark functions will be set at a value different from 0 (denoted, e.g., reloc1) describing the metric length of relocation to the postulated end of the start track. On the contrary, the value of the ultimate mark of the finish vertex of the relocation (denoted, for instance, val, and indicating the length of the shortest route found) will not describe the length of the relocation object trajectory precisely (denoted, for instance, dist). In fact, the length of the trajectory can be obtained as dist = val + reloc2, where reloc2 refers to the metric length of relocation from the postulated end of the finish track to the end position on that track.Figure 4
Train route related to Example1.
(a)(b)Figure 5
Train route related to Example2.
(a)(b)Figure 6
Train route related to Example3.
(a)(b)


## 4.2. Examples of Using the Basic Algorithm

A few examples of the application of the basic algorithm (Algorithm1) to the computation of various relocation actions are shown in the following. The first example concerns the transfer of a complete train between two station tracks.Example 1.
Computation of a shunting route topology for the train relocation (L = 120).
Figure4 shows two models of a demonstration railway yard represented by graphs G and G0. There is one train 120 m long (relocation object O1) on track #5 (reflected by edge e5 in graph G0) of the yard. The train stands at the track end, referred to as e−5. The requirement is to find a route for transferring the object O1 onto track #4 (represented by edge e4 in graph G0). The object O1 should leave track #5 via the track end referred to as e−5 and enter track #4 via its end referred to as e−4. This setup reflects a situation where track #5 should be made available for other trains and the train in question should be transferred to track #4, so it can leave the yard in the direction to a rail line accessible via track #11.
Parameterization of the algorithm for the track route computation (shortest route in the digraphG) is as follows:(i)
SV = {v25}, FV = {v14}, and L = 120
The weights are given for selected vertices and edges of the relevant graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v14) = ω (v24) = 280, κ (v14) = κ (v24) = 280, v14, v24 ∈ V(G), ε (e4) = 280, e4 ∈ E(G0)(ii)
ω (v15) = ω (v25) = 259, κ (v15) = 0, κ (v25) = 139, v15,v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(iii)
ε ([v14, v117]) = ε ([v24, v219]) = 280, v14,v24, v117, v219 ∈ V(G), [v14,v117], [v24,v219] ∈ Etrans (G)(iv)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 120
The topology of the train route found (which corresponds to the shortest route in the digraphG and can be retransformed into the shortest walk in the graph G0) is as follows:e4(350) ← e19(316) ← e7(276) ← e21(238) ← e8(118) ← e21(80) ← e7(40) ← e20(0) ← e5(0)
The numbers in parentheses (following each member of the walk) are the metric lengths of the relocation object’s trajectory to the points representing the input ends of the edges/tracks reached. The total length of the train’s trajectory during the relocation is 470 m. The value for the last member of the walk is additionally increased byL = 120 due to the fact that the relocation operation must be finished by a partial transfer of the whole object to the finish track (edge). For the computed shortest route in the digraph G, the figure shows the ultimate values of the distance marks for the relevant vertices.
Moreover, the reduced distance matrix (RDM) (forL = 120) between all the admissible couples of the destination vertices in the digraph G is shown in Table 7 (beyond the scope of Example 1). The RDM contains the results of differently parameterized computations made by using Algorithm 1. The matrix reflects the fact that, apart from the relocation object, which is always present on a different start track, the railway yard is entirely empty. The RDM is obtained by simple transformation of the complete distance matrix (CDM). This transformation removes from the CDM those rows and columns whose all elements attain only the d∞ value (i.e., no shortest routes for the given parameter L exist between relevant vertices).
The next example concerns the motion of a shunting engine along a rather complex route for attachment to a specified end of a train set.Table 7
Reduced distance matrix (RDM) for the parameterL = 120 and vacant track layout.
FromToe−1e−4e−5e−6e+6e−8e+8e−9e+9e+10e+11e+12v11v14v15v16v26v18v28v19v29v210v211v212e−1—15331539—193—17651116—19371964960v21e−41533—470733——232—235404431573v24e−51539470—739——238—241410437579v25e+6193———————————v16e−6—733739———965316—11371164160v26e+81765232238965————467——805v18e−8—————————153180—v28e+9—235241———467——639666—v19e−91116——316———————156v29e+1019374044101137—153——639—333977v110e+1119644314371164—180——666333—1004v111e+12960573579160——805156—9771004—v112Example 2.
Computation of a shunting route for the locomotive relocation (L = 20).
Figure5 shows diagrams of graphs G0 and G, which represent infrastructure models analogous to those in Figure 4. A 120 m-long train (object O2) stands on track #5 of the yard; a 100 m-long train set (object O3) stands on track #4; and a 20 m-long shunting locomotive (object O1) stands on track #10. This locomotive is to be moved to end A of train set O3; in other words, it must enter track #4 by transiting its end e+4.
The track route computation algorithm (identifying the shortest route in the digraphG) is parameterized as follows:(i)
SV = {v110}, FV = {v24}, and L = 20
The weights are given for selected vertices and edges in the graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v14) = ω (v24) = 280, κ (v14) = 160, κ (v24) = 20, v14, v24 ∈ V(G), ε (e4) = 280, e4 ∈ E(G0)(ii)
ω (v15) = ω (v25) = 259, κ (v15) = 139, κ (v25) = 0, v15,v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(iii)
ω (v110) = ω (v210) = 175, κ (v110) = 155, κ (v210) = 0, v110, v210 ∈ V(G), ε (e10) = 175, e10 ∈ E(G0)(iv)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 20
The topology of the train route found is as follows:e4(1635) ← e17(1601) ← e3(1581) ← e14(1543) ← e15 (1501) ← e2(1481) ← e15(1439) ← e16(1396) ← e6(669)  ← e24(629) ← e12(609) ← e23(573) ← e9(271) ← e22 (230) ← e7(210) ← e21(172) ← e8(33) ← e25(0) ← e10(0)
The total length of the locomotive’s relocation trajectory is 1655 m. The value given for the last member of the walk is increased byL = 20.
In the last example, shown in the following, a shunting locomotive should be moved from one end of a train set to the other end of that train set.Example 3.
Computation of a shunting route for reapproaching the same train set (L = 20).
A group of wagons, 200 m total length (objectO2), stands on track #5 of the yard whose models are shown in Figure 6. A 20 m-long shunting locomotive (object O1) was disconnected from wagon group end B in order to attach it to end A of that group because this is needed for the planned operations. This means that the locomotive should reapproach the wagon group by transiting the end e+5 of track #5.
The track route computation algorithm (identifying the shortest route in the digraphG) is parameterized as follows:SV = {v25}, FV = {v25}, and L = 20
The weights are given for selected vertices and edges in the graphs, and current vacancies are quantified for selected vertices in the digraphG:(i)
ω (v15) = ω (v25) = 259, κ (v15) = 0, κ (v25) = 39, v15, v25 ∈ V(G), ε (e5) = 259, e5 ∈ E(G0)(ii)
ω (v110) = ω (v210) = 175, κ (v110) = 155, κ (v210) = 0, v110, v210 ∈ V(G), ε (e10) = 175, e10 ∈ E(G0)(iii)
∀ [vix, vjy] ∈ Erev (G): ε ([vix, vjy]) = 20
The topology of the train route found is as follows:e5(469) ← e18(428) ← e3(408) ← e17(374) ← e4(94) ← e19(60) ← e7(40) ← e20(0) ← e5(0)
The trajectory run by locomotiveO1 from the starting position (e−5) to the opposite end (e+5) of the same track (track #5) is 469 m long. If the complete length of the locomotive enters track #5, then it has run a trajectory of 489 m long. And it requires another 19 m for attachment to train set O2, whereby the total trajectory length is 508 m.
For demonstration reasons (beyond the scope of Example3), the RDM (for L = 20) for the destination vertices in the digraph G, containing results of the calculations for differently parameterized Algorithm 1, is included in Table 8. This matrix matches the situation where, apart from the relocation object (which is always present on a different start track), the railway yard is entirely empty. From this matrix, one can read that the trajectory of relocation between track #10 (its end e+10) and track #4 (its end e+4) is 664 m long. The shortest track route found passes through track #5. The route for the relocation (between the same tracks) is different (and differently long) from that in Example 2 because track #5 was occupied in that example.Table 8
The RDM for the parameterL = 20 and vacant track layout.
FromToe−1e−2e−3e+3e−4e+4e−5e+5e−6e+6e−7e+7e−8e+8e−9e+9e+10e+11e+12v11v12v13v23v14v24v15v25v16v26v17v27v18v28v19v29v210v211v212e−1—1981639298712352726359—931259658—736916739908935860v21e−2198—16511005141545281619391051271460—538928541710737872v22e+32981001751—1445—1451——2051371——14291028—16011628972v13e−316391651—17514145442861839——360—438—441610637779v23e+435215454—468—15051158932591425414—4921082495664691833v14e−47125144141445—4681141506533619—54—1321442135304331473v24e+535916161—1506115489—9082661432429—5071089510679706848v15e−572652842814511141505—489539633—60—1381456141310337479v25e+693105—2056192596332661044——565—643—646815842984v16e−6—939839—533893539908—1044459——517116—68971660v26e+7658460360—5441460429—5651731———1388———1332v17e−712591271—1371—1425—1432459——1731—58—61230257399v27e+8736538438142913249213850751764358———1466119——457v18e−8————————————————5380—v28e+9739541441—135495141510—64661——1191469—2913181413v19e−9916928—10281442108214561089116——1388—1466—14691638166556v29e+109087106101601304664310679689815230—53—1638291—133629v110e+119357376371628331691337706716842257—80—1665318133—656v111e+12860872779972473833479848609843991332—457561413629656—v112


## 4.3. Modifications of the Basic Algorithm

Conditions for the starting and destination positions different from those associated with Algorithm1 may be used in the parameterization of the dynamic search of routes within a railway yard. The algorithm uses a uniquely defined track end from which the sought-for-train/shunting route should start, and this also applies to the end of the finish track. From the point of view of the final mathematical model (digraph G), it is exactly determined by one start vertex and exactly one finish vertex for the t route sought (thus, the algorithm searches for a single-source single-destination shortest path). In other words, the relation | SV | = | FV | = 1 holds for the set of start vertices SV and the set of finish vertices FV.However, if the whole trackx must be specified as the starting element (hence, leaving it through either of its ends is permissible), then the appropriate parameter of the Shortest_Path function is defined as SV = {v1x, v2x}. The members of the set SV correspond to the opposite ends of the track x in the digraph G. Analogously, the set FV can be constructed as FV = {v1y, v2y} if the entire track is regarded as the destination element and entering it via either end is permissible. So, three different modifications of Algorithm 1, for different variants of construction of the sets SV and FV, are feasible. A summary overview of the Shortest_Path function parameterization options is presented in Table 9.Table 9
Variants of algorithms for calculating the shortest paths.
Start verticesSV ⊂ V(G)Finish verticesFV ⊂ V(G)Search typeAlgorithm1SV = {vix}FV = {vjy}Single-source single-destinationAlgorithm2SV = {v1x, v2x}FV = {v1y, v2y}Two-sources two-destinationsAlgorithm3SV = {v1x, v2x}FV = {vjy}Two-sources single-destinationAlgorithm4SV = {vix}FV = {v1y, v2y}Single-source two-destinationsAlgorithms2–4 differ from the basic Algorithm 1 only due to changes in two subroutines, Start_Finish_Test and Start_Finish_Init, while the remaining parts are identical. The differences in the subroutines include different procedures of testing the admissibility of combinations of the input parameter values and different ways of performing initialisation actions associated with the start and finish vertices.Algorithm 2: Modification of Algorithm 1 for SV = {v1x, v2x} and FV = {v1y, v2y}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orSV = FV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
if (ω (vix) < Lor (κ (v1y) < Landκ (v2y) < L)) then(8)
okay ← false(9)
exit(10)
end(11)
end(12)
end(13)
functionStart_Finish_Init(↓SV, ↓FV)(14)
for eachvjy ∈ FVdo(15)
ifκ (vjy) < Lthen(16)
FV = FV − {vjy} // exclusions of finish vertices with insufficient vacant capacities(17)
end(18)
end(19)
for eachvix ∈ SVdo(20)
Get_Indexes(↓vix, ↑i, ↑x)(21)
dix ← 0(22)
end(23)
XV ← ∅(24)
endThe first alternative to the basic algorithm is Algorithm2, which seeks the shortest admissible route between two two-member sets of vertices (SV and FV) in the digraph G (two-sources two-destinations shortest path). One run of this algorithm provides the required route (through the function Get_Path), and the start vertex (from the set SV) and finish vertex (from the set FV) of that route are uniquely identified. The vertices define the direction in which the start track is left and the direction from which the finish track is entered. The Start_Finish_Init function potentially eliminates (among other things) from the set of finish vertices that vertex whose vacancy is inadequate for accommodating the relocation object whose length is L.The next modification of the basic algorithm is Algorithm3, computing the routes from two start vertices to one finish vertex in the digraph G (two-sources single-destination shortest path). When the process is over, the shorter of the two potentially computed routes is identified. The vertex vby, which is the pair vertex to the vertex vjy ∈ FV, is included into the set of forbidden vertices through the Start_Finish_Init function.The last modification of the basic algorithm is Algorithm4, seeking the shorter of two routes proceeding from one start vertex to two different finish vertices in the digraph G (single-source two-destinations shortest path). That vertex whose vacancy is inadequate with respect to parameter L is potentially eliminated from the set of finish vertices by the Start_Finish_Init function. In addition, that function augments the set of forbidden vertices with the vertex vax—the pair vertex to the vertex vix ∈ SV.Algorithm 3: Modification of Algorithm 1 for SV = {v1x, v2x} and FV = {vjy}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orFV ⊂ SV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
for eachvjy ∈ FVdo(8)
if (ω (vix) < Lorκ (vjy) < L) then(9)
okay ← false(10)
exit(11)
end(12)
end(13)
end(14)
end(15)
functionStart_Finish_Init(↓SV, ↓FV)(16)
for eachvix ∈ SVdo(17)
Get_Indexes(↓vix, ↑i, ↑x)(18)
dix ← 0(19)
end(20)
Get_Indexes(↓vjy, ↑j, ↑y)(21)
b ← (3 − j)(22)
XV ← {vby} // a forbidden vertex vby represents a pair vertex to the finish vertex vjy(23)
endAlgorithm 4: Modification of Algorithm 1 for SV = {vix} and FV = {v1y, v2y}.
(1)
functionStart_Finish_Test(↓SV, ↓FV, ↓L, ↓↑okay)(2)
if (SV = ∅ orFV = ∅ orSV ⊂ FV) then(3)
okay ← false(4)
exit(5)
end(6)
for eachvix ∈ SVdo(7)
if (ω (vix) < Lor (κ (v1y) < Landκ (v2y) < L)) then(8)
okay ← false(9)
exit(10)
end(11)
end(12)
end(13)
functionStart_Finish_Init(↓SV, ↓FV)(14)
for eachvjy ∈ FVdo(15)
ifκ (vjy) < Lthen(16)
FV = FV − {vjy} // exclusions of finish vertices with insufficient vacant capacities(17)
end(18)
end(19)
Get_Indexes(↓vix, ↑i, ↑x)(20)
dix ← 0(21)
a ← (3 − i)(22)
XV ← {vax} // a forbidden vertex vax represents a pair vertex to the start vertex vix(23)
end


## 4.4. Verification and Validation

The life cycle of simulation studies/projects consists of a number of partial phases, as described in detail in [32, 33]. Discussed in the following is a part of the life cycle (consisting of several sequentially linked phases), with focus on the construction, verification, and validation of models that are typically used in simulation studies.(a)
Phase of designing and forming a conceptual model(b)
Conceptual model validation phase(c)
Phase of designing and building up a computerized model(d)
Computerized model verification phase(e)
Operational computerized model validation phaseThe models can be briefly characterized as follows:(i)
The conceptual model reflects (with an appropriate degree of abstraction) the object of investigation(ii)
The computerized model represents an implementation of the conceptual model on a computerIn view of the scope of this article, attention (with respect to verification and validation) will not be paid to the whole target rail-traffic simulator (as implemented within the MesoRail tool): instead, only a part of it will be targeted, viz. that part that mirrors the rail infrastructure of the object of investigation and functions determined for computing track routes along which the rail vehicles in question can move on the rail infrastructure.The conceptual model, which reflects the rail infrastructure of the object of investigation (representing the railway system in question) and the functions calculating track routes, uses the following:(i)
A mathematical model weighted digraph, as described in the Final Model section. The digraph is a result of transformation of the primary mathematical model—a weighted undirected graph. The primary model reflects rather intuitively the topological and metric situation of the rail infrastructure associated with the object of investigation.(ii)
The concept of Dijkstra’s algorithm for searching for the shortest paths in graphs. The algorithm had to be modified appreciably for use in problems of determining track routes on the final infrastructure model.Validation of the conceptual model included, in particular, assessment of suitability of both mathematical models for description of the relevant part of the object of investigation and of the algorithms reflecting the selected operations on the object of investigation. This phase used the IV&V (independent verification and validation) approach [33], applied after completing the development of the conceptual model. This implied in practice that the validation was made by an independent third-party professional (from the Czech Railway Infrastructure Administration, State Organization), who was a renowned expert in the railway traffic domain and in the application of computer simulations for the needs of railway traffic optimizations (and was the second author of this paper). The face validation (expert validation) [33] method was used, requiring that the professional performing the validation has deep knowledge of the relevant application domain (railway traffic in this case). The conclusions from the conceptual model validation process were as follows: (i) the designed mathematical models of the rail infrastructure adequately reflect the characteristics of the real railway infrastructure; and (ii) the algorithms for track route computations relating to rail vehicle shunting and train runs have been correctly logically designed so as to be able to provide outputs (i.e., specific track routes) usable in actual railway systems.When developing the computerized model, data structures (mentioned in the conclusion of the Basic Algorithm section) were selected so as to be applicable to the implementation of the weighted digraph (reflecting the rail infrastructure) and to enable effective computations of the implemented track route searching algorithms.The computerized model verification phase included testing of the model’s logical correctness. This means that the track routes found for the specific objects of relocation were tested especially with respect to the following conditions: (i) the length of the relocation object is respected; (ii) those infrastructure elements that are currently occupied by rail vehicles or blocked by the interlocking system are not used; and (iii) reversals are performed on admissible track segments. The testing was made on different data instances (describing 3 different rail yards) applying different relocation object lengths and differently occupied track layouts. Verification was made by the person who had developed the computerized model (and is the first author of this paper). The performance of the algorithms was found to be logically correct (after eliminating a few minor errors).The IV&V approach and the face validation method were also applied (by the same expert as during the conceptual model validation phase) during the operational validation of the computerized model. The expert assessment of results of the track route computations (using the same track layout variant as in the computerized model verification phase) included, in particular, assessment of the operational and technical usability of the track routes identified (for different relocation object lengths) for the track layouts as currently occupied. Following analysis of all the cases of track routes examined (as obtained by using the original algorithms for the computations of the shortest paths on the weighted digraph), the expert concluded that the algorithms performed correctly from both operational and technical aspects. Based on that, this partial computerized model was embedded in the target simulator within the MesoRail software tool.


## 4.5. Technical Notes for Practical Use of Algorithms within Rail-Traffic Simulators

A few technical comments should be added regarding practical use of the algorithms within software tools serving to simulate railway traffic (at the mesoscopic level of detail):(a)
A combined approach can be applied in the simulators when searching for the optimal train routes and shunting routes. This may include selecting from a precalculated static set of essential train routes (constructed before starting the simulation experiments) and application of dynamic computation during the simulation when seeking for the optimum shunting routes. In this manner, the simulation will not be burdened by dynamic search for selected (very frequently repeating) train routes.(b)
It is typical of railway traffic that dedicated track routes are not set on the infrastructure between extremely distant start and finish tracks. Instead, the approach of stepwise construction of several shorter routes is preferred. Taking this into account, the algorithms discussed can be augmented with a limitation regarding the maximum admissible length of the track route being sought. This limitation can be used to put restrictions to the spread of the computation within the appropriate graph. This approach can eliminate undesirable instances of very complex and long shunting routes (found, e.g., in a densely occupied part of the track infrastructure). This means in practice that the algorithm may include identification of the lowest value (dmin) among all distance marks for the vertices currently included in the set TV. The dmin value can be indicated simply when withdrawing a vertex from the set TV through the function Vert_Select. If this value exceeds an expertly defined limiting value dmax, the computation is terminated with the result that no route was found. For the relocation object, this means that, given the current traffic situation, it will have to stay where it is for some time until the traffic situation changes (e.g., when the relevant tracks become available for the operation), and the search for the track route can be repeated.(c)
Given the degree of abstraction applied, the algorithms presented work with a simplification against reality, mainly concerning reversals within the motion of a relocation object. A reversal is defined as a situation where the relocation object stops at a certain position and then continues its motion in the direction opposite to the initial direction. As mentioned above, the infrastructure model presented and the appropriate algorithms always consider a reversal as an operation occurring on one track. In reality, however, more than one track (and switch) can be engaged in the reversal of a relocation object. The simplification is appropriate for simulators working at the mesoscopic level of detail (intended, e.g., for examining the capacity of the infrastructure) because shunting operations, in particular, are not supposed to be examined in great detail. However, when examining railway traffic at the microscopic level, such simplification might provide an unsatisfactory solution, unusable for application.(d)
For practical use of the algorithms in simulation experiments, one must have an idea of how much real time the computations take—such information is important for the assessment of their usability in the simulations because they should not be very time consuming. By way of illustration of the time demands, computation experiments were performed for Algorithm1 (with the highest potential for use in traffic simulations) in a model of a basic railway yard (shown in Figure 3) and in a more extensive model of a larger real railway marshalling yard in Teplička nad Váhom, Slovakia. The latter model (represented by a digraph) contained 1178 vertices (reflecting 589 track segments) and 1905 edges (the total length of tracks in the infrastructure was 75,958 m). Different values of parameter L (reflecting the relocation object lengths) were applied, viz. L = 0, 20, 50, 100, 200, 300, 400, and 500. The shortest routes were computed for all admissible vertex couples, which satisfied the condition that their weight (or vacancy) was not lower than the applied value of parameter L (both models reflected empty railway yards). This, however, also means that—particularly for the more extensive model—such complex routes were computed as would never be actually computed within the simulators. Such routes were included in the experiments for testing purposes only. And in addition, connecting vertices were also considered as the start vertices and finish vertices (except for destination vertices) in order to increase the number of the routes computed.The results of the calculations providing mean durations (tmean) of searches for the shortest route are listed in Table 10. Generally, the mean time of computation of one shortest route within a more extensive demonstration model does not exceed 6 milliseconds, which is a very good figure with respect to the needs of railway traffic simulators. The computations were made on a common PC equipped with an Intel i7-8550U CPU@1.80 GHz processor and 16.0 GB RAM.Table 10
Mean calculation times of Algorithm1 related to searching a shortest path.
|V(G)| (—)|E(G)| (—)L (—)Calculated paths (—)tmean (ms)Demonstration railway yardTotal length of tracks: 3.05 km527802,6520.02202,6520.02504620.031003800.0320056< 0.0130012< 0.01Real railway yardTotal length of tracks: 75.96 km1178190501,386,5065.4020184,4705.305071,5565.0010038,2204.8020023,5624.8030017,2924.8040012,8824.7050011,9904.60The results also reflect computations that did not find the shortest route because none exists. The search for the shortest route between the verticesv25 and v110 for L = 100 in the model shown in Figure 3 is an example: although both vertices have a sufficient vacancy, the vertex v110 is inaccessible because it mirrors that end of track #10 that constitutes the boundary of the model.


## 5. Conclusions

In conclusion, it has been demonstrated that the presented algorithms for automated dynamic calculations of the shortest track route topologies can be used with advantage within mesoscopic rail-traffic simulators to solve current traffic problems. The routes can then be used for shunting postulated relocation objects within the railway infrastructure in the actual occupancy situation. The data to be input when searching for the route include the start and finish positions and length of the object to be relocated.So, the algorithms presented offer a good potential for extending and improving the scope of mesoscopic railway traffic simulators as regards automated identification of track routes especially for rail vehicle shunting.The data specification of the rail infrastructure configuration, which currently uses the XML format, can be transformed in the future into a data description that will be fully compliant with the railML standard.From the managerial aspect, it is noteworthy that it is convenient for the simulation projects in the railway traffic domain to acquire and use such simulation tools as support rapid constructions of the simulation models and fast parameterizations of the simulation experiments. Hence, if the simulation tool selected is equipped with functionalities that automatically compute track routes for specific relocation objects during the run of the simulation program, then such a tool has a comparative advantage over other tools lacking such functionalities. This is so because in this case, the user is freed from the requirement to tediously predefine many track routes, and hence, the time of the development of the target simulation models reflecting the operation of the railway system examined is appreciably shortened.



---

*Source: 8840516-2021-04-05.xml*