A Heuristic Approach to Solving the Train Traffic ReScheduling Problem in Real Time

Effectiveness in managing disturbances and disruptions in railway traffic networks, when they inevitably do occur, is a significant challenge, both from a practical and theoretical perspective. In this paper, we propose a heuristic approach for solving the real-time train traffic re-scheduling problem. This problem is here interpreted as a blocking job-shop scheduling problem, and a hybrid of the mixed graph and alternative graph is used for modelling the infrastructure and traffic dynamics on a mesoscopic level. A heuristic algorithm is developed and applied to resolve the conflicts by re-timing, re-ordering, and locally re-routing the trains. A part of the Southern Swedish railway network from Karlskrona centre to Malmö city is considered for an experimental performance assessment of the approach. The network consists of 290 block sections, and for a one-hour time horizon with around 80 active trains, the algorithm generates a solution in less than ten seconds. A benchmark with the corresponding mixed-integer program formulation, solved by commercial state-of-the-art solver Gurobi, is also conducted to assess the optimality of the generated solutions.


Introduction
The definitions of "system performance" and "quality of service" in railway traffic and transportation vary, but more recent reports, e.g., from the Boston Consultancy Group [1] and the European Commission [2], indicate that many European countries face challenges with regard to the reliability and punctuality of rail services.Several different factors contribute to these challenges, where the frequency and magnitude of disruptions and disturbances is one factor.The effectiveness in managing the disturbances and disruptions in railway traffic networks when they inevitably do occur is another aspect to consider.In this paper, we focus on the latter, and more specifically, on the problem of real-time train traffic re-scheduling, also referred to as train dispatching [3].
In general, the problem of re-scheduling train traffic in real-time is known to be a hard problem to solve by expert traffic dispatchers in practice, as well as by state-of-the-art scheduling software.There is thus often a trade-off that needs to be made regarding permitted computation time and expected solution quality.Heuristic approaches, or approaches based on, e.g., discrete-event simulation, are often rather quick, since they work in a greedy manner, but sometimes they fail to deliver a reasonable solution or even end up in deadlock.Exact approaches, based on, e.g., mixed-integer programming models solved by branch-and-cut algorithms are, on the other hand, less greedy, but can be very time-consuming, especially if the search space is large, and suffer from significant redundancy.Another aspect concerns the selected level of granularity of the traffic and infrastructure model, and this may indirectly affect the computation time and the quality of the solution as well.
Over the latest three decades, a variety of algorithms and methods have been proposed to solve the train traffic re-scheduling (or, train dispatching) problem, see [3][4][5][6] for more recent surveys.These previously proposed approaches have different strengths and limitations, depending on the intended application and context in mind.In Section 2, we provide a more comprehensive summary of state-of-the-art methods addressing this problem.
In this paper, we propose a heuristic approach to solve the real-time train traffic re-scheduling problem.We view the problem as a blocking/no-wait, parallel-machine job-shop scheduling problem [3].A job corresponds to a train's path along a pre-determined sequence of track sections (i.e., machines).Each part of that path corresponds to an operation."blocking/no-wait" constraint refers to that there is no possibility to finish an operation if the next operation of the same job cannot get access to the required machine for processing, i.e. there is no storage space between machines that allows jobs and their current operation to wait for an occupied machine to become available.That is, when an operation of a job is completed, the next operation of that job must immediately start.This corresponds to the train needing at all times to have explicit access to a track section (independent of whether the train is moving or waiting).This problem is here modeled as a graph, where the graph is a hybrid between a mixed graph and an alternative graph.The benefit of using a hybrid graph is the possibility of reducing the number of required computations when constructing the graph.The problem is then solved by a heuristic algorithm.The proposed mixed graph model is discussed in Section 3, and the proposed heuristic algorithm is presented in detail in Section 4. The performance of the proposed approach is assessed in an experimental study, where the approach has been applied to solve a number of disturbance scenarios for a dense part of the Swedish southern railway network system.The performance assessment also includes a benchmark with the commercial optimization software Gurobi (v 6.5.1), using the corresponding mixed integer programming (MIP) model (which is presented in Appendix A).This experimental study is presented in Section 5. Section 6 presents some conclusions from the experimental study and provides pointers to future work.
The JSS paradigm is also explored in the mixed-integer linear programming (MILP) approach proposed by Törnquist Krasemann and Persson in 2007 [13], where the primary focus was on creating and evaluating strategies for reducing the search space via model re-formulations.Different problem formulations were experimentally evaluated in several disturbance scenarios occurring on a double-tracked network with bi-directional traffic, and solved by commercial software for a time horizon of 60-90 min.The effectiveness of the approach and the different strategies were shown to be highly dependent on the size of the problem and type of disturbance.
A heuristic approach based on a MILP formulation was also proposed in [14].A time horizon of 30 to 60 min was defined for testing the disturbing scenarios.The commercial solver CPLEX was used to solve the problem, with an allowed computation time of 180 s.Significant effort was made to tune the heuristic algorithm, and the results were compared with exact ones.For up to a 40 min time horizon, the algorithm generated good results.
A MIP model was also applied on a double-track railway corridor, where the focus is on local re-routing of trains to allow for bi-directional traffic and special constraints to respect the safety requirements [15].
As already mentioned, the real-time train traffic re-scheduling problem is a hard problem to solve.This is often an effect of the large solution space, which may be difficult to efficiently navigate in due to significant redundancy.That is, depending on the problem formulation and selected objective function, Different variations of the method are considered for solving the single-machine problems.The algorithm benefits from re-timing and re-ordering trains, but no re-routing of trains is performed.
A job-shop scheduling approach is also used to insert additional trains to an existing timetable without introducing significant consecutive delays to the already-scheduled trains [26].A branch and bound algorithm and an iterative re-ordering strategy are proposed to solve this problem in real-time.Re-timing and re-ordering are conducted in a greedy manner.They have suggested a new bound for the branch and bound algorithm and an iterative re-ordering algorithm, which helps to find solutions in an acceptable computational time.
The main challenge in this study is to-inspired by previous promising research work-develop, apply and evaluate an effective algorithm that, within 10 s, can find sufficiently good solutions to a number of different types of relevant disturbance scenarios for a medium-sized sub-network and a time horizon of 60-90 min.A hybrid of the mixed graph and alternative graph (a derivation of the disjunctive graph, which satisfies the blocking constraint [11]) formulation is used for modelling the train traffic re-scheduling problem.This graph allows us to model the problem with a minimum number of arcs, which is expected to improve the efficiency of the algorithm.The model of the infrastructure and traffic dynamics is on the mesoscopic level, which considers block sections, clear time and headway distance, based on static parameter values.A heuristic algorithm is developed for conflict resolution.This algorithm is an extension of the algorithm developed by Gholami and Sotskov for hybrid job-shop scheduling problems [27].The extended algorithm provides an effective strategy for visiting the conflicting operations and the algorithm makes use of re-timing, re-ordering, and local re-routing of trains while minimizing train delays.

