An Algorithm for Rescheduling of Trains under Planned Track Closures

: This work considered a joint problem of train rescheduling and closure planning. The derivation of a new train run schedule and the determination of a closure plan not only must guarantee the satisfaction of all the given constraints but also must optimize the number of accepted closures, the number of approved train runs, and the total time shift between the resultant and the original schedule. Presented is a novel nonlinear mixed integer optimization problem which is valid for a broad class of railway networks. A multi-level hierarchical heuristic algorithm is introduced due to the NP-hardness of the considered optimization problem. The algorithm is able, on an iterative basis, to jointly select closures and train runs, along with the derivation of a train schedule. Results obtained by the algorithm, launched for the conducted experiments, conﬁrm its ability to provide acceptable and feasible solutions in a reasonable amount of time.


Introduction
Scheduling of trains resulting in customer-friendly timetables is a crucial management task in railway transportation. The determination of a schedule of trains is a complex and a challenging thing in itself, even if solved in the presence of full, crisp, and stable information, e.g., References [1][2][3][4]. Unfortunately, such information is unavailable in real-world conditions when different disruptions can occur. Despite a variety of reasons for the disruptions, all of them result in derogation from timetables and delayed arrivals at destinations for railway customers. The outages can be unplanned, e.g., due to infrastructure and facility breakdowns, the acts of God or planned, e.g., connected with the preventive maintenance of infrastructure. Considerations in the paper are focused on the latter case when planned closures of tracks (also named possessions) are taken into account. From now on, a closure is understood as a period when a part of a rail network, i.e., a defined collection of rail tracks, is not available for trains. A case with a given set of closures is only investigated in the paper. Each closure affects an ongoing timetable. A collection of closures can bring about the modification of trains' arrival and departure times at stations (and other points on of the railway network-further called stations-where merging/division of tracks can take place or where trains can overtake one another or stop) or even the cancellation of some trains. The change of an ongoing timetable for trains is called the train rescheduling, which is obligatory due to the necessity to manage a given set of closures. Depending on a size of the set of closures, as well as durations of closures and their time and place relationships, the acceptance of all closures may not be possible. So, the proper closure planning is necessary as it allows for a trade-off between the possibly highest number of accepted closures and the as small as possible deterioration of the original timetable for

•
First, we formulate a novel joint train rescheduling and closure planning as the nonlinear mixed integer optimization problem valid for a wide class of railway networks with the possibility of rerouting and substitutive transport launching. Moreover, our model allows to control each event (e.g., each train runs conflict) independently, in contrast to the methods applying aggregated approach e.g., as the one presented in Reference [7]. The proposed model and resulting algorithms enable solving investigated decision-making problems for general railway networks, but they have been developed taking also into account the specificity of such networks in Poland. • Second, due to the high complexity of the formulated initial problem, we propose a multi-level heuristic solution algorithm based on the decomposition allowing the solution of smaller-size sub-problems. The choice of the heuristic algorithm suitable for real-world applications is justified by the NP-hardness of the problem. The proposed formulation of the optimization problem allows for the rationale of this property. • Third, we confirm the usefulness of the algorithm via the extensive simulation experiments using both randomly generated data but also data originated from the real-world railway network comprising almost 150 stations and 100 trains. The remainder of this paper is organized as follows. Closure planning practices in Poland are outlined in Section 3, and it follows a brief review of related work given in Section 2. The next section presents the model of the considered joint problem of train rescheduling and track closure planning which is based on the graph-matrix representation of a railway network, a train runs timetable, and track closures. Section 5 is devoted to the detailed description of proposed heuristic solution algorithm. The results of experimental evaluation of the algorithm, both for a single track and, first of all, for a real-world case, are given in Section 6. A realworld railway network consisting of up to 95 train runs and 149 train stations serves for the evaluation of the algorithm's quality with respect to different algorithm's, as well as problem's, parameters. Final remarks complete the paper.

Related Work
The problem of train rescheduling under planned closures consists of two partial problems which can be treated separately, and those separate approaches are included in the literature survey. From the standpoint of this paper, however, simultaneous consideration of both partial problems is of greater importance, and, for that reason, the literature review focuses on the joint problem. Finally, since the paper targets the railway network in Poland, a portion of the review is dedicated to local models and methods.
Since the volume of papers dedicated to scheduling of trains and closure planning in railway transportation is considerable, only selected works can be included in a non-dedicated review paper. For additional survey of recent literature, we refer the reader to References [8,9].

Train Rescheduling
The train rescheduling task is a problem quite widely discussed in the literature. It is understood, in the most cases, as the response to a single unforeseen event that prevents the further realization of the transportation plan by the original timetable. As detailed in Reference [10], the problem of rescheduling can be handled as different (re-)scheduling paradigms: offline, done to establish a primary schedule; and online, done mainly to reestablish a schedule that is no longer acceptable (feasible). The main difference, from the standpoint of difficulty of solving is that the former approach can be performed over a significantly longer period of time, while the latter needs to be done quickly, so as not to allow operations on an invalid schedule. The latter approach can, and likely will, lead to such problem formulations and solution algorithms which, in general case, forgo optimality and focus on providing heuristic, sub-optimal solutions instead. It is this approach that we focus on in this paper, although the results can also be applied to formulate a primary schedule. Online approaches can be further divided into static (open-loop) and dynamic (closed-loop), where, in the dynamic cases, not all of the information is readily available during the decision-making process. As new information about decision execution becomes available, it is fed back to the rescheduling algorithm and (possibly) results in new solutions. Finally, prediction of future states of the system is taken into consideration in proactive approaches, as opposed to reactive ones.
The mixed integer programming (MIP) model is proposed in Reference [11] for the train rescheduling problem when a train's initial delays are given, and the minimization of the total delay of all passengers is required. However, specific requirements resulting from the state of railway infrastructure are not taken into account in this work. It is assumed that every route can hold any number of train runs in the same period. The extension of this problem is presented in Reference [12], where the limited number of train runs traveling between two stations at a given time is considered. The problem is formulated using integer linear programming approach and solved using the branch and bound method. Real-world data provided by Deutsche Railways have made it possible to test this approach successfully. A similar model and solution algorithm based on the Lagrange relaxation is proposed in Reference [13]. As a consequence, the problem is decomposed into a sequence of simple optimization tasks each corresponding to one train run. Another integer programming model presented in Reference [14] considers the assumption that, between any two stations, there is no more than one track, which may be occupied by no more than one train run at the same time. However, the authors do not propose any solution to the formulated problem due to its computational complexity. The authors in Reference [15] assume that there are always two tracks between two connected stations, and each of them may be occupied by no more than one train run at the same time. In this case, the genetic algorithm is applied to solve the train rescheduling problem. The discrete dynamic optimization model for train rescheduling problem is given in Reference [16]. The main goal in this case is to maximize punctuality and station satisfaction degree. However, authors also limit their consideration to the single-track railway and, even for this simple scenario, apply the heuristic approach.
More complex models of railway network infrastructure are presented in Reference [17], where it is taken into account that tracks are composed of blocks, and there may be any number of tracks between stations. The optimization model, formulated as a mixed linear programming task, consists of the minimization of two objectives: the total cost of delays and the total time of delays. The CPLEX software was applied to solve the problem. A similar approach is proposed in Reference [18]. Assumptions about railway infrastructure are also adopted in Reference [19], where two methods are proposed. The first one is based on MIP, while the second one uses Constraint Programming. Similarly, the timetable rescheduling, rolling stock rescheduling, and crew (train drivers) rescheduling problems are formulated in Reference [20] using integer programming models. In the mentioned paper, the timetable rescheduling problem is treated as the job shop scheduling, the rolling stock rescheduling problem is presented using the multi-commodity flow in a graph model, and the crew rescheduling problem is seen as the extended set covering. Further research has been done in providing an approach of exchanging blocks of routes with permitted alternative blocks through the means of alternative graph formulations [21,22]. One can also find adaptations of graph methods [23], such as time-space models [24].
As models considering the accurate description of railway infrastructure require too many computational resources to solve problems exactly in an acceptable amount of time, some more time efficient methods and heuristics are often applied. For example, in Reference [25], the authors propose a new approach based on the Statistical Analysis of Propagation of Incidents method, and, in Reference [26], a two-stage procedure is proposed. The first stage rests on the Simulated Annealing and the Tabu Search metaheuristics, whereas the second stage solves a simple integer programming problem. An approach based on MIP that incorporates a possibility of rerouting trains to enable minimizing the number of canceled and delayed trains, while adhering to infrastructure and rolling stock capacity constraints, is presented in Reference [27]. A proposition to apply MIP model to increase a robustness of the timetables is described by authors of Reference [28]. Considerations of the rescheduling problem on a single track unidirectional rail line that adheres to a cyclic schedule are included in Reference [29], where it is assumed that two types of trains (express and local) are dispatched from the origin in an alternating manner. The application of mixed integer programming to minimize combined length of shipping cycle and total dwell time of local trains at all stations is presented. In Reference [30], the authors consider the problem of adjusting the timetable in a case of partial or complete deadlocks. The integer programming formulation is given with the maximization of a service level.
A recent macroscopic approach was presented in Reference [31], where boundary passenger runs within an urban network were tackled. The authors propose a mixed integer programming approach with the use of a space-time network. This is solved for large instances with the use of decomposition. In Reference [32], the authors turn to microscopic modeling of the railway network and consider a problem of rescheduling in dense railway systems which are subject to disturbances. A multi-objective optimization problem is solved heuristically. In Reference [33], a problem of deadhead routing in an urban transit line was tackled. The authors formulate it as an MIP problem which is solved with the use of a CPLEX solver with an embedded branch-and-cut algorithms.

