Optimising Rolling Stock Planning including Maintenance with Constraint Programming and Quantum Annealing

Page created by Guy Hall
 
CONTINUE READING
Optimising Rolling Stock Planning including
                                             Maintenance with Constraint Programming and
                                                         Quantum Annealing∗

                                                     Cristian Grozea1[0000−0001−6393−1919] , Ronny Hans3‡ , Matthias Koch2 ,
                                                             Christina Riehn2 , and Armin Wolf1[0000−0003−3940−0792]
arXiv:2109.07212v1 [cs.AI] 15 Sep 2021

                                                      1
                                                       Fraunhofer FOKUS, Kaiserin-Augusta-Allee 31, 10589 Berlin, Germany
                                                                firstname dot lastname @fokus.fraunhofer.de
                                                            2
                                                              DB Systel GmbH, Marktstraße 8, 10317 Berlin, Germany
                                                                  firstname dot lastname @deutschebahn.com
                                                 3
                                                     DB Systel GmbH, Jürgen-Ponto-Platz 1, 60329 Frankfurt am Main, Germany
                                                                  firstname dot lastname @deutschebahn.com

                                                          Abstract. We developed and compared Constraint Programming (CP)
                                                          and Quantum Annealing (QA) approaches for rolling stock optimisation
                                                          considering necessary maintenance tasks. To deal with such problems in
                                                          CP we investigated specialised pruning rules and implemented them in a
                                                          global constraint. For the QA approach, we developed quadratic uncon-
                                                          strained binary optimisation (QUBO) models. For testing, we use data
                                                          sets based on real data from Deutsche Bahn and run the QA approach
                                                          on real quantum computers from D-Wave. Classical computers are used
                                                          to run the CP approach as well as tabu search for the QUBO models.
                                                          We find that both approaches tend at the current development stage
                                                          of the physical quantum annealers to produce comparable results, with
                                                          the caveat that QUBO does not always guarantee that the maintenance
                                                          constraints hold, which we fix by adjusting the QUBO model in prepro-
                                                          cessing, based on how close the trains are to a maintenance threshold
                                                          distance.

                                                          Keywords: Constraint-Based Planning · Maintenance Planning ·
                                                          Quadratic Unconstrained Binary Optimisation · Quantum and Simu-
                                                          lated Annealing · Rolling Stock Optimisation · Transition Distances and
                                                          Times

                                             1       Introduction and Motivation

                                             Every day, 40,000 trains travel on the Deutsche Bahn rail network, heading to
                                             5,700 stations. DB Fernverkehr AG, a subsidiary company of Deutsche Bahn,
                                         ‡
                                             the authors are listed in alphabetical order.
                                         ∗
                                             The presented work was partially funded by the German Federal Ministry for Economic
                                             Affairs and Energy within the project “PlanQK” (BMWi, funding number 01MK20005)
                                             and is licensed under CC BY-NC-ND 4.0.
2      C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

    provides 315 ICEs and carries about 220.000 passengers between 140 ICE train
    stations every day in 2020.4
        Railroad companies, like DB Fernverkehr, are required to plan their rolling
    stock accordingly the timetable. This problem has typically numerous require-
    ments and constraints to be satisfied, such as, travel times and distances, prepa-
    ration times as well as periodic and non-periodic maintenance constraints.
        Besides the regular long-term planning, railroad companies must be able to
    respond quickly to disruptions, e.g., technical fault on a train, to ensure an
    operation in accordance to the timetable. Therefore trains need to be resched-
    uled. In both scenarios, long-term and short-term planning, we aim to reach a
    global optimum. The mathematical expression of such a problem constitutes a
    NP-hard optimisation problem with an exponential growing calculation effort,
    which especially makes short-term planning challenging.
        In this work, our primary objective is to serve all trips and adhere to the
    promised timetable. Our second optimisation goal is the reduction of empty
    trips, i.e., to relocate trains between stations without passages. For solving the
    rolling stock planning problem, we use two approaches. First, we use a Con-
    straint Programming approach. Here, we investigate in specialised pruning rules
    and implement them in a global constraint. For solving optimisation problems,
    quantum computing seems to be a promising technology, especially after Google
    proved quantum supremacy in 2019 [1]. In solution approach we focus on quan-
    tum annealing, using real quantum computers from D-Wave.
        The paper is structured as follows: In the following section we discuss related
    approaches based on a literature review. Subsequently, we present and explain
    the rolling stock planning problem in detail. Then in Section 4 we present our
    CP-based solution approach. Afterwards, in Section 5 we describe our quantum
    computing based solution approach. In Section 6 we explain the data we use for
    the evaluation and present the results of our two approaches. In Section 7 we
    discuss our results. The paper closes with conclusions and future research areas.

    2   Related Work
    A comparative survey on research activities concerning optimised rolling stock
    assignment and maintenance is presented in [2]. There the focus is on passenger
    transportation as in our case, where the schedule of the train trips is fixed in
    advance. Our focus is on rolling stock circulation maximising performed trips,
    minimising empty ride reduction together with rolling stock maintenance as
    in [3]. As in our approaches a pre-processing is performed to determine feasible
    sequences of train services possibly including empty rides and maintenance tasks.
    Interestingly, in [4] rolling stock rescheduling is considered together with depot
    re-planning in order to handle short-term disruptions in railway traffic. There, a
    specialised branch-and-price-and-cut approach is used to handle such problems
    extending previous work [5]. In [3] as well as in [2, 6–11] Mixed Integer Program-
    ming (MIP) is applied to model and solve rolling stock and related problems —
4
    https://www.deutschebahn.com/de/konzern/konzernprofil/zahlen fakten
Optimising Rolling Stock Planning including Maintenance with CP and QA            3

like locomotive scheduling — which seems to be the usual solution approaches
for such problems. In [12] constraint propagation together with depth-first search
based on backtracking was used to perform reactive scheduling for rolling stock
operations. Similarly, in [13] CP modelling and solving was applied for capacity
maximisation of an Australian railway system transporting coal from mines to
harbours. There, CP was successfully applied to solve this rail capacity problem
finding coal train schedules which are close to optimistic upper capacity bounds
computed analytically. Both CP approaches encourage us to consider CP for
rolling stock optimisation.
    A routing problem on railway carriages in a railway network, which is similar