Modelling the Job-Shop Scheduling Problem Using a Graph
A well-known and efficient way of modelling the job-shop scheduling problem is to use graphs.Graph theory is a well-studied area in the computational sciences, and it provides efficient algorithms and data structures for implementation.These features make the graph a suitable candidate for modeling the problem addressed in this paper.
In a job-shop scheduling problem, there are n jobs that have to be served by m different types of machines.Each job j ∈ J has its own sequence of operations O j = o j,1 , o j,2 , . . ., o j,m to be served by different predefined machines from the set M. The jobs have to be served by machines exclusively.The job-shop scheduling problem can be formulated using a mixed graph model G = (O, C, D), or equivalently by a disjunctive graph model.Let O denote the set of all operations to be executed by a set of different machines M. The set C represents a predefined sequence of operations for each job j to visit machines from the set M. The two operations o j,i and o j ,i which have to be executed on the same machine m ∈ M, cannot be processed simultaneously.This restriction is modelled by an edge o j,i , o j ,i ∈ D (if a mixed graph is used) or equivalently by pairs of disjunctive arcs o j,i , o j ,i , and o j ,i , o j,i } (if a disjunctive graph is used).In this paper, the mixed graph is used for modelling the primary state of the problem.Two vertices, o s and o d as the source and destination vertices, respectively, are added to the model to transform it to a directed acyclic graph.
Using the terms "arc" and "edge" may be confusing.Edges may be directed or undirected; undirected edges are also called "lines", and directed edges are called "arcs" or "arrows".In this paper, the term "edge" is used for undirected edges, and the term "arc" is used for directed edges.
To serve the operations in a job-shop scheduling problem, only one instance of each machine of type m is available.In a hybrid job-shop as a derivation of the job-shop scheduling problem, a set M m (|M m |≥ 1 ) is available to serve the operations [28].The notation m, u is used to indicate a specific machine or resource u from a set M m if it is necessary.These uniform parallel machine sets increase the throughput and provide more flexibility in the scheduling process.
A train is here synonymous with a job in the job-shop scheduling problem.A train route from the source station to the destination can be considered to be a sequence of operations for a job j.Each railroad section is synonymous to a machine m.In Table 1, below, we introduce the notations that are used to describe and define the hybrid graph model, algorithmic approach, and corresponding MIP model.