Closure Planning
The papers on the closure planning and, more generally, maintenance scheduling problems or even the maintenance management usually take into account the need of introducing to train timetables a delay as little as possible. Considerations in Reference [34] are focused on the local impact of maintenance on the railway infrastructure. Moreover, the limitation to single routes is taken into account in References [35][36][37][38]. In these papers, the problem of timetable planning is not solved. Instead, the scheduling of maintenance activities is formulated to minimize their impact on a original schedule. According to the argumentation in Reference [36] that such a problem is NP-hard, the application of some heuristic algorithms is appropriate, e.g., in Reference [38], the authors proposed the ant colony optimization method. In Reference [39], authors formulate the problem of planning maintenance windows, which is a concept incorporated by Swedish railways. This particular idea consists of the inclusion of train-free time slots into the tracks during timetable planning. The time windows for potential track closures and their durations are determined in advance, while the train traffic is described regarding statistical flows instead of a final timetable. More detailed surveys on railway maintenance planning activities may be found in References [40,41].
More recently, in Reference [42], a problem of scheduling maintenances in a large-scale network of trams was considered. The authors formulate an MIP and solve it with the use of neighborhood search-like heuristic approach.

Joint Approaches
Some important suggestions for the joint consideration of the maintenance activities scheduling and the train run rescheduling are indicated in References [43,44]. It is pointed out there that a single closure of a track indispensable for the completion of a maintenance activity could be treated as a particular type of train, but the idea has not been sufficiently developed. The concept of a system that helps to plan the closure of tracks with the simultaneous consideration of changes in the timetable is presented in Reference [45]. However, the solution is not based on a formal mathematical model, and the authors assume that new schedules are determined by external systems rail carriers. The joint scheduling of maintenance of the infrastructure (track closures) and rescheduling of train runs is also discussed in References [46,47]. In Reference [47], the author addresses the case when train arrival and departure times may be changed, but train runs cannot be canceled. Two analytical approaches are proposed, i.e., MIP (additionally with the bound and price reduction) and Problem Space Search metaheuristic, which was also presented in Reference [46]. This heuristic allows to generate alternative timetables and then to combine obtained solutions into one final timetable. MIP models are also proposed in References [7,48] for the joint closure planning and timetabling problem. This model includes the possibility of changing train routes, as well. However, it is assumed that such train rescheduling may be performed among a finite number of alternatives given in advance.
Unlike in our work, in Reference [48], the authors assumed that all closures are obligatory and in Reference [49], the authors do not consider particular events concerning conflicts between train runs; instead, they apply flow-based approach which is modeled as MIP with implicit link usage variables and cumulative station entry/exit variables. This model is solved with a Gurobi solver in Python and tested on a set of self-generated instances. In Reference [50], a reformulation is made-link usage variables are made explicit, while entry/exit variables are now binary. This model is further extended in Reference [51] to include crew scheduling.
Train scheduling and preventive maintenance are also jointly considered in Reference [52], where the sum of absolute arrival time deviations of real trains at destinations between the identical and actual timetables is minimized. A proactive approach to planning maintenance windows is presented as the authors try to ensure that maintenance work is already included in the schedule. The problem is formulated as an MIP and solved with the use of Lagrange relaxation. Another MIP approach presented in Reference [53] is aimed at incorporating new closures in a way that disturbs the original schedule the least. This approach is tested on date from a cut-out of the Netherlands railway system. An MIP approach tested on the French railway network can be found in Reference [54].
The authors of Reference [8] develop a microscopic approach, where timetabling and maintenance scheduling is formulated as a mixed integer programming problem. To alleviate computational difficulties of finding an exact solution, an iterative algorithm based on decomposition is proposed. It is shown that it results in near-optimal solutions for the tested cases. For Reference [55], an MIP formulation was applied to high-speed networks, where, in order to alleviated maintenance-induced problems, switches to normal-speed network were employed. Finally, in Reference [9], the authors use a dynamic constraintgeneration technique coupled with Lagrangian relaxation for a double-track network with transmittable maintenances. The method was proven effective on a small section of a Chinese railway system.
Mixing the microscopic and the macroscopic approaches leads to intermediate, socalled mesoscopic models. As an example, in Reference [56], the authors consider a two-stage algorithm as a means of problem decomposition which speeds-up the algo-rithm execution time. The algorithm is tested on a network of 66 stations in case of a single, full blockade of a selected connection. This approach is further explored in Reference [57], where online, closed-loop rescheduling is done with the use of model model predictive control.
Further integration of traffic control and train operation is considered in Reference [58], where train speeds are considered. The authors formulate a nonlinear integer programming problem which they then simplify by approximating the nonlinearities with piecewise linear functions. To solve the many formulated sub-problems, the authors use a solver, a genetic algorithm and a custom procedure. The method is tested on a railway network of 40 nodes. In Reference [59], the authors consider two control loops: inner, which is responsible for managing immediate train operation and outer, where traffic control is done. The authors focus on Automated Train Operation subsystem of the Automatic Train Control system, and they provide an extensive review on the subject.
In our paper, we propose a joint approach that focuses on specifics of the Polish Railways. This leads to a new decision-making problem, which is formulated with a unique combination of constraints, such as limits in total travel time extension and total distance extension, that might arise during rescheduling. This problem is, by nature, highly nonlinear, mainly due to to existence of a large number of binary variables, and it cannot be solved quickly to optimality (or, in fact, to feasibility), in the general case. We prove that property by showing that the problem is NP-hard. Our quality criterion consists of three types of sub-criteria: number of accepted train runs, number of accepted closures, and the total deviation of the new schedule from the original schedule. To solve such a problem, we propose a four level solution algorithm that attempts to iteratively include train runs and closures and optimizes the total deviation. This iterative character, if left unchecked, leads to long execution times. We reduce those times by providing a Track Grouping Algorithm that divides the railway network into smaller sub-networks which are easier to optimize.