to rolling stock problems is addressed in [14]. There, a local search approach,
namely Simulated Annealing (SA), is applied to solve the problem, because an
integer programming approach fails. Quantum optimisation based on a quadratic
unconstrained binary (QUBO) model has been employed by [15] where they
consider a delay and conflict management on a single-track railway line. This
QUBO approach has also been used, e.g., for flight assignment tasks [16] or
traffic flow optimisation [17].

3     Characteristics of Rolling Stock Planning including
      Maintenance

In this section all the parameters and their values ranges of a rolling stock plan-
ning problem, are presented and explained. These are the trains performing trips
between different locations, i.e. stations. Furthermore the trains are potentially
maintained between their trips – either periodic or non-periodic. In general, time
resolution is in minutes [min] and distances are in kilometres [km]. The consid-
ered scheduling horizon is defined by the set H ⊂ N of time points in minutes.
Typically H = {0, . . . , e − 1} where 0 is the canonical begin of the scheduling
horizon and e − 1 its end, e.g. H = {0, . . . , 14439} represents one day.

3.1   Stations

Let B = {b0 , . . . , bl−1 } be the set of stations. For each pair of stations b, c ∈
B, b 6= c let

 – distance(b, c) ∈ N+ be the distance for travelling from station b to station c
   in [km]
 – duration(b, c) ∈ N+ be the duration for travelling from station b to station c
   in [min]

Obviously, distance(b, b) = 0 and duration(b, b) = 0 for each station b ∈ B.

3.2   Trips

Let F = {f0 , . . . , fn−1 } be the set of trips. For each trip f ∈ F let
4          C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

        –   f.departureStation ∈ B be the departure station where trip f starts.
        –   f.departureTime ∈ H be the departure time when the trip f starts.
        –   f.arrivalStation ∈ B be the arrival station where trip f ends.
        –   f.arrivalTime ∈ H be the arrival time when the trip f ends.
        –   f.distance ∈ N+ be the travelling distance of trip f .
        –   f.duration ∈ H be the travelling duration of trip f .
        –   f.postProc ∈ H be some post-processing time used for preparing the train
            after the trip.5

    3.3       Trains
    Let Z = {z0 , . . . , zm−1 } be the trains potentially performing the trips in F . For
    each trip z ∈ Z let
        – z.initialStation ∈ B be the initial station from where train z may start its
          first trip.
        – z.earliestTime ∈ H be the earliest available time of train z.
        – z.initialKmu ∈ N+ be the initial km reading of train z since the last mainte-
          nance task of type wu performed on this train (cf. Sec. 3.4).

    3.4       Maintenance Types
    Let W = {w0 , . . . , wp−1 } be types of maintenance tasks to be performed on
    the trains in Z. There are periodic types of maintenance tasks to be performed
    within some km intervals and maintenance tasks to be performed once just before
    reaching some km readings. For each maintenance type w ∈ W let
        – w.Stations ⊆ B be the set of stations where maintenance tasks of type w can
          be performed.
        – w.duration ∈ H be the duration of the maintenance tasks of type w.
        – w.isPeriodic ∈ {0, 1} be the flag that signals whether the maintenance task
          of type w is periodic (1) or not (0).
        – w.limit ∈ N+ be either the length of the interval or the limits – both in km
          within them the maintenance task w has to be performed.

    3.5       Constraints and Objectives
    The rolling stock problem including maintenance is characterised by the follow-
    ing constraints:
        – each train performing a trip must be available in time at the departure
          station of the trip.
        – all maintenance intervals – either periodic or non-periodic – of the trains
          must be respected, for regular as well as empty travels.
        The objective of the rolling stock problem including maintenance is to al-
    locate as much as possible trips to trains and to reduces the number of empty
    driven kms such that the specified conditions are satisfied.
5
    in the considered scenarios, we used 120 min. for each trip, e.g. for cleaning etc.
Optimising Rolling Stock Planning including Maintenance with CP and QA                              5

    4    Constraint-Programming-Based Solution Approach

    In this section a formal model of the considered rolling stock problem is presented
    which is appropriate for CP. Pruning rules are derived respecting the problem-
    specific constraints. These pruning rules are implemented in a global constraint
    of a CP system.
        Let F = {f0 , . . . , fn−1 } be the set of trips sorted in non-decreasing
                                                                         Pq       order with
    respect to their durations and let q ∈ N+ be chosen such that i=1 fi .duration ≤
             Pq+1
    e − 1 < i=1 fi .duration holds. Then q is an upper bound of the number of trips
    — or the number of slots for trips — that maximally fit into the scheduling
    horizon H. Based on this value we define for each train zi ∈ Z a sequence of
    finite integer-domain variables

     trip i,0 ∈ {−(i · q + 1), 0, . . . , n − 1}, . . . , trip i,q−1 ∈ {−(i · q + q), 0, . . . , n − 1} (1)

    presenting the identifiers of the trip that will be performed by this train according
    to the order of the sequence, i.e. trip i,j indicates the trip performed from train zi
    in slot j (or at position j). Additionally to the (non-negative) trip identifiers
    the domains of these trip variables6 , i.e. dom(trip i,j ) contain a unique negative
    integer value, such that the notion trip i,j < 0 indicates that train zi will not
    perform any “regular” trip in slot j. There and in the following the notion
    V < 0 (resp. V ≥ 0) represents for any a finite integer-domain variable V either
    the condition ∀v ∈ V : v < 0 (resp. ∀v ∈ V : v ≥ 0) or the pruning statement
    V = V ∩ {v ∈ N | v < 0} (resp. V = V ∩ {v ∈ N | v ≥ 0}) depending
    on the context where it is used. Analogously, V 6< 0 represents the condition
    ∃v ∈ V : v ≥ 0.
        Due to the fact that each trip will be performed by at most one train all
    these trip variables must have pairwise different values:7

                      allDifferent({trip i,j | zi ∈ Z ∧ j ∈ {0, . . . , q − 1}}) ,                     (2)

    which requires that the negative domain value must be unique, i.e. the constraint
    will be satisfied if there is not any trip performed by a train. Due to the fact
    that each sequence of trips performed by a train zi is without gaps, it must hold
    for j = 1, . . . , n − 1 that

                trip i,j−1 < 0 ⇒ trip i,j < 0       resp.    trip i,j ≥ 0 ⇒ trip i,j−1 ≥ 0             (3)

    for i = 0, . . . , n − 1 and j = 1, . . . , q − 1. Obviously, a trip cannot be performed
    by a train if there is not enough time to travel to the departure station of this
    trip or to travel from its arrival station to another subsequent station. In order