M
Set of all railway sections (i.e., machines).m The index used to denote a specific section in the set M.

M m
The sub-set of tracks and platforms that belongs to section m. (i.e., parallel machines) m, u A track/platform/resource instance number u from a set M m .J Set of all trains (i.e., jobs).j The index used to denote a specific train.

O
Set of all train events (i.e., operations).

O j
Set of all events that belong to train j.

O m
Set of all events to be scheduled on a section m.O m,u Set of all events to be scheduled on track u of section m. i The index used to denote a specific train event i. o j,i The symbol used to denote the event i which belongs to train j. j, i, m, u Tuple which refers to train j and its event i which occurs in section m and scheduled for track u.When the section is single line u will be ignored.

( )
Prime symbol used to distinguish between two instances (i.e., job j and j ).

Parameters Description c m
The required minimum clear time that must pass after a train has released the assigned track u of section m and before another train may enter track u of section m.

h m
The minimum headway time distance that is required between trains (head-head and tail-tail) that run in sequence on the same track u of section m. d j,i The minimum running time, or dwell time, of event i that belongs to train j. b initial j,i This parameter specifies the initial starting time of event i that belongs to train j. e initial j,i This parameter specifies the initial completion time of event i that belongs to train j. ps j,i This parameter indicates if event i includes a planned stop at the associated segment.

Variables Description
x begin j,i The re-scheduled starting time of event i that belongs to train j.
x end j,i The re-scheduled completion time of event i that belongs to train j .t j,i The tardiness (i.e., delay for train j to complete event i ).z j,i Delay of event i, i ∈ O, exceeding µ time units, which is set to three minutes here.q j,i,u A binary variable which is 1, if the event i uses track u. γ j,i,j ,i A binary variable which is 1, if the event i occurs before event i .λ j,i,j ,i A binary variable which is 1, if the event i is rescheduled to occur after event i .bu f j,i Remaining buffer time for train j to complete an event j, i .

TFD j
The delay for train j once it reaches its final destination, i.e., t j,last which corresponds to the delay when completing its last event.
To solve the job-shop scheduling problem modelled by a graph, for every two conflicting operations the algorithm is responsible for determining the best execution order to reduce the objective function value.A potential conflict occurs when for two events o j,i , and o j ,i belonging to jobs j and j respectively, the following criteria become true: The algorithm is in charge of replacing the set of edges D with a subset of arcs D , which defines the order to be served by a resource.As a result, the set of edges D will be substituted by a selected subset of directed arcs D , and the mixed graph G = (O, C, D) will be transformed into a digraph G = (O, C ∪ D , ∅).
In this paper, a multi-track railway traffic network will be considered as a job-shop scheduling problem with parallel machines (hybrid job-shop) at each stage.