Current Closure Planning Practices in Poland
In Poland, the national company Polish Railways is the owner of the whole railway infrastructure. Closures are planned due to either maintenance or investment works. All maintenance activities and investment works are scheduled by local departments and corresponding investment sections, even though the execution is outsourced. A closure planning is performed in three-time horizons, i.e., • long-term planning-performed once a year; there is no initial timetable and only long term closures are known in advance and may be taken into consideration, the aim is to prepare an initial closure plan and a timetable; both may be slightly modified later during the year; • periodic planning-carried out every two months; the initial closure plan and a timetable which were prepared during long-term planning are given, but there is also number of new closure requests which have been appeared meantime; such closures impose changes in closure plan and timetable, so the aim is to obtain new closure plan and modified timetable; however, the new timetable cannot differ much from the initial one; and • weekly planning-performed once a week, the valid closure plan and timetable obtained during periodic planning are given, but some new, short-term closure requests may appear, and they can be added to the closure plan if only no changes in closure plan and timetable are required.
For each mentioned time horizon, closure plans are made according to the hierarchical organizational structure of the Polish Railways. Firstly, local departments prepare closures plans, and they are coordinated between neighboring local departments. Then, the plans are verified, corrected, and coordinated similarly at the regional level. The precise rules of the closure planning are defined in the particular instruction Ir-19 [60,61]. From the Polish Railways' point of view, the most crucial is the periodic planning, since there are only 48 h to prepare final closure plan for the next two months having only limited changes in the initial timetable. Our approach is, first of all, designed just for such planning process.

Joint Problem of Train Rescheduling and Track Closure Planning
The formalization of the considered joint problem is discussed in this section. The graph-matrix representations of a railway network, a train timetable, and track closures are given in Sections 4.2-4.4, respectively. It follows the summarization of the most crucial notation in Section 4.1. The mathematical model of the joint problem presented in Section 4.5 is preceded by the introduction of corresponding models for sub-problems of the track closure planning and the train scheduling.

Notation
The mathematical model, which is presented in the next sub-sections, refers to a railway network, a train timetable, and closures. A unified style of notation is used for matrices and sets. Entries of matrices are indicated by subscripts, and their number shows the dimension of a matrix. For example, a single lower index indicates a vector. Superscripts are used exclusively for indicating the meaning of the variable. Each matrix itself is denoted by a bold italic type, and its elements are devoid of bold formatting. Sets and their cardinalities are represented by upper-case letters typed in bold and italics, respectively. The concise recapitulation of the most important notation is given in Tables 1-3.

Representation of a Railway Network
Tracks and stations are basic elements of a railway network for the considered problem. A track is a link connecting directly two different stations. Every pair of stations i and j can be linked by K tracks of the same length, i.e., d i,j = d j,i (d i,j is an element of a matrix D = [d i,j ] i,j∈V ). Track numbers constitute a set K = {0, 1, 2, . . . , K} the same for every pair of stations. A railway network is described by a multigraph G =< V, E >. The stations from a set V = {0, 1, 2, . . . , V} represent railway stations, while entries of the incidence matrix E = [e i,j,k ] i,j∈V,k∈K express tracks between particular railway stations. A virtual railway station denoted as '0' is distinguished to serve as the beginning and the end of each train run in the model. It is located in zero-distance to other stations (d 0,j = d j,0 = 0). The existence of the track number '0' enables taking into account a substitute transport between stations of the same distance as real-world links. Consequently, a current entry e i,j,k of E is equal 1(0) if there exists track k from i to j (otherwise), as in Figure 1.

Representation of Train Timetable
In the paper, the train transport is considered to handle the flow of people traveling between stations. Many time demands and restrictions are imposed on resources (trains) and infrastructure (railway network) involved in such transport. They are reflected in a timetable, which takes into account not only constraints resulting from the joint use of resources and infrastructure, as well as their availability, but also nationally oriented regulations, along with other technical limitations. The railway transport is organized as a set of TR train runs (or trains) TR = {1, 2, . . . , TR} which have specified routes with distinguished origins, destinations, and stopping stations provided with departure and arrival times at each station.
More specifically, each train p ∈ TR consists of a set of stations and a connected available set of tracks. They are organized in routes denoted by if train p goes from station i to j by track k (otherwise). The timetable determines when the train p arrives and departures at station i, which is a part of a route R T p . The arrival and departure times of p at station i belonging to route R T p are denoted by t ARR i,p , t DEP i,p , respectively. Besides the virtual station i = 0, some obvious relations among the times are valid, like every departure time at a station must be not less than the corresponding arrival time, and an arrival time of the consecutively visited station i specified in R T p must be not less than the departure time from the previous one. Moreover, maximal arrival T ARR The timetable for train run p is represented by a tuple TT G p =< R T p , (t ARR i,p , t DEP i,p ) i∈V >, which forms for all trains the original timetable denoted by T T G = [TT G p ] p∈TR . The timetable is not valid if, for any train run, any station exceeds its capacity CAP i (see Formula (7)). For stations that do not belong to the train route, all arrival and departure times are equal 0.

Representation of Track Closures
Some maintenance tasks of a railway infrastructure require track closures when no train is allowed to use servicing tracks. Consequently, track closures may affect timetables. Closures can be brought in periodically during a day or night for short periods, or they may be planned for longer periods: days, weeks, or even months. They can be assumed as a factor competing for a track possession together with train runs included in a timetable, as in Figure 2.
Let C = {1, 2, . . . , C} be a set of C track closures envisaged for the implementation. It is composed of C OB obligatory closures and C − C OB optional closures, i.e., C = {1, 2, . . . , C OB , C OB + 1, C OB + 2, . . . , C}. The obligatory closures have to be included in the maintenance plan, unlike latter ones, which can be discarded if they interfere greatly the original timetable. An individual closure n ∈ C is defined by a tuple

Mathematical Model
At first, sub-problems of track closure planning and train rescheduling together with their mathematical models are separately introduced in Sections 4.5.1 and 4.5.2, respectively. Then, in Section 4.5.3, the joint problem is stated in the form of the corresponding mathematical model as the composition of the models of sub-problems. All optimization (decision) variables defined in this subsection is summarized in Table 4. Their verbal descriptions are only given in this subsection. The problem of track closure planning deals with finding of the possibly largest set of track closures (containing all obligatory closures) with fixed start times of closures that can be performed without interfering with a train run timetable. To this end, a binary decision vector y = [y n ] n∈C responsible for the planning of closures is introduced, where y n = 1(0) if the nth closure is selected for the execution (otherwise). A positive-valued time shift (shift) of the closure earliest starting time ∆t C = [∆t C n ] n∈C is the second decision variable for planning the track closures. When the time shift is determined, the closure must start at the earliest starting time plus shift. Decision variables ∆t C and y define the resulted track closure plan S = [S n ] n∈C , where S n =< R C n,i,j,k · y n , max{t CES n , t CES n + ∆t C n }, min{t CLS n , t CLS n + ∆t C n }, T C n >, and have to satisfy the constraints concerning obligatoriness, disjointness, and starting times of closures (see Formulas (2)-(4)). The track closure planning has to take into account the existing train timetable, which can affect likely conflicts in the track possessions by trains and closures.