6
    for any finite-domain integer variable V let dom(V ) be its domain, i.e. the set of its
    potential values.
7
    cf. https://sofdem.github.io/gccat/gccat/Calldifferent.html for the definition of this
    global constraint.
6         C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

to derive according pruning rules we compute for each trip fk ∈ F the set of
indices of potential predecessor trips

     Vk = {h ∈ {0, . . . , n − 1} | fh .arrivalTime + fh .postProc                         (4)
           + duration(fh .arrivalStation, fk .departureStation) ≤ fk .departureTime}

and for each trip fk ∈ F the set of indices of potential successor trips

    Nk = {h ∈ {0, . . . , n − 1} | fk .arrivalTime + fk .postProc                          (5)
          + duration(fk .arrivalStation, fh .departureStation) ≤ fh .departureTime} .

These sets can be computed in advance in O(n2 ) time and space. Based on
these sets for each train zi ∈ Z and each slot j > 0 some pruning rules can be
formulated:

               ∀k ∈ dom(trip i,j ) : fk ∈ F ∧ Vk ∩ dom(trip i,j−1 ) = ∅                    (6)
                                    ⇒ dom(trip i,j ) := dom(trip i,j ) \ {k}

forces that a potential trip cannot be performed in slot j if its potential prede-
cessor trips are disjoint to the trips in the previous slot.
    For slot j = 0 the rule is

            zi .earliestTime + duration(zi .initialStation, fk .departureStation)
                            > fk .departureTime
                               ⇒ dom(trip i,0 ) := dom(trip i,0 ) \ {k} .                  (7)