A Heuristic Algorithm for Conflict Resolution in the Mixed Graph G
When a disturbance occurs, a graph G has to be generated from the ongoing and remaining events for all the trains within the predefined time horizon.Later, the algorithm has to resolve the conflicts between trains affected by disturbance and potential knock-on effects.To resolve all the conflicts in a graph G, the algorithm has to visit all conflict pairs, and by replacing the edges with directed arcs, clarify the priorities for using the resources (i.e., the sections and associated tracks).In this research, the objective is to minimize the sum of the total final delay that each train experiences at its final destination (i.e., TFD j = Max 0, x end j,last − e initial j,last , j ∈ J ).We also measure the corresponding when the delay threshold is three minutes, i.e., only delays larger than three minutes are considered, i.e., ∑ TFD +3 j , i f TFD j ≥ 3 min .The reason why the threshold of three minutes is selected is that this threshold is used to log train delays in Sweden.Delays smaller or equal to three minutes are not registered in the system of the responsible authority, Trafikverket (the Swedish National Transport Administration).Furthermore, delays larger than three minutes may cause train connections to be missed, while below three minutes the consequences for transfers in the studied regional-national train system are not that likely.
To visit the conflicting operations, we followed the strategy presented by Gholami and Sotskov for the hybrid job-shop scheduling problem [27].In this strategy, a list of potential candidate operations for conflict resolution will be generated.This list is a collection of ongoing operations, or the first operation of the next trains.After any conflict resolution, the list will be updated, some candidates will be added and, if it is necessary, some will be deleted.An operation will be added to the list if the in-degree value of the related vertex becomes zero (the number of arc ends to a vertex is called the in-degree value of the vertex).The in-degree value decreases when the conflict resolution is done for a parent vertex.When the list is regenerated, the shortest release time of all vertices in the list will be calculated or updated again, and the minimum one will be selected for conflict resolution.A re-ordering may cause a vertex to be deleted from the list.By this approach, all the vertices will be visited only once, unless a re-ordering happens.This strategy decreases the computational time of the algorithm.The second benefit of this approach is that adding a new arc (o j,i , o j ,i ) does not affect any previously visited vertices unless a re-ordering occurs.Dynamic update of data is possible due to this feature.In Algorithm 1, the pseudocode for conflict resolution is presented.
The algorithm starts from a vertex o s and finds all the neighbourhood vertices and adds them to a list of candidate vertices.At each iteration, a vertex with a minimum release time will be selected from the candidate list for conflict resolution.If there is a conflict between the candidate event and those events that previously used that track or section (checkList), a local re-routing will be applied.For local re-routing, a platform or track with minimum availability time will be selected.Meanwhile, if there is still a conflict, the algorithm tries to use re-timing or re-ordering.For conflict resolution between the candidate operation o j ,i and an operation o j,i from the check list, a new arc will be added to the graph G.
After adding the arc (o j,i , o j ,i ), the start time (x begin j ,i ) of operation o j ,i will be postponed to the finishing time (x end j,i ) of operation o j,i on the conflicting track or platform.If the algorithm adds the opposite arc (o j ,i , o j,i ), then operation o j ,i have to be served before the operation o j,i , which means that the predefined order of the trains for using this section is changed.This condition occurs when the algorithm tries to prevent deadlocks (unfeasible solutions), or the operation o j,i has a high tardiness (a delayed train).Six dispatching rules are provided for the conflict resolution process.Table 2 is a description of those dispatching rules.
In the train scheduling problem, a train blocks its current section until obtaining the next section or block.Therefore, swapping is not possible in the train scheduling problem.Accordingly, the addArc function has to satisfy the blocking condition in the graph G (the alternative graph approach).To fulfil the blocking condition, instead of adding an arc from the operation o j,i to the operation o j ,i , an arc from the next operation o j,i+1 with a zero weight will be added to the operation o j ,i .This directed arc means that the operation o j ,i cannot proceed with its execution on the machine m until the operation o j,i+1 starts (x begin j ,i ≥ x begin j,i+1 , meanwhile, the operation o j,i is finished).This condition blocks job j on the previous machine, even if it is completed.If the operation o j,i is the last operation of job j, then an arc with a weight d j,i has to be added.) goes first if no deadlock occurs.

More delay goes first
If there is a conflict between two trains, the one with the largest tardiness (delay) goes first.
The tardiness is calculated as

Less real buffer time goes first
The train with the smallest buffer time goes first.Buffer time is defined as a subtraction of initial ending time and real finishing time bu f j,i = e initial j,i for two operations to be scheduled on the same, occupied machine.

Less programmed buffer time goes first
The train with smallest buffer time goes first.Buffer time is defined as a subtraction of initial ending time and programmed ending time bu f j,i = e initial j,i for two operations to be scheduled on the same, occupied machine.

Less total buffer goes first
The train with smallest total buffer time goes first.Total buffer time is defined as a summation of programmed buffer times until the destination point for the trains, i.e., last ∑ k=i bu f j,k .