Train Rescheduling
In fact, the train rescheduling deals with the elaboration of decision variables in the form of a new route plan Both time shifts, together with the arrival and departure times from the original timetable T T G , define new arrival and departure times. The existence of some planned closures, unknown while preparing the original timetable T T G , is the only reason for rescheduling that is for the elaboration of a new timetable T T. No other unexpected events justifying possible rescheduling are taken into account in this paper. The considered track closures may directly affect train runs by their delaying, accelerating, or even canceling. The latter possibility is expressed in the model by an auxiliary decision variable x = [x p ] p∈TR influencing T T by constraint (see Formula (9), where x p = 1(0) if the pth train run is present in the new timetable (otherwise). It is important to point out that some train runs denoted by TR OB ⊆ TR may exist and have to be obligatorily inserted into T T. The train rescheduling has to obey some regulations on any train travel time extensions concerning timetable T T G . They assure that the total travel time extension cannot exceed the given limit T E , and the travel time extension on a given distance D L cannot exceed the given limit T DE (see Formulas (10) and (11)).
The matrices r T , ∆t ARR , ∆t DEP , and x, or equivalently T T, comprise all decisions made while rescheduling of trains.

Final Model and Its Analysis
Two groups of decisions y, ∆t C , as well as T T, together with x introduced in two previous sub-sections, are mutually dependent. The plan of track closures y, ∆t C usually entails changes in the timetable T T G , like the cancellation of trains and the shift of departure and (or) arrival times at stations. On the other hand, it is necessary to bear in mind strong limitations that are imposed on the plan of track closures by the original timetable T T G being the basis and the source of technical restrictions for T T. So, the claim is entitled that ∆t C and y directly influences T T, and the indirect opposite impact is also valid, which forces the joint making of both groups of decisions ∆t C , y and T T. In the paper, the decisions are taken in the time horizon limited to the interval [0,  (14), -the arrival time of every train at every station must not be later than corresponding departure time (15), and no train can occupy a track during a closure (16).
Constraints imposed on track closures: Constraints imposed on train runs: Constraints imposed on train routes: Constraint imposed on train run times: Constraint imposed on both train runs and track closures: The auxiliary notions used in (17) and (16) have the following meanings: M-big number, }-set of closures reporting possession of the same track, ≤ t DEP i,p }-sub-set of trains with dwell time on the station i coinciding with that of the train run p, i,r }-sub-set of train runs going from i to j in time coincided with the run of train p, n + T C n }-sub-set of track closures on the path from i to j in time coincided with the run of train p, ,j,k · d i(l−1),j < D L }-set of stations, for which train run p runs a distance less than D L , but it will reach or exceed this value on arrival to the next station.
Many interconnections between two groups of decisions ∆t C , y, and T T are also visible while analyzing the constraints, e.g., (16). They are the additional justification for joint determination of both groups of decisions.
To evaluate the decisions y, ∆t C , as well as T T, the following criterion is proposed: where α and β are positive-valued coefficients satisfying the inequalities α > TR − TR The introduced criterion reflects the Polish Railways expectations. The most important is to perform as many closures as possible, since they are crucial for maintenance of railway tracks and affect the long-term rail traffic management. Thus, the first element of (17) evaluate number of closures which are to be performed according to the solution. The α parameter chosen according to the imposed constraint ensures that every closure is more important than any acceptable change in timetable. While we cannot increase the number of closures, we should try to limit the number of the train runs that are to be canceled. Thus, the second element of (17) evaluates number of train runs which remain in the new timetable. The β parameter chosen according to the given constraint provides that not canceling any train run is more important than introducing any changes in the departure times in the new timetable. At last, when we can increase neither the number of closures nor the number of train runs, we should try to minimize the total time changes in the new timetable, which is reflected by the last element of the objective function. Such form of the criterion ensures the hierarchy of the decisions, i.e., the acceptance of optional closures is the most important, whereas the differences of departure times in the timetables are the least important.
To sum up, the following joint train rescheduling and track closure planning problem is considered and solved. Decisions are made in relation to the railway system which consists of a railway infrastructure and train runs described by G, V, TR, TR OB , T T G , D, CAP i , The planned closures are also given in the form of C, C, C OB , O, S G (S n =< R C n , t CES n , t CLS n , T C n >, n ∈ C). The auxiliary data T DL , T DE , T E are known, as well. It is necessary to determine the interconnected collection of decisions: ∆t C , y constituting the resulted track closure plan, and r T ,∆t ARR , ∆t DEP , x defining the new timetable plan T T subject to constraints (1)- (16) to minimize the criterion (17).
The conducted analysis of the formulated nonlinear mixed integer optimization problem referred to as PR made it possible to put forward and prove the following theorem. Proof. Let us consider the NP-hard problem of task scheduling around a common date presented in Reference [62]. Given one executor and J tasks, durations of tasks duration j ≥ 0, j = 1, 2, . . . , J and a common deadline deadline ≤ ∑ j∈{1,2,...,J} duration j find a schedule, i.e., task completion times f inish j , that minimizes the total earliness and tardiness of each task, i.e., quality = ∑ j∈{1,2,...,J} | f inish j − deadline|. We show that this scheduling problem reduces, in polynomial time, to the investigated problem PR. We accomplish this by showing that we can reduce the scheduling problem to an equivalent problem PR with only single track and carefully selected set of closures.
We take a time horizon sufficient to encompass the duration of all tasks (T H = ∑ j duration j ). Let us assume that all closures and train runs are obligatory (y n = 1, x p = 1). Define the graph G so that there are 3 stations connected in a cycle 0 → 1 → 2 → 0, and that there are J + 1 tracks between stations 1 and 2. We take J trains, where each train moves once through the whole cycle of stations but through different track each: pth train takes pth track between stations 1 and 2 (R T p,0,1,1 = 1, R T p,1,2,p = 1, R T p,2,0,1 = 1). The departure time for the artificial station is 0 for every train and so is the arrival in station 1. Departure time in station 1, as well as minimum dwelling time, is set to deadline − duration j . Arrival time in station 2 for the pth train is equal to deadline. Minimum dwelling time in station 2 is 0. Maximal dwell times are set to be very large (T DL = T H ). Note that the schedule is feasible.
Let us further consider a set of J closures, where the nth closure takes up track n of the connection between stations 1 and 2 (R C n,1,2,n = 1) with the earliest and the latest start times all bound by 0 and very large durations (t CES n = t CLS n = 0,T C n = T H ). The addition of closures forces all the trains onto the last track J + 1, where they cannot proceed in parallel. Due to dwelling times in station 2, the quality criterion is equal to Q = ∑ j∈{1,2,...,J} |∆t DEP 1,j | + ∑ j∈{1,2,...,J} |∆t DEP 2,j | = 2 ∑ j∈{1,2,...,J} |∆t DEP 2,j | = 2 ∑ j∈{1,2,...,J} |t DEP 2,j + ∆t DEP 2,j − deadline|. Sum t DEP 2,j + ∆t DEP 2,j is the moment the train run ends. Thus, we equate it to f inish j . Then, quality = 1 2 Q. Please note that all the transformations can be made in the polynomial time.