Furthermore, the potential trips the can be performed in slot j can be restricted
to the successor trips of the potential trips in the previous slot:

           dom(trip i,j )
                                                                [                     
            := dom(trip i,j ) ∩ {−(i · q + j + 1)} ∪                              Nk       (8)
                                                       k∈dom(trip i,j−1 )∧fk ∈F

where the negative identifier −(i · q + j + 1) indicate any “empty”/“irregular”
trip (cf. (1)).
    These pruning rules are correct, i.e. only trips that cannot be operated by
the according train are removed and these rules require O(mnq) time to be
performed in the worst case.
    For each train zi ∈ Z we further define a sequence of finite integer-domain
variables
                maint i,j ∈ {−1, 0, . . . , p − 1} for j = 0, . . . , q − 1 (9)
presenting the identifiers of the maintenance tasks that has to be performed
at this train according to the order of the sequence, i.e. maint i,j indicates the
maintenance task performed at train zi before a trip in slot j. There, the
indices 0, . . . , p − 1 are referring to the maintenance types w0 , . . . , wp−1 (cf.
Optimising Rolling Stock Planning including Maintenance with CP and QA             7

    Sec. 3.4). Additionally to the (non-negative) maintenance type identifiers the
    domains of the maintenance variables contain −1 such that maint i,j < 0 indi-
    cates that no maintenance tasks will be performed at train zi before a trip in
    slot j. This means that if there is no such trip in slot j then there will be no
    maintenance task in this slot either:
             trip i,j < 0 ⇒ maint i,j < 0   resp. maint i,j ≥ 0 ⇒ trip i,j ≥ 0 .      (10)
    Obviously, a maintenance task cannot be performed on a train zi before slot j if
    there is not enough time to travel to and from one of the maintenance stations
    before this trip. In order to derive an according pruning rule we compute for each
    maintenance type mk ∈ M the set of pairs of indices of potential predecessor
    and successor trips:
           Wk = {(x, y) ∈ {0, . . . , n − 1}2 | ∃w ∈ mk .Stations : fx .arrivalTime   (11)
                  + fx .postProc + duration(fx .arrivalStation, w) + mk .duration
                  + duration(w, fy .departureStation) ≤ fy .departureTime}
    and for each train zi ∈ Z and each maintenance type mk ∈ M the set of indices
    of potential first trips performed by train zi after any maintenance of type mk :
             Ui,k = {x ∈ {0, . . . , n − 1} | ∃w ∈ mk .Stations : zi .earliestTime    (12)
                    + duration(zi .initialStation, w) + mk .duration
                    + duration(w, fx .departureStation) ≤ fx .departureTime}
    and further
              Wk |1 = {x | (x, y) ∈ Wk }    and Wk |2 = {y | (x, y) ∈ Wk } .          (13)
    The sets Wk can be computed in advance in O(psn2 ) time and O(pn2 ) space
    and Ui,k in O(mpsn) time and O(mpn) space, where s is the greatest number of
    alternative maintenance stations per maintenance type. Also the sets Wk |1 and
    Wk |2 can be computed in advance in O(pn) time and space when Wk is already
    computed.
        For each train zi ∈ Z and each slot j > 0 and each k ∈ dom(mainti,j ) with
    k ≥ 0 the pruning rules are
          Wk |1 ∩ dom(trip i,j−1 ) = ∅ ⇒ dom(maint i,j ) := dom(maint i,j ) \ {k}     (14)
             Wk |2 ∩ dom(trip i,j ) = ∅ ⇒ dom(maint i,j ) := dom(maint i,j ) \ {k}    (15)
    and further for slot 0
          Ui,k ∩ dom(trip i,0 ) = ∅ ⇒ dom(maint i,0 ) := dom(maint i,0 ) \ {k}        (16)
    where Rule (15) can be replaced by the possibly stronger rule8
       Wki,j−1 |2 ∩ dom(trip i,j ) = ∅ ⇒ dom(maint i,j ) := dom(maint i,j ) \ {k}     (17)
8
    empirical examinations on the considered data sets did not show any advantages of
    this stronger rule.
8        C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

     with Wki,j−1 |2 = {y ∈ {0, . . . , n} | (x, y) ∈ Wk ∧x ∈ dom(tripi,j−1 ). However, this
     possibly stronger rule9 requires the additional computation of the set Wki,j−1 |2
     which is in the worst case quadratic in the number of trips, i.e. O(n2 ).
        Furthermore, if the maintenance task between any two trips is determined
     then the potential trips before and after this maintenance task can be further
     pruned:

              maint i,j = k ∧ k ≥ 0 ⇒ dom(trip i,j−1 ) := dom(trip i,j−1 ) ∩ Wk |1       (18)
                                         ∧ dom(trip i,j ) := dom(trip i,j ) ∩ Wk |2

     or an inconsistency is detectable if there is a maintenance task determined be-
     tween two trips but none of the potential trips can be performed before nor after
     this maintenance task:

         maint i,j = k ∧ k ≥ 0 ∧ (dom(trip i,j−1 ) × dom(trip i,j )) ∩ Wk = ∅ ⇒ false .(19)

     These rules are correct, too, i.e. only maintenance tasks or trips that cannot be
     operated by the according train are removed and these rules require O(mnq)
     time in the worst case.
         For each train zi ∈ Z and each type of maintenance type wu ∈ W we compute
     a sequence of integer values kmi,u,j ∈ N+ for j = 0, . . . , q − 1 presenting minimal
     km readings for the maintenance types directly after the predecessor of the trip
     in slot j or – in other words – before any empty drives, maintenance tasks of the
     trip in slot j. In particular in slot 0 the km readings are the km readings at the
     initial station10 of the train zi which will be either reset for periodic maintenance
     types or updated otherwise:

                       
                       
                                    zi .initialKmu if j = 0
                                      Gu (i, j − 1) if j > 0   ∧ u ∈ dom(maint i,j−1 )
                       
           kmi,u,j =
                       
                                                              ∧ wu .isPeriodic = 1
                           kmi,u,j−1 + K(i, j − 1) otherwise
                       

     where Gu (i, j − 1) with j > 0 is the smallest distance for travelling from a
     maintenance station in wu .Stations to any possible trip in slot j − 1:

     Gu (i, j − 1) = min{distance(s, t) + fk .distance |                                 (20)
                       s ∈ wu .Stations ∧ k ∈ trip i,j−1 ∧ k ≥ 0 ∧ t = fk .departureStation}

9
     due to Wki,j−1 |2 ⊆ Wk |2
10
     assuming that all maintenance types are initially within their limits.
Optimising Rolling Stock Planning including Maintenance with CP and QA                    9

and K(i, j − 1) with j > 0 is the smallest distance by train zi when performing
the trip in slot j − 1 maybe with some preceding (other) maintenance task:
           
           
            min{distance(s, r) + distance(r, t) + fk .distance |
                   s = zi .initialStation ∧ r ∈ wu .Stations
           
           
           
           
                   ∧ u ∈ dom(maint i,0 ) ∧ u ≥ 0 ∧ k ∈ dom(trip i,0 ) if trip i,0 6< 0
           
           
           
           
                   ∧ k ≥ 0 ∧ t = fk .departureStation}                   ∧ maint i,0 ≥ 0
           
K(i, 0) =
           
            min{distance(s,     t) + f k .distance |
                   s = zi .initialStation ∧ k ∈ dom(trip i,0 )
           
           
           
           
                   ∧ k ≥ 0 ∧ t = fk .departureStation}                if trip i,0 6< 0
           
           
           
           
             0                                                        otherwise
           

and
             
              min{distance(s, r) + distance(r, t) + fk .distance |
                   (s, k 0 ) ∈ A(trip i,j−2 ) ∧ r ∈ S(maint i,i−1 )
             
             
             
                                                                   if trip i,j−1 6< 0
                   ∧ (t, k) ∈ D(trip i,j−1 ) ∧ k 6= k 0 }
             
                                                                       ∧ maint i,j−1 ≥ 0
             
             
             
K(i, j − 1) = min{distance(s, t) + fk .distance |
                   (s, k 0 ) ∈ A(trip i,j−2 )
             
             
             
             
                   ∧ (t, k) ∈ D(trip i,j−1 ) ∧ k 6= k 0 }           if trip i,j−1 6< 0
             
             
             
             
               0                                                    otherwise
             

for j > 1 where

            A(T ) = {(b, k) | k ∈ dom(T ) ∧ k ≥ 0 ∧ b = fk .arrivalStation}           (21)
           S(M ) = {b | u ∈ dom(M ) ∧ u ≥ 0 ∧ b ∈ wu .stations}                       (22)
           D(T ) = {(b, k) | k ∈ dom(T ) ∧ k ≥ 0 ∧ b = fk .departureStation}          (23)

are sets of stations respective sets of station/trip pairs according to the vari-
ables T (for trips) and M (for maintenance tasks).
   Pruning rules for each train zi ∈ Z and each periodic maintenance type wu ∈
W with wu .isPeriodic = 1 forcing that there are not any trips for this train if
they will result in a violation of the maintenance limit:

      ∃j : j ∈ {0, . . . , q − 1} ∧ trip i,j 6< 0 ∧ kmi,u,j > wu .limit               (24)
           ⇒ ∀k : k ∈ {max(0, j − 1), . . . , q − 1} ∧ trip i,k < 0 [∧ maint i,k < 0] ,

u ∈ maint i,0 ∧ trip i,0 6< 0 ∧ kmi,u,0 ≤ wu .limit                                       (25)
      ∧ kmi,u,0 + min{distance(zi .initialStation, t) | t ∈ maint i,0 .Stations} > wu .limit
      ⇒ trip i,0 < 0 [∧ maint i,0 < 0] ,

∃j : j ∈ {1, . . . , q − 1} ∧ u ∈ maint i,j ∧ trip i,j 6< 0 ∧ kmi,u,j ≤ wu .limit     (26)
       ∧ kmi,u,j + min{distance(s, t) | fk ∈ trip i,j−1 ∧ k ≥ 0 ∧ s = fk .arrivalStation
       ∧ t ∈ maint i,j .Stations} > wu .limit
       ⇒ trip i,j < 0 [∧ maint i,j < 0]
10        C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

     and consistency rules for each train zi ∈ Z and each non-periodic maintenance
     type wu ∈ W with wu .isPeriodic = 0:

                               trip i,0 6< 0 ∧ kmi,u,0 > wu .limit ⇒ false                      (27)

     and

                      ∃j : j ∈ {1, . . . , q − 1} ∧ trip i,j 6< 0 ∧ kmi,u,j > wu .limit         (28)
                           ⇒ ∃l : l ∈ {0, . . . , j − 1} ∧ u ∈ dom(maint i,l )

     forcing that there must be at least one maintenance task of this type before
     exceeding the maintenance limit – or resulting in an inconsistency if there is not
     any such task. All these rules are obviously correct.
         Additionally, non-periodic maintenance tasks must be performed in the order
     given by their limits, i.e. any non-periodic maintenance task having a greater
     (smaller) limit than another non-periodic task of the same type11 must be
     performed after (before) the earliest (latest) possible occurrence of the task
     with greater (lesser) limit. Thus for each maintenance of type wx ∈ W with
     wx .isPeriodic = 0 is must hold:

     ∃r ∈ {0, . . . , q − 1} : x = maint i,r ∧ ∀k ∈ {0, . . . , r − 1} : x 6∈ dom(maint i,k )
             ⇒ ∀y : wy .isPeriodic = 0 ∧ wy .limit > wx .limit ∧ ∀j ∈ {0, . . . , r} :          (29)
                    dom(maint i,j ) := dom(maint i,j ) \ {y} ,
     ∃r ∈ {0, . . . , q − 1} : x = maint i,r ∧ ∀k ∈ {r + 1, . . . , q − 1} : x 6∈ dom(maint i,k )
             ⇒ ∀y : wy .isPeriodic = 0 ∧ wy .limit < wx .limit ∧ ∀j ∈ {r, . . . , q − 1} :      (30)
                    dom(maint i,j ) := dom(maint i,j ) \ {y} .

         The presented pruning and consistency rules are implemented in a specialised
     global constraint in the constraint solving library firstCS [18]. The problem-
     specific interrelations of all trip and maintenance task variables within a global
     constraint allows adequate and efficient reductions of the search space on the
     basis of the decisions made during a depth-first search which is one of the success
     factors of CP. Search space reduction is performed in two phases — during
     forward and backward iteration — until a local fixpoint is reached.
         For maximising the number of allocated trips to trains and minimising
     the empty driven kilometres we consider two objective variables numOfTrips ∈
     {0, . . . , n − 1} and emptyDrivenKms ∈ {0, . . . , M − 1} where M is a sufficiently
     large number.12 Then, after performing the presented pruning rules we compute
     the set of all trips potentially allocated to trains:

          AT (F )                                                                               (31)
          = {fk ∈ F | fk ≥ 0 ∧ fk ∈ trip i,j ∧ i ∈ {0, . . . , m − 1} ∧ j ∈ {0, . . . , q − 1}}
11
   Without loss of generality we assume that non-periodic maintenance task types have
   different limits.
12
   e.g. M = 1000000 [km].
Optimising Rolling Stock Planning including Maintenance with CP and QA               11

     and a lower bound of the sum of distances (in km) for empty drives lwbKms
     similar to kmi,u,j both used to prune the domains of the objective variables:13

                dom(numOfTrips) := dom(numOfTrips) ∩ {x | x ≤ |AT (F )|}                 (32)
           dom(emptyDrivenKms) := dom(emptyDrivenKms) ∩ {y | y ≥ lwbKms} (33)

     supporting branch-and-bound optimization of the chosen objective function
     where the number of trips dominate the sum of empty driven kilometres:

                       maximize     M · numOfTrips − emptyDrivenKms                      (34)

     subject to the already specified constraints.

     5    Quantum-Computing-Based Solution Approach

     For the quantum optimisation approach we have developed a model based on
     quadratic unconstrained binary optimisation (QUBO) [19, 20]. First, QUBO
     models have the advantage of being hardware independent. In other words, most
     of the available quantum hardware can be used for optimisation. In case of
     universal quantum computers, quantum optimisation algorithms (QAOA) [21]
     are employed. Otherwise, quantum annealing (QA) will be used for adiabatic
     quantum computers such as the D-Wave machines [22]. The second reason why
     we decided to use QUBO as our model of choice, the timetable problem can
     be treated as binary assignment problem where trips are linked with trains.
     This fits perfectly to the binary optimisation variables of a QUBO. However,
     often constraints are required for a thorough implementation. For example to
     satisfy the maintenance intervals of the trains. But as the name QUBO hints
     constraints are not part of the model. Instead constraints are integrated directly
     within the cost function. Because of this vague implementation of constraints
     it is vital that constraints are heavily penalised to avoid possible violations. A
     powerful constraint realisation are correlated decision variables, where at most
     one is allowed to be “true” simultaneously. For example in the case of our train
     assignment problem, two trains are not allowed to operate the same trip ever.
     Accordingly, the two assignment variables for train1 and train2 to operate trip
     f can never be “true” at the same time. Mathematically we enforce this by
     just adding the term “X[trip1, train1] · X[trip1, train2]” to the cost function,
     where the variables X[trip, train] are binary. By choosing a strong enough weight
     for this term we can ensure that this constraint is complied with. Most of our
     constraints are implemented according to this idea as explained later.
         Soft constraints, on the other hand, come naturally to QUBO modelling. The
     performance of a solution is not only measured by the number of operated trips
     but also how efficient the solution is. Thus, unnecessary empty trips need to be
     avoided. These so called soft constraints are one of the big advantages of QUBO
13
     here and in the following |S| denotes the size of any set S, i.e. the number of different
     elements in S.
12        C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

modelling. We just adapt the optimisation goal by adding an additional penalty
term which sums up the total empty travelled kms. Accordingly, solutions with
more empty travelled kms are discriminated over more economical and dense
time tables.

5.1     QUBO model

The heart of our QUBO model is the assignment variable, which links the avail-
able trains to the trips. In our model each train is able to operate q trips, with
q being defined beforehand. This leads to the optimisation variable X[i, f, z]
where f defines the trip, z the train and i corresponds to time slot (0 is the
slot for the first trip operated by the train z, q − 1 is the last possible slot). If a
trip f is operated by train z at time slot i, X[i, f, z] is equal to 1, otherwise 0.
Accordingly there are |T rips| · |T rains| · q decision variables. We used q = 3.
    For a valid timetable certain requirements need to be taken into account, e.g.
as mentioned above no trip should be operated by two trains. In total we have
to consider three constraints for the creation of a valid timetable. We need to
enforce that:

 1. each train operates at most one trip in each time slot,
 2. that each trip is operated at most once and by a single train, and
 3. that successive trips operated by the same train do not overlap (there is
    sufficient time for a possible necessary empty trip and the required post-
    processing).

      This predicate checks for an overlap in the trips sequence f1 , f2 :

overlap(f1 , f2 ) := (f2 .departureTime
< f1 .arrivalTime + f1 .postProc + duration(f1 .arrivalStation, f2 .departureStation))

    So far we did not consider maintenance. Here, the decision on performing
maintenance is not implemented with the help of an additional set of variables,
                                                                                  0
instead we integrate maintenance actions in a new set of (extended) trips Ff,u      .
This new set of trips consists of duplicates of the original trip f ∈ F from the
timetable, but for each trip f 0 ∈ Ff,u
                                    0
                                        , a maintenance action u is conducted before
the regular trip f takes place. In total, for each service station able to conduct a
                                                                          0
maintenance u an optional maintenance trip is created and added to Ff,u      . Conse-
                     0    0
quently, each trip f ∈ Ff,u starts from one of the possible maintenance station,
its duration exceeds that of f by the maintenance u duration and the travel du-
ration from the maintenance station to the start station of f . Also the departure
time is adapted accordingly. This approach requires constraint 2 to be modified,
at most one trip of Ff0 ∪ {f } needs to be operated, where Ff0 = ∪u∈W Ff,u    0
                                                                                 con-
tains all optional maintenance trips that are obtained by the regular trip f ∈ F
for all maintenance u ∈ W . The set Fall = ∪f ∈F (Ff0 ∪ {f }) contains all trips,
with and without maintenance beforehand where F corresponds to the regular
trips from the original timetable (cf. Sec. 3.2).
Optimising Rolling Stock Planning including Maintenance with CP and QA                                                 13

   For the here proposed QUBO the constraints 1-3 are implemented as penalty
terms in the objective function (Eq.44). Wherever the constraint is fulfilled the
associated term (c1 -c3 ) evaluates to zero.

             i
14       C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

     The cost function is then extended with the following terms:

                                                                                             !2
              X            X                             X X
      cm1 =                                α(u, z)                         X[0, f1 , z] − 1              (40)
              z∈Z          u∈W                                     0
                                                         f ∈F f1 ∈Ff,u
                    immediateAction(u,z)
                                                           i
Optimising Rolling Stock Planning including Maintenance with CP and QA           15

6   Empirical Examination of Both Approaches

For empirical examination of both approaches we generated two different data
sets considering a subset of the German rail network with trips between the
major cities Berlin, Frankfurt, Hamburg, Munich and Cologne shown in Figure 1.

             Fig. 1. Simplified train network for empirical examination

    For the initial evaluation we generated an artificial data set with a randomly
generated timetable between these five cities including 72 trips. For all subse-
quent evaluations we generated a data set based on a real train schedule for one
day from Deutsche Bahn. Thereby, we simplified the timetable considering the
following aspects: first, we only take direct trips between these cities into account
and, ignoring intermediate stations. For example, the ICE trip from Munich to
Cologne has a stopover in Frankfurt. We consider a direct trip from Munich to
Cologne, ignoring Frankfurt — usually the train is not exchanged on the way.
With this simplification we get a timetable with in total 284 trips for one day.
Furthermore, for purpose of simplification, we used standardised distances and
travel times between these cities, e.g. 570 km and 259 minutes from Munich to
Cologne, ignoring the variations that depend on the actual paths.
    For the periodic maintenance we use realistic intervals, i.e., 8,000 and 24,000
km. Nevertheless, due to a lack of real train data for the used data set, we arti-
ficially generated the mileage and, thus, the maintenance requirements for each
train. Because of high hardware requirement while generating QUBO models,
we use different subsets of our data set, varying the total number of trips and
trains (cf. Table 1).
16      C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

     For searching good or even best trip allocations w.r.t. to the defined objective
function (cf. (34)) while using the CP approach we applied monotonous branch
and bound (B&B) using a depth-first tree search with a first-fail heuristic. Trains
with smaller numbers of potential trips or the same number of potential trips
but with a smaller numbers of potential slots are considered first. Then for each
train the next trip – greatest trip index first – at the next slot – first slot first
– is labelled and then the maintenance tasks are labelled between trips starting
with the “no maintenance” index (−1) first to avoid maintenance tasks if not
required. The search and search space pruning was performed on a Pentium i7-
PC (notebook) running Windows 10 and Java 1.8 (single-threading) which is the
basis of the implemented CP approach. Table 1 shows the results of the empirical
examination of the CP approach on the generated data sets: the number of
allocated and of available trips, the number of used and available trains, the
total sum of kilometres for empty rides and the required run-time for finding the
solution. Due to the fact that only for the largest considered data set “real-100%”
more than 1 second, i.e. 1.5 seconds, are required to establish the constraints
and perform an initial propagation of these constraints only the run-time for
searching is shown in the table. The first solutions and the improved solutions
found so far (within a few hours), i.e. with the greatest number of allocated
trips and smallest sum of empty driven kilometres are shown. By definition of
the pruning rules (cf. Sec. 4) these solutions satisfy the constraints, i.e. the
allocated trips can be performed and the limits of the maintenance types are
respected.
     Table 1 shows as well the results obtained with QUBO models, both on the
D-Wave hybrid (classical+quantum) cloud system named LEAP that integrates
the over 5000 qubit machine “Advantage”, and on a classical computer with
tabu search. The classical computer used has 512 GB of RAM and 36 cores (72
with hyper-threading). Two versions for the number of the allocated trips are
given in many cases for the QUBO-based methods. The first one is the number
provided by solution, the second one is lower and represents the number of trips
still covered after removing the trips that cannot be fulfilled according to the
plan given by the solution due to the violation of the maintenance constraints
(the trips marked with red in Figure 2). The amount of time that was spent
computing the solution is given as well, in several cases split into pre-processing
and the actual search time. The main pre-processing task for the QUBO-based
models is computing the QUBO matrix, which can be a very time-consuming
task for a high number of qubits.

7    Discussion

For CP, in all cases the number of allocated trips in the first solution are rather
good, i.e. is not further increased while searching for better solutions. Spending
hours for searching for better solution only results in moderate reductions (8%–
23%) of empty driven kilometres. For a real small subset only one improved
solution was found rather quickly after 1 minute search, however ongoing search
Optimising Rolling Stock Planning including Maintenance with CP and QA                                                                                 17

                            Table 1. Results of the empirical examination

                       num. of trips num. of trains                    empty
    data set                                         method                       run-time
                         alloc. avail. used   avail.               rides [km]
                                                     CP first           12508          3 sec
    artificial               62          39
                                                     CP improved        10182     4.5 hours
                                   72            39
                             61          39          LEAP                6618 19+15 min
    (13569 qubits)
                        63(60)           37          tabu search         4705       35 min
                                                     CP first            5490          1 sec
    real-small subset        49          37
                                                     CP improved         4687         1 min
                                   70            38
                        52(51)           36          LEAP                5622 12+30 min
    (9921 qubits)
                        52(49)           34          tabu search         2035       26 min
                                                     CP first           11864          4 sec
    real-50%               122           75
                                                     CP improved         9781         5 min
                                  141            75
                      123(118)           75          LEAP               12405 2+1 hours
    (42651 qubits)
                      122(119)           72          tabu search         4267 2+0.5 hours
                                                     CP first           16402          8 sec
    real-75%               185          112
                                                     CP improved        14554     3.4 hours
                                  212           112
                      182(168)          112          LEAP               20548 8+1 hours
    (98775 qubits)
                      183(181)          112          tabu search         8178 8+24 hours
                                                     CP first           21941         2 min
    real-100%              247          150
                                                     CP improved        20325     2.9 hours
                                  284           150
                         failed           -          LEAP      too many nonzero elements
    (178194 qubits)
                         failed           -          tabu search          not enough RAM

for additional 3 hours failed to find a better solution — even better that the one
found while using LEAP or tabu search. In neither case it was possible to prove
with the CP approach that one of the found solutions is optimal.

ICE0193                                     Köln     Frankfurt                                            Frankfurt                   München
                                                                            MT1 (Frankfurt)
                                                     7                                                                      162

ICE0197                                Köln        Frankfurt          Frankfurt                     Hamburg
                                                   17                                   22

ICE0200                                                                                                                             Frankfurt          Hamburg
                                                          Frankfurt                       MT0 (Berlin) Berlin
                                                                                                                                                 242

ICE0201                                              Hamburg                       Frankfurt
                                                                          204

ICE0202              Köln                    München              München                             Köln
                                  64                                                    30

ICE0203                                Hamburg                        Frankfurt               Frankfurt                    Berlin
                                                           202                                                        43

0                5                     10                                 15                                   20                           25
                                                                      Time(h)

Fig. 2. Extract from a solution, showing regular trips (black), maintenance (blue),
empty travel (green), unavailability (yellow) and conflict with the maintenance re-
quirements (red).

    We note that for large problems we spent up to as much as 8 times longer
on computing the QUBO matrix than on minimising it. The reason is that the
computation of the QUBO matrix was implemented with high level symbolic
packages that are quite convenient to develop with but are rather inefficient
for very large problems. It is important to note that the QUBO matrix size is
18     C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

polynomial in the dimensions of the problems (trains, trips, maintenance, etc)
and that its computation can be done in polynomial time. However, minimising
the QUBO (solving the optimisation problem) is of exponential time order.
    The reason for which the speed of the classical computer running tabu search
seems to get much lower with increasing problem size is that we had to decrease
the number of parallel threads according to the increase of the problem size, to
keep the memory usage within bounds. In the most extreme case, even trying to
solve with a single thread was too much, thus despite being able to compute the
very large dimension sparse QUBO matrix for the largest data set (“real-100%”),
we could not solve it with tabu search. Solving it on LEAP proved impossible
as well, as the count of non-zero elements exceeded 200000, the current limit
of the LEAP hybrid solver. For the here presented data set and model, we
find that the number of required qubits increases slightly stronger than the
number of trips squared (∼ |trips|2.2 ). Another interesting observation is that
classical tabu search always has the lowest value in empty travelled kms. We have
tested the influence of the totalEmptyKM term in the cost function by setting
wgkm = 0 (real-75%). Surprisingly, the solution quality dropped and the number
of operated trips did not increase. Instead only 180 (171 after removal of the
trips not respecting the maintenance conditions) trips were operated although
the empty travelled kms increased to 22911.
    An intriguing aspect of the LEAP cloud hybrid solver from D-Wave is that
in the detailed timing that one can see in the online dashboard, the amount of
time spent on QPU never surpassed a second, even when the total time spent
by LEAP was up to 1 hour.

8    Conclusion and Future Work
We found once again that problem-specific constraints and heuristics are required
to being able to handle realistic problem sizes. We were thus able to optimise the
ICE railway traffic in Germany that goes through 5 major cities. Surprisingly,
the QUBO-based methods were able to handle up to almost 100,000 qubits. In
general the CP solution outperformed the QUBO based solutions except for a
real small subset. For the current stage of the quantum annealer and of the
hybrid solver from D-Wave the results obtained on classical computers and with
the help of the quantum annealer are fairly comparable. We plan to extend
the amount of cities covered, handle more details of the real problem (e.g. the
intermediary stations of the trips) towards a practice-ready prototype. For a
stable operation, it is also advantageous to have time slots, when trains are not
in operation, which are as long as possible instead of scheduling many short
break time slots. This increases the chance that one train can replace another
cancelled train. Hopefully in the near future the performance of the quantum
annealers will increase beyond the capacity of the classical computing.
Optimising Rolling Stock Planning including Maintenance with CP and QA        19

References
 [1]   Frank Arute et al. “Quantum supremacy using a programmable super-
       conducting processor”. en. In: Nature 574 (Oct. 2019), pp. 505–510. issn:
       1476-4687. doi: 10.1038/s41586-019-1666-5.
 [2]   Yung-Cheng Lai, Dow-Chung Fan, and Kwei-Long Huang. “Optimizing
       Rolling Stock Assignment and Maintenance Plan for Passenger Railway
       Operations”. en. In: Computers & Industrial Engineering 85 (July 2015),
       pp. 284–295. issn: 0360-8352. doi: 10.1016/j.cie.2015.03.016.
 [3]   Giovanni Luca Giacco, Andrea D’Ariano, and Dario Pacciarelli. “Rolling
       Stock Rostering Optimization Under Maintenance Constraints”. en. In:
       Journal of Intelligent Transportation Systems 18.1 (Jan. 2014), pp. 95–
       105. issn: 1547-2450, 1547-2442. doi: 10.1080/15472450.2013.801712.
 [4]   Jørgen Thorlund Haahr et al. “Simultaneously Recovering Rolling Stock
       Schedules and Depot Plans Under Disruption”. en. In: Proceedings of the
       13th Conference on Advanced Systems in Public Transport (CASPT) 2015.
       2015, p. 22.
 [5]   Richard M. Lusby et al. “A Branch-and-Price Algorithm for Railway
       Rolling Stock Rescheduling”. en. In: Transportation Research Part B:
       Methodological 99 (May 2017), pp. 228–250. issn: 0191-2615. doi: 10 .
       1016/j.trb.2017.03.003.
 [6]   Ralf Borndörfer et al. “Integrated Optimization of Rolling Stock Rotations
       for Intercity Railways”. en. In: Transportation Science 50.3 (Aug. 2016),
       pp. 863–877. issn: 0041-1655, 1526-5447. doi: 10.1287/trsc.2015.0633.
 [7]   Valentina Cacchiani. “Models and Algorithms for Combinatorial Opti-
       mization Problems Arising in Railway Applications”. en. In: 4OR 7.1 (Mar.
       2009), pp. 109–112. issn: 1619-4500, 1614-2411. doi: 10.1007/s10288-
       008-0075-7.
 [8]   Sarah Frisch et al. “A Mixed Integer Linear Program for Optimizing the
       Utilization of Locomotives with Maintenance Constraints”. en. In: Opera-
       tions Research Proceedings 2018. Ed. by Bernard Fortz and Martine Labbé.
       Cham: Springer International Publishing, 2019, pp. 103–109. isbn: 978-3-
       030-18499-5 978-3-030-18500-8. doi: 10.1007/978-3-030-18500-8_14.
 [9]   Satoshi Kato et al. “A Mixed Integer Linear Programming Approach to a
       Rolling Stock Rostering Problem with Splitting and Combining”. en. In:
       8th International Conference on Railway Operations Modelling and Anal-
       ysis (ICROMA). Vol. 69:36. Norrköping, Sweden: Linköping Electronic
       Conference Proceedings, June 17th – 20th, 2019, pp. 548–564.
[10]   Markus Reuther. “Mathematical Optimization of Rolling Stock Rota-
       tions”. en. Dissertation. Berlin: Technische Universität Berlin, 2017.
[11]   Qingwei Zhong et al. “A Mixed Integer Linear Programming Model for
       Rolling Stock Deadhead Routing before the Operation Period in an Urban
       Rail Transit Line”. en. In: Journal of Advanced Transportation 2020 (Jan.
       2020), pp. 1–18. issn: 0197-6729, 2042-3195. doi: 10.1155/2020/3809734.
[12]   Tomoe Tomiyama et al. “Development of Reactive Scheduling for Rolling
       Stock Operation Using a Constraint Model”. en. In: Electrical Engineering
20      C. Grozea, R. Hans, M. Koch, C. Riehn and A. Wolf

       in Japan 203.4 (2018), pp. 31–44. issn: 1520-6416. doi: 10.1002/eej.
       23062.
[13]   Daniel Harabor and Peter J. Stuckey. “Rail Capacity Modelling with Con-
       straint Programming”. en. In: Integration of AI and OR Techniques in
       Constraint Programming. Ed. by Claude-Guy Quimper. Vol. 9676. Cham:
       Springer International Publishing, 2016, pp. 170–186. isbn: 978-3-319-
       33953-5 978-3-319-33954-2. doi: 10.1007/978-3-319-33954-2_13.
[14]   P. Brucker, Johann L. Hurink, and T. Rolfes. Routing of railway carriages:
       A case study. Undefined. Tech. rep. 1498. Department of Applied Mathe-
       matics, University of Twente, 1999.
[15]   Krzysztof Domino et al. Quantum computing approach to railway dispatch-
       ing and conflict management optimization on single-track railway lines.
       2021. arXiv: 2010.08227 [cs.ET].
[16]   Tobias Stollenwerk, Elisabeth Lobe, and Martin Jung. “Flight Gate As-
       signment with a Quantum Annealer”. In: Quantum Technology and Op-
       timization Problems. Ed. by Sebastian Feld and Claudia Linnhoff-Popien.
       Cham: Springer International Publishing, 2019, pp. 99–110. isbn: 978-3-
       030-14082-3.
[17]   Sheir Yarkoni et al. “Quantum Shuttle: Traffic Navigation with Quan-
       tum Computing”. In: Proceedings of the 1st ACM SIGSOFT International
       Workshop on Architectures and Paradigms for Engineering Quantum Soft-
       ware. APEQS 2020. Virtual, USA: Association for Computing Machinery,
       2020, 22–30. isbn: 9781450381000. doi: 10.1145/3412451.3428500. url:
       https://doi.org/10.1145/3412451.3428500.
[18]   Armin Wolf. “firstCS—New Aspects on Combining Constraint Program-
       ming with Object-Orientation in Java”. en. In: KI - Künstliche Intelligenz
       26.1 (Feb. 2012), pp. 55–60. issn: 0933-1875, 1610-1987. doi: 10.1007/
       s13218-011-0161-4.
[19]   Fred Glover, Gary Kochenberger, and Yu Du. “A tutorial on formulating
       and using qubo models”. In: arXiv preprint arXiv:1811.11538 (2018).
[20]   Gary Kochenberger et al. “The unconstrained binary quadratic program-
       ming problem: a survey”. In: Journal of Combinatorial Optimization 28.1
       (2014), pp. 58–81.
[21]   Edward Farhi, Jeffrey Goldstone, and Sam Gutmann. “A quantum approx-
       imate optimization algorithm”. In: arXiv preprint arXiv:1411.4028 (2014).
[22]   Richard Harris et al. “Experimental investigation of an eight-qubit unit
       cell in a superconducting optimization processor”. In: Physical Review B
       82.2 (2010), p. 024511.
You can also read