Less total processing time
The train with smallest running time to get to the destination goes first (i.e., the minimum total processing time).The total processing time is defined as a summation of required time to pass each section, for a train, i.e.,  To present a conflict between the two operations in the mixed graph approach only one edge is required ( o j,i , o j ,i ∈ D) (See Figure 1a).While in the alternative graph model two arcs are needed, denoted as ( o j,i+1 , o j ,i ) and (o j ,i +1 o j,i ) (See Figure 1b).The events , and , have a conflict on the machines and events , and , on the machine .To present a conflict between the two operations in the mixed graph approach only one edge is required ([ , , , ] ∈ ) (See Figure 1a).While in the alternative graph model two arcs are needed, denoted as ( , , , ) and ( , , ) (See Figure 1b).After conflict resolution in the mixed graph mode (Figure 2a), the operation , could start its processing in minute 14 on the machine (immediately after the completion of the operation , ).While in the alternative graph case (Figure 2b), the starting time of events , is postponed to minute 16, which job has started the event , .The job has waited for 2 min for the machine and is blocked on the machine .In this paper, we propose an approach that is a hybrid between the mixed graph and alternative graph.This hybrid approach makes use of (1) a mixed graph formulation to represent the nonrescheduled timetable in the initial stage of the solution process, and (2) an alternative graph approach when the timetable is to be re-scheduled.The reasons for doing so are as follows: One way to speed up the algorithm is to reduce the number of edges and arcs in the graph .This reduction leads to a lower number of neighbourhood vertices needing to be handled, less feasibility and constraint checking being required, less computational time to update the data at each stage, and a faster traverse in the graph.As the mixed graph model uses one edge to present a conflict between two vertices and alternative graph needs two arcs, the non-rescheduled timetable in the initial stage uses the mixed graph approach (See Figure 1a).However, after the conflict resolution, the algorithm uses the alternative graph approach (adding an arc from next operation) to satisfy the blocking condition (See Figure 2b).This means that for the unsolved part, the graph is modelled like a mixed graph, and for the solved part, it follows the alternative graph modelling approach.
For safety reasons, the trains have to obey a minimum clear time and headway time distance [23].The clear time ( ) is the minimum time that a train must wait before entering a section , which the train just left.This time interval between completion of train and start time of the train can be modelled by changing the weight of the priority arc from zero to .The headway time distance (ℎ ) is the minimum time between two trains and running in the same direction and on the same track of section .The headway distance is the minimum time interval between the start The events , and , have a conflict on the machines and events , and , on the machine .To present a conflict between the two operations in the mixed graph approach only one edge is required ([ , , , ] ∈ ) (See Figure 1a).While in the alternative graph model two arcs are needed, denoted as ( , , , ) and ( , , ) (See Figure 1b).After conflict resolution in the mixed graph mode (Figure 2a), the operation , could start its processing in minute 14 on the machine (immediately after the completion of the operation , ).While in the alternative graph case (Figure 2b), the starting time of events , is postponed to minute 16, which job has started the event , .The job has waited for 2 min for the machine and is blocked on the machine .In this paper, we propose an approach that is a hybrid between the mixed graph and alternative graph.This hybrid approach makes use of (1) a mixed graph formulation to represent the nonrescheduled timetable in the initial stage of the solution process, and (2) an alternative graph approach when the timetable is to be re-scheduled.The reasons for doing so are as follows: One way to speed up the algorithm is to reduce the number of edges and arcs in the graph .This reduction leads to a lower number of neighbourhood vertices needing to be handled, less feasibility and constraint checking being required, less computational time to update the data at each stage, and a faster traverse in the graph.As the mixed graph model uses one edge to present a conflict between two vertices and alternative graph needs two arcs, the non-rescheduled timetable in the initial stage uses the mixed graph approach (See Figure 1a).However, after the conflict resolution, the algorithm uses the alternative graph approach (adding an arc from next operation) to satisfy the blocking condition (See Figure 2b).This means that for the unsolved part, the graph is modelled like a mixed graph, and for the solved part, it follows the alternative graph modelling approach.
For safety reasons, the trains have to obey a minimum clear time and headway time distance [23].The clear time ( ) is the minimum time that a train must wait before entering a section , which the train just left.This time interval between completion of train and start time of the train can be modelled by changing the weight of the priority arc from zero to .The headway time distance (ℎ ) is the minimum time between two trains and running in the same direction and on the same track of section .The headway distance is the minimum time interval between the start After conflict resolution in the mixed graph mode (Figure 2a), the operation o 2,2 could start its processing in minute 14 on the machine m 2 (immediately after the completion of the operation o 1,2 ).While in the alternative graph case (Figure 2b), the starting time of events o 2,2 is postponed to minute 16, which job j 1 has started the event o 1,3 .The job j 1 has waited for 2 min for the machine m 3 and is blocked on the machine m 2 .
In this paper, we propose an approach that is a hybrid between the mixed graph and alternative graph.This hybrid approach makes use of (1) a mixed graph formulation to represent the non-rescheduled timetable in the initial stage of the solution process, and (2) an alternative graph approach when the timetable is to be re-scheduled.The reasons for doing so are as follows: One way to speed up the algorithm is to reduce the number of edges and arcs in the graph G.This reduction leads to a lower number of neighbourhood vertices needing to be handled, less feasibility and constraint checking being required, less computational time to update the data at each stage, and a faster traverse in the graph.As the mixed graph model uses one edge to present a conflict between two vertices and alternative graph needs two arcs, the non-rescheduled timetable in the initial stage uses the mixed graph approach (See Figure 1a).However, after the conflict resolution, the algorithm uses the alternative graph approach (adding an arc from next operation) to satisfy the blocking condition (See Figure 2b).This means that for the unsolved part, the graph is modelled like a mixed graph, and for the solved part, it follows the alternative graph modelling approach.
For safety reasons, the trains have to obey a minimum clear time and headway time distance [23].The clear time (c m ) is the minimum time that a train j must wait before entering a section m, which the train j just left.This time interval between completion of train j and start time of the train j can be modelled by changing the weight of the priority arc from zero to c m .The headway time distance (h m ) is the minimum time between two trains j and j running in the same direction and on the same track of section m.The headway distance is the minimum time interval between the start times, and end times respectively, of two consecutive trains, j and j , which can be modelled by adding a new arc with a weight h m from operation o j,i to o j ,i .The addArc procedure is responsible for adopting the clear time and headway distance.
Figure 3, is an illustration of conflict resolution, considering the clear time and headway distance for the alternative graph model.In Figure 3a, the starting time of operation o 2,1 is increased to minute 11, because, the operation o 1,1 had 4 min of processing time and 1 min of clear time.In Figure 3b, the headway distance is h 1 = 7, which means that the start time of operation o 2,1 must be at least 7 min after the start time of the operation o 1,1 .The starting time of the operation o 2,1 is increased to minute 13.
Algorithms 2018, 11, x FOR PEER REVIEW 9 of 18 times, and end times respectively, of two consecutive trains, and , which can be modelled by adding a new arc with a weight ℎ from operation , to , .The addArc procedure is responsible for adopting the clear time and headway distance.Figure 3, is an illustration of conflict resolution, considering the clear time and headway distance for the alternative graph model.In Figure 3a, the starting time of operation , is increased to minute 11, because, the operation , had 4 min of processing time and 1 min of clear time.In Figure 3b, the headway distance is ℎ = 7, which means that the start time of operation , must be at least 7 min after the start time of the operation .The starting time of the operation , is increased to minute 13.For a decision-making procedure, the algorithm needs some data, such as release time, or buffer time.After any re-timing, re-ordering or local re-routing, these data change.The experiments demonstrate that recalculation of these data has a significant effect on the computational time of the algorithm.Our special visiting approach enables a dynamic update of data for those vertices that will be affected.
After adding a new directed arc from the operation , to the operation , , by considering the commercial stop time (passenger trains are not allowed to leave a station before the initial completion time , ) the minimum start time of an operation , on a track .will be was not a commercial stop, where ′ , is a set of all operations processed by the same resource from a set until now.Additionally, the ending time can be calculated as follows: Considering the clear time restriction, the starting time for an operation , will be calculated as follows: The proposed starting time with consideration of headway distance will change to: A recursive function is used in the updateData function, which updates the release time for all operations that are reachable by the operation , until .The recursive function stops whenever the , value does not change.By viewing the headway distance in the updateData function For a decision-making procedure, the algorithm needs some data, such as release time, or buffer time.After any re-timing, re-ordering or local re-routing, these data change.The experiments demonstrate that recalculation of these data has a significant effect on the computational time of the algorithm.Our special visiting approach enables a dynamic update of data for those vertices that will be affected.
After adding a new directed arc from the operation o j,i to the operation o j ,i , by considering the commercial stop time (passenger trains are not allowed to leave a station before the initial completion time e initial j,i ) the minimum start time of an operation o j ,i on a track m.u will be where O m,u is a set of all operations processed by the same resource u from a set M m until now.
Additionally, the ending time can be calculated as follows: x begin j ,i Considering the clear time restriction, the starting time for an operation o j ,i will be calculated as follows: The proposed starting time with consideration of headway distance will change to: A recursive function is used in the updateData function, which updates the release time for all operations that are reachable by the operation o j ,i until o d .The recursive function stops whenever the x begin j ,i value does not change.By viewing the headway distance in the updateData function (Equation ( 5)), it is possible to ignore the extra arc for the headway distance (see Figure 3).Deletion of this extra arc, which was needed for considering the headway time distance, also helps to reduce the computational time.
Before adding a new arc, the algorithm applies the solution feasibility function.If, by adding a new arc, a circuit appears in the graph G, the generated solution is not feasible.A circuit in the graph is a sign of infeasible resource allocation.A circuit is a chain of two or more operations that are trying to exchange the machines with the next operations (swapping condition).To avoid a circuit, the following lemma is used: Lemma 1.In a directed acyclic graph G, by adding an arc from vertex a to b, a circuit appears if and only if a is reachable from vertex b in the graph G.
If the reachability test confirms a circuit, the algorithm considers the opposite priority and applies the arc related to the opposite alternative approach (re-ordering).Mostly, by adding the opposite alternative arc, no circuit appears, but in rare cases when the algorithm generates a new circuit, the solution would be rejected.