Heuristic Solution Algorithm
The optimization problem PR formulated in the previous section should be solved in a reasonable amount of time. For example in Poland, at least a single feasible solution is required within 48 h. It is very tough to fulfill such requirements due to the NP-hardness of PR, as well as its non-linearity and the huge dimension with respect both to the number of variables and to the number of constraints. The whole Polish railway network there is represented by over 10 12 binary and 10 8 integer variables. The transformation of the considered problem into MIP using 'big M' to solve it by a known solver failed. It resulted in the enormous growth of the problem's dimension, and, in consequence, the approach turned out useless due to the non-acceptable computation time. Another considered approach assumed the application of selected metaheuristics. It also failed as the significant calculation effort was mostly devoted to checking infeasible solutions. Unfortunately, there is no a simple method for the generation of any initial train runs timetable and a closure plan fulfilling all the constraints under consideration. The utmost case is possible for a metaheuristic-based solution algorithm when the feasible execution time can elapse before any solution is sought. Therefore, the problem-specific heuristic algorithm is proposed, which is based on some simplifications and decompositions neglecting some connections between variables and constraints. However, due to the complexity of the problem, the solution algorithm might not guarantee feasible solutions for some of the strongly constrained cases. The detailed presentation of the algorithm's components in the subsequent sub-sections follows the overview of the algorithm.
A multi-level algorithm of the hierarchical parallel structure is proposed, as in Figure 3. There are four main levels of algorithms which are dependent on one another, i.e., an upper level algorithm requires (usually multiple) solutions of the lower level algorithm. Algorithm 1 is responsible for the selection of facultative closures. Algorithm 2 provides the selection of facultative train runs. Algorithm 3 is responsible for decomposition of the railway network into smaller, more manageable parts. This is done with the help of a separate Track Grouping Algorithm (TGA). Finally, Algorithm 4 is responsible for finding actual schedules under given closures, train runs and decomposition. Algorithm 4 itself is further divided into Algorithms 5, 6, and 7. Those sub-algorithms are run for every sub-network that was obtained with the use of Algorithm 3. Algorithm 1 sequentially approves individual closures for launching in such a way to ensure the generation of feasible timetables. The feasibility of a current closure is checked by all other algorithms. Algorithm 1 decides via y n on the inclusion of the current closure into the set of accepted closures according to information returned by Algorithm 2. However, it is necessary to cover all obligatory closures. On the analogous basis, Algorithm 2 using x sequentially, i.e., one by one, forms the set of accepted trains for the new timetable. It takes into account information returned by Algorithm 3 which, in turn, is launched at every iteration of Algorithm 2. Algorithm 3 assumes the decomposition of a railway network performed by the Track Grouping Algorithm TGA into η groups (railway sub-networks). For each sub-network, Algorithm 4 is launched to obtain train runs and track closures time shifts ∆t ARR , ∆t DEP , and ∆t C for this fragment of the network. If rerouting is needed, then Algorithm 4 also returns the routes r T .
The following optimization tasks are performed by Algorithm 4 for every sub-network: a track order, a station order, and a time shift resolution, where first two tasks are Mixed Integer Linear Programming (MILP), while the last one is the Linear Programming (LP). All of them are iteratively solved with the combined use of a greedy algorithm and the numerical solver 'lp_solve' [63], giving solutions of resulted LP. As a consequence, the decision variables of the considered problem, i.e., y, x and ∆t C , r T , ∆t ARR , ∆t DEP are the results of Algorithms 1, 2, 3, 4, together with TGA, respectively. The matrices r T , ∆t ARR , ∆t DEP , along with x, form the new timetable Similarly, the time shifts for closures ∆t C , together with y, define the resulted track closure plan S = [S n ] n∈C , where S n =< r C n , t CSE n , t CSL n , T C n >, r C n = R C n,i,j,k · y n , t CSE n = max{t CES n , t CES n + ∆t C n }, t CSL n = min{t CLS n , t CLS n + ∆t C n }. Algorithms 1, 2, 3, 4 and TGA are introduced in the next subsections. The detailed description of Algorithm TGA can be found in Reference [5]. It is assumed that all algorithms have access to all data concerning infrastructure, train runs, and track closures. The necessary auxiliary notation is given in Table 5.

Managing of Closures
Algorithm 1 checks serially the ordered sequences of obligatory and facultative closures. Each track closure n is numerically evaluated by the ratio being the proportion of daily cumulated time of the closure to a daily time occupation by trains in the original timetable T T G of the trail between stations i and j. The cumulated time of closure is equal to time T C n multiplied by the number of trains using the track during T C n . The trail is understood as all tracks between adjacent stations. Additionally, both sequences are sorted to take into account precedence constraints among closures given in matrix O. A closure is selected on the basis of the real-world completion time of closure t CE n returned by the lower level Algorithm 2. The non-positive returned value of t CE n means that some constraints do not hold, and closure n cannot be approved. Algorithm 1 is stopped when whichever obligatory closure cannot be performed. As a result, the algorithm returns the selected set of track closures, the set of train runs together with new train timetable and track closure plans obtained, or information that the solution does not exists. The returned set of train runs defined by x, together with train timetable T T and a set of closures defined by y, together with closure plan S, are obtained with the use of all subsequent algorithms.

Managing of Train Runs
The management of train runs is performed by Algorithms 2 and 3 supported by Algorithm TGA, as well as by the solution of an auxiliary sub-problem ZP [64]. It is focused on obtaining such a sub-set of train runs, which enables the presence of a given set of track closures. If any obligatory train run cannot be included into the timetable due to a failing of constraints, information of the closure set infeasibility is returned to the track closure management part. The initial proposition of a train run set for the inclusion into the solution is obtained by Algorithm 2. This algorithm uses the decomposition procedure (Algorithm 3) to check if all suggested train runs could be performed, what is represented by a new train timetable and a new track closure plan. If Algorithm 3 fails to find a feasible timetable and a track closure plan, Algorithm 2 is stopped returning the last feasible train timetable and track closure plan with information if all obligatory train runs are included in this timetable.
Let us describe Algorithm 2 for indicating train runs to be placed into the new train timetable starting from the introduction of the following auxiliary variable U p = The usage of Algorithm 2 allows estimating whether it is likely to have a feasible solution of train rescheduling and track closure planning for the whole railway network when the new closure or the new train run is added. In consequence, Algorithm 2 uses the solution of the parameterized sub-problem ZP, for which the formal definition is given in Reference [64]. ZP limits the whole network to a single trail affected by the current change in the closure plan or the set of accepted train runs. This change is accomplished by assigning start times of closures and making train run timetable for this trail. The aim is to settle if we can shift closures and train runs by no more than a given period ∆ (algorithm parameter), which eliminates conflicts. We also assume that each train run may change its track between considered stations, so the new track is indicated by the variable W p,k .
Although ZP is a constraint satisfaction sub-problem, it may be easily solved by a linear programming solver, e.g., 'lpsolve' [63]. Notice that, even if the solution of the problem ZP can be found, it does not guarantee the existence of solution for the whole railway network.
Whenever Algorithm 3 is launched, it uses the results of Algorithm TGA, which takes G, T T, and TR as an input and returns the number of groups η and set GR = E × {1, 2, . . . η}, where E = {(i, j, k) : e i,j,k = 1}. The set GR represents the assignments of each track to a number corresponding to the index of one of the defined groups. Algorithm 3 divides the railway network into sub-networks and, after the grouping of all tracks, complements them with artificial ones. Artificial tracks connect stations which were not yet connected but are consecutive stations of some train run in its route. Then, for each sub-network, Algorithm 4 is consecutively executed to obtain a new timetable and a track closure plan corresponding to this fragment of the network. If, for all sub-networks, the feasible solution is found, then all results are combined into a single train timetable and track closure plan, as well as returned together with information about the success. Otherwise, the algorithm returns the original train timetable and track closure plan with information of the failure. The new train timetable T T and track closure plan S are represented by values of time shifts ∆t ARR , ∆t DEP of train runs and time shifts ∆t C of track closures regarding the original timetable TR S and closure plan C S .