Experimental Set-Up
For the experimental evaluation, the approach was applied to a number of disturbance scenarios occurring within a selected sub-network in the south of Sweden, namely the railway stretch between Karlskrona city to Malmö, via Kristianstad and Hässleholm (see Figure 4,below).From Karlskrona to Hässleholm, the railway line is single-track, and from Hässleholm to Malmö, the line is double-track with a small portion having four tracks between Arlöv and Malmö.This stretch consists of approximately 90 segments, with a total of 290 block sections.For the regional trains that operate between Karlskrona and Malmö (and even further, into Denmark via the Öresund Bridge), there is a travel time of 1 h and 31 min between Karlskrona and Kristianstad, and a travel time between Kristianstad and Malmö of 1 h and 5 min.
In line with the categorization suggested in [29], three types of disturbance scenarios are used: • Category 1 refers to a train suffering from a temporary delay at one particular section, which could occur due to, e.g., delayed train staff, or crowding at platforms resulting in increasing dwell times at stations.

•
Category 2 refers to a train having a permanent malfunction, resulting in increased running times on all line sections it is planned to occupy.

•
Category 3 refers to an infrastructure failure causing, e.g., a speed reduction on a particular section, which results in increased running times for all trains running through that section.
to Hässleholm, the railway line is single-track, and from Hässleholm to Malmö, the line is doubletrack with a small portion having four tracks between Arlöv and Malmö.This stretch consists of approximately 90 segments, with a total of 290 block sections.For the regional trains that operate between Karlskrona and Malmö (and even further, into Denmark via the Öresund Bridge), there is a travel time of 1 h and 31 min between Karlskrona and Kristianstad, and a travel time between Kristianstad and Malmö of 1 h and 5 min.In line with the categorization suggested in [29], three types of disturbance scenarios are used:  Category 1 refers to a train suffering from a temporary delay at one particular section, which could occur due to, e.g., delayed train staff, or crowding at platforms resulting in increasing dwell times at stations. Category 2 refers to a train having a permanent malfunction, resulting in increased running times on all line sections it is planned to occupy. Category 3 refers to an infrastructure failure causing, e.g., a speed reduction on a particular section, which results in increased running times for all trains running through that section.All disturbance scenarios occur between 16:00 and 18:00, which is during peak hours.The re-scheduling time horizons are 1 and 1.5 h time windows, respectively, counting from when the disturbance occurs.The scenarios are described in Table 3 below.The experiments were tested on a laptop with 64-bit Windows 10, equipped with an Intel i7-CPU, 2.60 GHz, with 8 Gigabytes of RAM.
Table 3. Description of the 30 × 2 scenarios that were used in the experimental study.The first number in the scenario-ID specifies which disturbance category it is.For category 2, the disturbance is a percentage increase of the runtime, e.g., 40%.The two rightmost columns specify the size of the problem expressed in a number of train events that are to be re-scheduled.