Algorithm 1 selection of closures
Require: Data of the problem, in particular sets C OB , C F of obligatory, facultative closures, respectively.
Ensure: Values of y, x, as well as closure plan S, and timetable T T. 1: Sort the elements of C OB in the ascending order with respect to ratio (18) and then sort resulting sequence to ensure precedence constraints given in matrix O to have a sequence of obligatory closures (z i ) i=1,...,C OB as a consequence.
2: Set y n = 0, ∆t C n = 0, n = 1, 2, . . . , C, x p = 0, p ∈ TR, S = S G , T T = T T G . 3: for i = 1, . . . , C OB do 4: Run Algorithm 2 for a set of selected closures C S = {z 1 , z 2 , . . . , z i }, current timetable T T, and closure plan S (together with y), and currently considered closure n ∆ = z i , to obtain updated T T, S, y, and the actual completion time when o n,n+1 = 1 and i < C OB ) then 6: Stop the algorithm and return "Cannot find a feasible solution for C OB ". if (t CE n > 0 and t CE n ≤ t CLS n+1 when o n,n+1 = 1) then 13: Set y n = 1.

Algorithm 2 selection of trains
Require: Data of the problem, x, S, T T, C S , specified closure n.
Ensure: x, S, T T, t CE n for specified closure n. 1: Let FT be the list of train runs that are allowed to be canceled and sorted in not ascending order with respect to index U p . Set x p = 1(0) if p ∈ TR OB (otherwise). Let TR S = {p ∈ TR : x p = 1}. if the solution is found in Step 6 then 8: calculate t CE n basing on current S 9: else 10: return "No solution" 11: end if 12: end if 13: if the list FT is empty then 14: go to Step 33. 15: end if 16: Take the first train run out from the list FT and obtain its index p. 17: Set x p = 1 18: Set TR S = {p ∈ TR : x p = 1}. 19: for each pair of stations (i, j) such that ∑ k∈K R T=1 p,i,j,k do 20: solve ZP((i, j), x, S, T T, C S , TR S , n) 21: if the feasible solution is not found in Step 20 then end if 32: go to step 13 33: return x, S, T T, and t CE n for specified closure n.

Algorithm 3 decomposition of the railway network
Require: Data of the problem, in particular sets C S , TR S of selected closures and train runs, respectively, selected train run for rerouting q ∈ TR S , current train timetable T T and track closure plan S. Ensure: Closure plan S, train timetable T T. 1: Set S = S and T T = T T, get from Algorithm TGA results: grouping set GR, which associates each track with a group number to which it belongs, and a number of groups η.
2: for n = 1, . . . , η do 3: Construct a railway network G n =< V n , E n > (not necessary connected) where V n = {v ∈ V : w ∈ V, k ∈ K, ((v, w, k), n), ((w, v, k), n) ∈ GR}, E n = [e n,i,j,k ] i,j∈V,k∈K∪{K+1,K+2,...,K+TR} , and e n,i,j,k = 1 for ((i, j, k), n) ∈ GR 0 for otherwise 4: for each m ∈ TR S do 5: Construct a path π n,m (string of stations v ∈ V n ) composed of stations of the route of the train run m that belong also to V n . 6: if π n,m exists then 7: for each pair of consecutive stations (v a , v b ) from the path π n,m . do 8: if for any track k connecting stations a with b, there is no connection indicated in matrix E n (∀ k∈K (e n,a,b,k == 0)) then 9: Add a virtual track to E n (set e n,a,b,K+m = 1). 10: end if 11: end for 12: add train run m to a set TR S n ⊆ TR S (TR S n = TR S n ∪ {m}) 13: end if 14: end for 15: for each cl ∈ C S do 16: if a closure cl is planned on some track in connection indicated in matrix E n ({k ∈ K, v a , v b ∈ V n , e n,a,b,k = 1, R C cl,a,b,k = 1} = ∅) then 17: Add closure cl to C S n ⊆ C S (C S n = C S n ∪ {cl}).

18:
end if 19: end for 20: Execute Algorithm 4 for C S n , TR S n , TR S , G n , q, S , and T T , to obtain time shifts of the train runs and closures. 21: if Algorithm 4 returned "No solution" then 22: Stop the algorithm and return "Cannot find a feasible solution". 23: end if 24: Include time shifts of the train runs and closures obtained by Algorithm 4 into new train timetable T T , and closure plan S . 25: end for 26: Update T T by recalculating ∆t ARR i,p = ∑ j∈V (∆t DEP j,p · ∑ k∈K r T p,j,i,k ) 27: return S = S and T T = T T .

Determining of Time Shifts for Train Runs and Closures
Even after preceding decompositions, the remaining non-linear optimization problem is still hard to solve in a reasonable amount of time for realistically sized instances. To obtain a solution quickly, it is necessary to perform further simplifications. Two-stage decomposition is proposed. Firstly, three types of sub-problems are derived via a decomposition. Secondly, relatively quick solution algorithms, referred to as Algorithm 4, Algorithm 6, Algorithm 7, are used to solve each sub-problem. Decomposition is carried out through the introduction of additional decision variables. At each track separately, let the order of track usage by either train runs or closures be denoted as θ i,j,k = [θ i,j,k q ] q∈{1,2,...,Θ i,j,k } , where i is the departure station, j is the arrival station, k is the index of a specific track between stations, and Θ i,j,k is the number of runs and closures on that track. Let us define a series Ψ i,j,k = [Ψ i,j,k q ] q∈{1,2,...,Θ i,j,k } with elements Ψ i,j,k q = 0(1) if there is a train run (if it is a closure) on the position q of the ordering θ i,j,k . Furthermore, for each station, let us denote the order in which train runs enter the station as λ i = [λ i q ] q∈{1,2,...,Λ i } , where i is the index of the station, and Λ i is the number of runs entering the station. Determination of orders θ i,j,k and λ i for every track and every station reduces the problem of determining the time shifts for train runs and closures into a linear programming problem which can be solved with exact methods (i.e., an LP solver).
The first set of sub-problems is solved separately for every track to obtain the orders θ i,j,k . For this purpose, a local criterion being a particular case of criterion (17) is introduced: where TR i,j,k = {p ∈ TR S n : R T p,i,j,k + e n,i,j,k = 2} is the set of train runs going through track (i, j, k). This criterion is the total time shift for train runs limited to a single track at a time. Furthermore, let us define by C i,j,k the set of closures on a given track. Algorithm 6, applied for solving the sub-problem of finding the usage order for a single track, uses, in addition to problem data passed on to Algorithm 4, set TR S_SUB n , which is a sub-set of TR S n , determined during the execution of Algorithm 4.
The following Algorithm 6, as well as other algorithms presented next in this subsection, uses solutions of problems 4.1.lin, 4.2.lin, and 4.lin, which are described in Reference [64]. The problem 4.1.lin is the problem of determining the time shifts for a single track under the assumption that the order of train run or closure execution is fixed (the variable θ i,j,k is fixed). Under the assumption, the problem of time shift determination (times when train enters the track or the closure starts) becomes a linear programming problem and can be solved quickly and exactly. Similarly, in the problem 4.2.lin, we consider a single station and assume that the variable λ i is fixed; this leads to another linear problem of time shift determination (times when train enters the station). Finally, under fixed values of θ i,j,k for each track and of λ i for each station, the problem of time-shift determination for the whole network, i.e., 4.lin, is also linear.
The second set of sub-problems is solved separately for every station to obtain orderings λ i . Analogously to the first set of sub-problems, a local criterion based on (17) is defined.
where TR i = k∈K (TR i,j,k ∪ TR j,i,k ) is the set of train runs on tracks adjacent to station i. This criterion expresses the total time shift for train runs on a single station. Let us denote the tracks adjacent to i as K ADJ i = {(l, j, k) : l, j ∈ V n , k ∈ K, TR l,i,k ∪ TR i,j,k = ∅}. Algorithm 7, used for solving the sub-problem of finding the ordering of train runs entering a single station, is given as follows.
Finally, the full Algorithm 4 with a distinct auxiliary Algorithm 5 are both given as follows. Please note that, if Algorithm 7 changes ∆t ARR j,p , the time shifts ∆t DEP i,p have to be accordingly changed be Algorithm 4 to satisfy ∀ p∈TR i (∆t DEP i,p − ∆t ARR j,p ) ∑ k∈K r T p,i,j,k = 0. The complexity of Algorithm 4 is dependent on the complexity of the selected linear programming routine. Assuming Karmarkar's algorithm [65] is used, then the complexity is given as follows O[(TR + C) 3.5 * B * E 2 + TR 3.5 * B * V 2 ], where B is the number of bits needed to encode the longer of train and closure data. The complexity of the whole multi-level algorithm is, therefore, O{(TR * C * [(TR + C) 3.5 * B * E 2 + TR 3.5 * B * V 2 ]}.