Results and Analysis
In Tables 4 and 5, the results are summarized.The grey cells include the best solution values found by different dispatching rules (DR-1 to DR-6) configurations.These solution values can be compared with the optimal values generated by MIP model.The two rightmost columns compare the computational time for the MIP model and heuristic algorithm.Since the computation time of the algorithm is not significantly affected by the choice of dispatching rule, the computation time is very similar for all six different configurations, and therefore only one computation time value per scenario is presented in Tables 4 and 5.  beginning of its itinerary and thus may cause knock-on delays if it is delayed.The less total processing time (DR-6) dispatching rule, tries to give priority to trains with less remaining events to leave the tracks as soon as possible.The experimental results demonstrate that this strategy does not work well compared to other dispatching rules.The choice of dispatching rule does not affect the computational time, but the number of events in the re-scheduling time window and selected sub-network has a significant effect on the computational time since the size of the graph G increases quadratically.Figure 5 illustrates the increase of computational time against increase of the time horizon and number of events.Both the size of graph G and the computational time increase quadratically.
Algorithms 2018, 11, x FOR PEER REVIEW 14 of 18 tracks as soon as possible.The experimental results demonstrate that this strategy does not work well compared to other dispatching rules.The choice of dispatching rule does not affect the computational time, but the number of events in the re-scheduling time window and selected sub-network has a significant effect on the computational time since the size of the graph increases quadratically.Figure 5 illustrates the increase of computational time against increase of the time horizon and number of events.Both the size of graph and the computational time increase quadratically.