Algorithm 4 determination of time shifts for train runs and closures
Require: Data for the sub-network: G n , C S n , TR S n . Train run q (q ∈ TR S n ) selected for rerouting. Closure ordering matrix

O.
Ensure: Time shifts ∆t DEP i,p , ∆t C n , and new train routes r T p,i,j,k for i, j ∈ V n , p ∈ TR S n , n ∈ C S n .
1: if q = NULL then 2: return solution of Algorithm 5 for G n , C S n , TR S n , q, and O . Set ∆t DEP i,p , ∆t C n , r T p,i,j,k for i, j ∈ V n , p ∈ TR S n , n ∈ C S n using values returned by Algorithm 5.

6:
Let TR S_SUB n = TR S n ∪ TR S n (p), where TR S n (p) is the pth element of TR S n .

7:
Let q = TR S n (p). if solution does not exist then 10: return no solution. 11: else 12: Update ∆t DEP i,p , ∆t C n , r T p,i,j,k for i, j ∈ V n , p ∈ TR S n , n ∈ C S n using values returned by Algorithm 5. 13: end if 14: if p < |TR S n | then 15: Let p = p + 1. 16: go to 5.

17:
end if 18: end if 19: return ∆t DEP i,p , ∆t C n , r T p,i,j,k for i, j ∈ V n , p ∈ TR S n , n ∈ C S n .

Algorithm 5 determination of time shifts for train runs and closures
Require: Data for the sub-network: G n , C S n , TR S_SUB n . Train run q (q ∈ TR S n ) selected for rerouting. Closure ordering matrix O.
Ensure: Time shifts ∆t DEP i,p , ∆t C n , and new train routes r T p,i,j,k for i, j ∈ V n , p ∈ TR S_SUB n , n ∈ C S n . 1: Let ∀p ∈ TR S_SUB n , i ∈ V n : ∆t DEP i,p = 0, ∀n ∈ C S n : ∆t C n = 0. 2: for each (i, j, k) ∈ E n , i < j do 3: Obtain ordering θ i,j,k using Algorithm 6. 4: if no ordering was found then 5: go to 11. Obtain ordering λ i using Algorithm 7. 10: if no ordering was found then 11: go to 11. 12: end if 13: end for 14: Solve the linear problem of time shift determination for given orderings (4.lin). 15: if no solution was found and q ∈ TR S_SUB n then 16: Let TR S_SUB n := TR S_SUB n \{q}. 17: go to 1.
18: else 19: if no solution was found then 20: for eachpair of stations (i, j) on the route for the run q. do 21: Find a feasible track k ∈ K. 22: if no track was found and b i,j = 1 then 23: Verify if track k = 0 is feasible. 24: end if 25: if a feasible track was found then 26: Set ∆t DEP i,p to the lowest feasible value, set r T q,i,j,k = 1, ∀l = k : r T q,i,j,l = 0.
27: else 28: return no solution. 29: end if 30: end for 31: end if 32: end if 33: return ∆t DEP i,p , ∆t C n , r T p,i,j,k for i, j ∈ V n , p ∈ TR S_SUB n , n ∈ C S n .

Algorithm 6 track usage ordering determination
Require: Selected track (i, j, k). Data for the sub-network: G n , C S n , TR S n . Closure ordering matrix O, sets of train runs TR i,j,k and closures C i,j,k on the track.
Ensure: Locally optimal ordering θ i,j,k , Ψ i,j,k or no solution.
1: Empty the ordering θ i,j,k ← (), Ψ i,j,k ← () 2: while either TR i,j,k or C i,j,k is nonempty do 3: From the sets of every train run TR i,j,k and every closure C i,j,k and every possible position in θ i,j,k , Ψ i,j,k find those that minimize Q i,j,k 1 by solving ) linear time shift resolution problems for a single track (4.1.lin). Preserve ordering given by O.

4:
Add selected train run or closure to θ i,j,k , Ψ i,j,k . Remove it from TR i,j,k or C i,j,k . 5: if no train run or closure could be added then 6: return no solution. 7: end if 8: end while 9: return θ i,j,k , Ψ i,j,k .

Algorithm 7 station usage ordering determination
Require: Selected station i. Data for the sub-network: G n , C S n , TR S n . The ordering of runs and closures θ i,j,k for tracks

Ensure:
Locally optimal ordering λ i if one was obtained.
2: while TR i is nonempty do 3: From the set of every train run TR i and every possible position in λ i find those that minimize Q i 2 by solving linear time shift resolution problems for a single station (4.2.lin).

4:
Add selected train run to λ i and remove it from TR i . 5: if no train run or closure could be added then 6: return no solution. 7: end if 8: end while 9: return λ i .

Simulation Experiments
The heuristic algorithm presented in the previous section was tested via simulation experiments for particular structures of railway networks. The experiments have consisted of two parts, i.e., for a single track and a real-world network of tracks. The former experiments have aimed at providing the comparison of solutions obtained with the only use of Algorithm 4 to optimal solutions. The latter experiments were conducted to provide the insight into properties of the heuristic algorithm treated as a whole. Due to the complexity of the underlying problem, the comparison with optimal solutions was omitted for the second part. Computations for the first part were performed on a PC with Intel i7-4790K 4 GHz, single core, 2.5 GB RAM; the second part of simulations was done with the use of a PC with Intel i7-4720HQ 2.6GHz, 16 GB RAM. Calculations were made with the use of a single processor core only. The software implementation in both cases was made with the use of Python 2.7 and lpsolve [63].