Conclusions and Future Work
This paper addresses the real-time train traffic re-scheduling problem.A mixed graph is used for modeling the problem as a blocking job-shop scheduling problem.A heuristic algorithm is proposed that benefits from re-timing, re-ordering, and local re-routing.The algorithm benefits also from a dynamic update of data, which accelerates the computations.
The response time for such a real-time computational scheduling tool is a vital factor.In the proposed solution approach, the problem for a 1 h time window is solved in less than 10 s, and for a 1.5 h time window, the computational time is less than 20 s.It is also unknown what time horizon is necessary to consider in different situations and what role this uncertainty would play.Interviews with dispatchers suggest that it differs a lot depending on the situation, context and associated working load.
The objective function is a relevant criterion to control the lateness of trains.However, based on the situation and type of disturbance scenario, the dispatchers also have other concerns and objectives.The investigation of other objective functions and useful solution quality metrics is necessary to investigate in future research.The graph is represented by an adjacency matrix in the current implementation.Using alternative data structures such as adjacency lists, can be an option to investigate the possibility to reduce computational time further.
the analysis of the resulting data and conclusions.Johanna has formulated and implemented the corresponding MIP formulation in java, which was applied to solve the same disturbance scenarios in order to evaluate the level of optimality and efficiency of the algorithmic approach.Both Johanna and Omid contributed significantly to writing the manuscript.Both authors have read and approved the final manuscript.

Figures 1
Figures 1 and 2 illustrate the difference between the mixed graph and alternative graph models for conflict resolution.There are two conflicting trains in the same path on the sections m 1 and m 2 .The train j 1 is planned on the sections m 1 , m 2 , and m 3 .The route for the train j 2 is m 1 , m 2 , and m 4 .The events o 1,1 and o 2,1 have a conflict on the machines m 1 and events o 1,2 and o 2,2 on the machine m 2 .To present a conflict between the two operations in the mixed graph approach only one edge is required

Figure 1 .
Figure 1.Presenting a conflict in a graph : (a) using an edge in the mixed graph model to present a conflict between the two operations; (b) using two arcs in the alternative graph model to present a conflict between two operations.

Figure 2 .
Figure 2. Resolving the conflicts on the machine and in a graph G: (a) conflict resolution using the mixed graph model; (b) conflict resolution using the alternative graph model to support the blocking condition.

Figure 1 .
Figure 1.Presenting a conflict in a graph G : (a) using an edge in the mixed graph model to present a conflict between the two operations; (b) using two arcs in the alternative graph model to present a conflict between two operations.

Figure 1 .
Figure 1.Presenting a conflict in a graph : (a) using an edge in the mixed graph model to present a conflict between the two operations; (b) using two arcs in the alternative graph model to present a conflict between two operations.

Figure 2 .
Figure 2. Resolving the conflicts on the machine and in a graph G: (a) conflict resolution using the mixed graph model; (b) conflict resolution using the alternative graph model to support the blocking condition.

Figure 2 .
Figure 2. Resolving the conflicts on the machine m 1 and m 2 in a graph G : (a) conflict resolution using the mixed graph model; (b) conflict resolution using the alternative graph model to support the blocking condition.

Figure 3 .
Figure 3. Adding the clear time and headway time distance to the alternative graph: (a) the starting time of operation , is increased due to the clear time; (b) the starting time of operation , is increased due to the headway distance.

Figure 3 .
Figure 3. Adding the clear time and headway time distance to the alternative graph: (a) the starting time of operation o 2,1 is increased due to the clear time; (b) the starting time of operation o 2,1 is increased due to the headway distance.

Figure 5 .
Figure 5.The computational time increases quadratically, based on the number of events.

Table 1 .
The notations used for sets, indices, parameters, and variables.
− 1 was a commercial stop.
− 1 was a commercial stop.

Table 4 .
Computational results for 1 h time horizon.