Single Track Case
Optimal ordering of runs can change following the addition of closures, even for a single track case. Unlike for the more complex structure of a train run network, here, it is possible to obtain, in a reasonable amount of time, optimal solutions to the time shift resolution problem. The authors find it valuable to exploit this opportunity to relate the dedicated algorithm to an optimal one in a series of experiments, which were constructed as follows.
The   [60,240]. The criterion Q = ∑ i∈V,p∈TR |∆t DEP i,p | used during this experiment is the negative of the last part of (17), which should be minimized and only evaluates solutions obtained by Algorithm 4. The other evaluation is the computational time of the algorithm T. Due to the random nature of the experiments, for each case and for each TR, the experiment was repeated ten times. Results, both the execution time T and the quality Q were averaged. We present the results in Tables 6 and 7, and Figures 4 and 5, where we provide: the quality for the optimal algorithm, the quality of the Algorithm 4 algorithm, the execution time for the optimal algorithm, and execution time for the Algorithm 4 algorithm. They are denoted as Q * avg , Q avg , T * avg , T avg , respectively. For some instances, the Algorithm 4 algorithm failed to provide a solution. The number of such instances is given in the table columns labeled 'Fail'. All such instances are excluded from the calculation of averages. Times Q, and T are given, respectively, in minutes and seconds. Figures 4 and 5 incorporate data aggregated over multiple experiments presented with the use of horizontal curly braces. The average values are represented by dots, as well as minimum, and maximum ones are given by error bars. For the purpose of comparing results obtained with the use of Algorithm 4 with optimal solutions, an exhaustive search was used to obtain the latter ones.
As can be seen in Figure 5 and Table 7, computational time of Algorithm 4 grows in a nearly linear manner concerning the number of runs. This property is crucial to the computational time of the heuristic algorithm, which uses Algorithm 3 repeatedly and for sub-problems of varying sizes. We notice from Figure 4 and Table 6 that Q varies significantly, with much greater values obtained for longer expected train movement times. This remark gives a clear message that it is easier to permit closures on the tracks for fast passenger trains. Slow trains will likely have to change their route or be canceled. Comparison with optimal solutions leads to a natural conclusion that the Algorithm 4 provides similar results for the majority of all the tested cases. As it can be apparently seen from Table 6, all of the results obtained by the algorithm were optimal for Cases 1 and 2. For Cases 3 and 4, the algorithm failed to find a solution in 5% of the experiments even though one existed. The overall difference in quality between the solution provided by Algorithm 4 and the optimal solution was under 1% of the latter. The cause of those minor differences lies in potential sub-optimality of the orderings obtained with the use of greedy Algorithms 6 and 7.
From the experiments, it is clear that increasing duration of train movement between stations decreases the efficiency of Algorithm 4. Nevertheless, for the majority of tested cases, the difference between Algorithm 4 and the optimal solution is slight.

Single Track Timetable
Let us consider a single track case as in the previous section for closure with the following parameters T C 0 = 50, t CES 0 = 0, t CLS 0 = 105, R C 0,1,2,1 , and four trains with timetable as follows:

Network of Tracks Case
The second part of experiments was performed on a multi-station network. The considered network is based on the part of the Polish Railway Network from the region of Kielce consisting of 167 tracks connecting 149 stations as it is depicted in Figure 8, and there were originally 95 train runs in the official timetable for one day. The simulations have been performed for different numbers of train runs TR (i.e., for TR = 10,11,12,13,14,15,20,30) using the same railway network. Ten different sub-sets of the original set of train runs selected at random according to the uniform probability distribution have been generated for a given number of train runs. Each train run was assumed as obligatory. The standing times have been set to T DL = 15, T D i,p = 1 for all runs p and stations i. We also assumed that there were three closures in the railway network. Each closure was also assumed as obligatory. Unless otherwise stated, the closures' duration times have been set to 2h (i.e., T C n = 2h for all n). For each simulation, the closures' tracks have been randomly chosen according to the uniform distribution and the closures' beginning times have also been chosen analogously from the interval (0, T H − 2h). These assumptions correspond to the periodic and weekly closure planning when short-term closures caused by the regular maintenance works are taken into consideration. We have limited our consideration to the determination of the plan for one day assuming that the train runs timetable and the closures plan should be repeatable. There stations' capacities have been unlimited. As for a single track case, the overall time interval was also limited to a single day, i.e., T H = 1440 min. The results are briefly presented in Figures 9-12 and in corresponding Tables 8-11. Dots, as well as error bars, represent the average value, as well as minimal and maximal values, respectively. The dimensionless performance index Q = Q Q , where Q stands for the best value of (17) found for the particular problem instance along with the computation time T, evaluates the heuristic algorithm. Analogously as in Section 6.1, we denote the average, minimum, and maximum values of Q by Q avg , Q min , Q max , respectively.   T min  T max  T avg  T min  T max  T avg  T min  T max  T avg  T min  T max   2  15  14  16  14  14  14  14  14  14  14  14  14  3  14  13  15  13  13  13  13  13  13  13  13  13  4  13  13  14  13  13  13  13  13  13  13  13  13  10  13  13  14  13  13  13  13  13  13  13  13  13  20  13  13  14  13  13  13  13  13  13  13  13 Table 11. Dependence of T on TR for different η.

T avg T min T max T avg T min T max T avg T min T max T avg T min T max T avg T min T max
The growth of the number of groups (railway sub-networks) η deteriorates the obtained solutions for the same number of train runs TR ( Figure 13 and Table 12). A similar situation occurs when the number of train runs TR grows for the fixed number of groups η ( Figure 14 and Table 13). Nevertheless, the worsening is less significant in the latter case.   The performance indexesQ values are jointly compared with the computational time T in Figure 15 and Table 14, while the performance index Q are jointly compared with the computational time T in Figure 16 and Table 15. The values ofQ are marked on the abscissa axis, and Q values are represented by dots, in Figure 15. The opposite presentation is used in Figure 16, where values of Q are represented on the logarithmic abscissa axis, whileQ are marked by dots. Both figures present the comparison for different values of TR and η. As it can be observed there, the impact of the number of groups η on the computation time is slight, unlike the solution quality Q. So, it is not recommended to decompose the problem into many sub-problems, as it deteriorates inadmissibly the quality.   However, it is worth noting that the main challenge consists of answering the question if there is any feasible solution, and it is necessary to obtain the answer in the limited time. So, the most important issue is to obtain any solution in such time. On the other hand, the decision-maker has to be aware that the decreasing of computational time by applying bigger values of η can result in the lack of any solution. Even though the feasible solution of the considered problem may exist, the algorithm can fail to find it. Such a situation can be observed in Table 16, where the algorithm for η ≥ 20 did not find any solution in 20% of all examined cases.

Final Remarks
The selected management problem on railway transportation under anticipated track closures is considered. Taking into account the planned closures, caused mainly by the maintenance of tracks and stations, requires the elaboration of a new timetable for trains. In consequence, the problems of track closure planning and train rescheduling are jointly considered in the paper as the strongly multivariable and nonlinear mixed integer optimization problem. A novel approach based on the decomposition is applied, which results in the heuristic solution algorithm. The conducted simulation experiments confirmed the usefulness of the algorithm regarding both the performance index applied and the computational time. In particular, the experiments performed on single tracks have shown that the results generated by the heuristic algorithm are quite close to the optimal ones. Such experiments involving optimal solutions are impossible for greater instances of the problem. Hence, the profound simulation experiments were performed for the real-world example including 95 train runs. The results confirmed the effectiveness of the algorithm for a wide range of the algorithm's parameters, first of all for the different number of groups (railway sub-networks) being the result of the applied decomposition. The computational time did not exceed a half an hour for the real-world instance considered. So, it is possible to effectively launch the algorithm for substantially big problem instances. The proposed solution algorithm with the number of railway sub-networks η as the algorithm's parameter also allows for fast checking of the existence of any feasible solution neglecting the optimization of the criterion. Such property of the algorithm seems to be very important for real-world applications.
The verification of the current model is now considered for the case when a substitutive transport with resulted additional costs is possible. Planned further works will consist mainly of the generalization of the model proposed in Section 3, by taking into account additional facets important for railway networks management as different categories of trains and priorities in their running, as well as additional constraints on station capacities and track forks.