Quarterly Report of RTRI
Online ISSN : 1880-1765
Print ISSN : 0033-9008
ISSN-L : 0033-9008
PAPERS
Scheduling Algorithm to Minimize Required Crew Size
Satoshi KATOTaichi NAKAHIGASHI
Author information
RESEARCH REPORT / TECHNICAL REPORT FREE ACCESS FULL-TEXT HTML

2025 Volume 66 Issue 4 Pages 275-281

Details
Abstract

Railway companies produce crew schedules when they revise their train timetables. Currently, these schedules are produced manually by experts. However, this manual task is time-consuming. It is therefore necessary to develop a system that supports crew scheduling using an automated generation algorithm. We propose an automated crew scheduling algorithm based on mathematical optimization to minimize the number of crew required. The results of a computational experiment using real data from a Japanese railway line confirm that the proposed algorithm can quickly generate efficient crew schedules that optimize crew size.

1. Introduction

When revising their timetables, railway companies must produce not only train timetables but also several related schedules. One of these is a crew schedule, which determines the schedules of drivers and conductors. From the viewpoint of effective utilization of available resources, railway companies produce schedules that require as small a crew as possible. However, crew scheduling has to take into many aspects related to the planning of work for crews such as regulatory requirements, and must therefore satisfy numerous constraints [1].

In most railway companies in Japan, crew schedules are currently planned manually by experts. Since the preparation of these plans requires a great deal of knowledge and experience, even experts spend several days to several weeks on a single line. Therefore, an automatic generation algorithm is required in order to save time and reduce the skill required for schedule planning. In addition, the automatic generation algorithm should be able to take into account the differences between drivers and conductors, and be applicable to several railway lines regardless of the number of trains or crew bases.

In this paper, we propose a versatile method for automatically generating crew schedules for train timetable revisions. The proposed method uses mathematical optimization to devise a two-stage process that divides the problem into two parts. This enables a crew schedule plan to be generated that minimizes the number of crew required in a short time. In addition, the performance of the proposed method is confirmed by using real Japanese railway line data.

2. Crew scheduling

2.1 Duty and roster

A crew schedule plan is produced using train timetables and rolling stock schedules for a train timetable revision. A crew schedule ensures that all trains in the given train timetable are adequately staffed and that crew members’ work schedules are determined. Crew management consists of two schedules, “duty” and “roster.”

A duty consists of multiple train operations and accompanying tasks such as shunting at stations, as well as breaks taken in between. There are two types of duties: a “one-day duty” where the start and end dates are the same, and an “overnight duty” where the duty ends the next day. Each duty must start and end at the same crew base located on the railway line. In addition, each duty must satisfy a number of constraints, such as upper limits on working hours and paid working hours based on laws and company regulations.

A roster is a circulation schedule that includes rest days between duties as necessary, and is the basis for the crew’s work shift of each month. A schedule planner generates a roster for each crew base. There are many constraints on a roster, such as ensuring rest time between two duties according to the previous duty (called “home rest time”) and granting the required number of rest days. The details of the constraints of a duty and a roster are described in the next section.

As crew members include drivers and conductors, there are some differences between the two roles. Drivers must be assigned to shunting work at stations or rolling stock depots, while conductors may be required to confirm all passengers have alighted at the terminal station. In some cases, the conductor may be exempt from being assigned to an out-of-service train. On the other hand, multiple conductors may be required for an express train. Thus, the number of crew members assigned to each train differs depending on whether they are drivers or conductors.

Figure 1 shows an example of a train timetable and a rolling stock schedule for 14 trains. Crew bases are located at Stations A and B, which we refer to as crew bases A and B, respectively. The circles in the figure indicate trains exiting from the rolling stock depot, the triangles indicate trains entering the rolling stock depot. The lines connecting two trains in a different direction at Station A or C indicate that the train is turning back. Figure 2 shows the set of duties based on Fig. 1, including two duties (Duty 1 and 2) for crew base A and four duties (Duty 3 to 6) for crew base B. Duties 1, 3, and 4 are one-day duties, while Duties 2, 5, and 6 are overnight duties. The dotted lines in Duties 2 and 3 are “crew deadheading,” which means crew travelling as a passenger to reach the start of a journey or to return home after a journey. Crew deadheading is inefficient and should be minimized.

Fig. 1 Example of train timetable and rolling stock schedule
Fig. 2 Example of crew duties

Figure 3 shows an example of a roster corresponding to the set of duties in Fig. 2. The number at the top indicates the number of days elapsed. A roster determines the order of duties and rest days. This roster shows a nine-day circulation schedule, meaning that a crew member assigned to work on the ninth day will be assigned to work on the first day of the following cycle. The number of days in the roster is equal to the number of crew members required to carry out the roster. In this paper, two consecutive rest days, are referred to as “double rest days.”

Fig. 3 Example of crew roster

2.2 Constraints

When generating a set of duties and rosters, constraints based on company regulations must be considered. The details of these constraints are listed next.

2.2.1 Constraints for duty generation

a) Ensure each duty on every train and every route section on the train timetable is assigned a crew member.

b) The average paid working hours per a day for each crew base must be within a given limit. This is calculated by dividing the total number of paid working hours on the roster by the “number of working days.” The number of working days is defined as the total number of days worked, with a one-day duty counted as 1 and an overnight duty counted as 2.

c) Each overnight facility has a maximum number of overnight duties it can accommodate.

d) The number of working days for each crew base has an upper limit.

e) Each duty starts at one of the crew bases and ends at the same crew base.

f) The working hours of a duty have an upper limit. This value depends on whether the duty is a one-day duty or overnight duty. The working hours refers to the time from the start time to the end time of the duty.

g) Paid working hours for a duty have an upper limit. Paid working hours include the time taken on each train, as well as the preparation time required before and after each train.

h) The rest period for a duty has a lower limit. The rest period is defined as the working hours for a duty minus the paid working hours.

i) Each duty must include mealtimes (breakfast, lunch, and dinner). This constraint is defined that each duty takes the required break time within a specific time period.

j) The start and end times of each duty must be within specific time periods. These time periods are different for one-day and overnight duties.

k) The area covered by each crew base is limited.

l) Sleep time in an overnight duty has a lower limit.

m) Continuous working time has an upper limit. Continuous working time is defined as the time during which the crew is considered to be working without breaks.

n) Interval time between two consecutive continuous working times shall be above and below a set value.

2.2.2 Constraints for roster generation

o) All duties must be incorporated into a roster.

p) The required number of rest days must be included in a roster.

q) The home rest time has a lower limit. The value is different for the case without rest days, with a rest day, and with double rest days.

r) The end time of a duty before a rest day must be before a set time.

s) The start time of a duty after a rest day must be after a set time.

t) The consecutive working days without a rest day have an upper limit. Several constraints of this type may be set.

2.3 Literature review

Many studies have been conducted on crew scheduling algorithms for train timetable revisions. Heil et al. [2] classify the problems, modeling, and solutions from previous studies. Although there have been many studies overseas to generate both duty and roster schedules, labor constraints are specific to the laws and regulations of each country. Therefore, it is difficult to apply methods proposed overseas directly to Japanese railways. In Japan, several studies have focused on the generation of duty schedules including those by Miura et al. [3] and Nishi et al. [4], and most of these studies apply mathematical optimization. On the other hand, only a few studies focus on crew rostering algorithms, namely Sakaguchi and Nozue [5] and Sugiyama et al. [6].

In addition, only a limited number of studies deal with duty and roster generation simultaneously. In Japan, Sakaguchi et al. [7] have dealt with duty and roster generation. However, their work does not take into account the home rest time with double rest days. Consequently, the required number of crew is an approximate figure.

3. Crew scheduling algorithm

3.1 Outline of proposed algorithm

Since the main objective of this research is to minimize the number of crew required, and mathematical optimization has been widely used in previous studies on crew scheduling, we use it for automatic generation.

As mentioned in Section 2.1, it is necessary to generate both duties and rosters in order to calculate the number of crew required. Therefore, to minimize crew sizes a “simultaneous method” could be adopted to generate both duty schedules and roster schedules simultaneously. However, previous studies have shown that each solution is a large-scale combinatorial optimization problem, so it is very difficult to solve the problem using the simultaneous method. Therefore, we adopt a “two-stage method,” whereby first a duty schedule is generated, and then this is used to generate a roster schedule.

The procedure of the proposed algorithm is shown below.

Step 1: Generation of trips

Using input data including the train timetable and rolling stock schedule, as well as the trains and the stations where crew can change, we generate the minimum unit of train service, which is called “trip.” Details of trip generation are described in Section 3.2.

Step 2: Application of duty generation algorithm

We generate a set of duties for each crew base. The duty generation problem is modeled as a “Set Covering Problem (SCP),” which is a type of mathematical optimization problem. In addition, we use the “column generation method” [8] as a solution. Details of the duty generation algorithm are described in Section 3.3.

Step 3: Application of roster generation algorithm

We generate a roster for each crew base using the duty schedule obtained in Step 2. The roster generation problem is modeled as a “Travelling Salesman Problem (TSP),” which is also a type of mathematical optimization problem. Details of the roster generation algorithm are described in Section 3.4.

The main objective is to minimize the required crew size. In addition, we aim to obtain a practical crew scheduling plan that takes into account the crew’s workload as much as possible. Then, we define the objective functions of Step 2 and Step 3 as follows.

・In Step 2, the number of working days is minimized. In addition, deadheading is minimized.

・In Step 3, the smallest buffer time from the required home rest time with a holiday or double rest days is maximized, because it is desirable to ensure sufficient home rest time with rest days to reduce the crew’s workload.

3.2 Generation of trips (Step 1)

As a pre-processing step for the duty generation algorithm, a set of trips is generated. The rolling stock schedule is divided into parts at stations where crews can change, and each part is treated as a trip.

Figure 4 shows an example of the set of trips. The train timetable and the rolling stock schedule are the same as in Fig. 1. In this example, each crew can change at Stations A and B, but not at Station C, so the rolling stock schedule is not divided at Station C. In case of 3M or 5M at Station A, exit work from the depot is necessary before driving. So exit or entry work at the depot may appear in the driver scheduling. On the other hand, since conductors do not perform this type of work, they do not appear in the conductor scheduling. This change to the definition of a trip allows drivers and conductors to be distinguished.

Fig. 4 Example of trips

In addition, the problem size increases as the number of trips increases. The number of trips is thus kept to a minimum by counting a return journey with the same driver as a single trip in driver scheduling, instead of dividing it into two trips.

3.3 Application of duty generation algorithm (Step 2)

3.3.1 Overview of SCP and column generation method

A duty is produced by connecting several trips generated in Section 3.2. As previously mentioned, the duty generation problem is modeled as a SCP that is a mathematical optimization model. The set of columns, the cost of each column, and its covering rows are given in SCP, and we determine a set of columns with the lowest total cost that cover all rows in the original set. When a duty generation problem is modeled as a SCP, the rows correspond to trips and the columns correspond to duties.

Figure 5 shows an example of the coefficient matrix when a duty generation problem is modeled as a SCP. In this example, there are eight trips and seven duties satisfying the constraints (called “candidate duties”). The yellow areas indicate the trips covered by each duty. For example, Trips 1 and 3 are covered by Duty 1 with a coefficient of 1. The cost of each duty is shown in blue. After selecting duties which together cover all eight trips, where each duty covers at least one trip (which explains why the right-hand column shows greater than or equal to 1), the set of candidate duties which together have the lowest cost is found. In this example, the set with the minimum cost of five that covers all trips is achieved by selecting duties 2, 4, and 5.

Fig. 5 Example of coefficient of SCP model

In order to obtain the set of duties with the minimum cost, it is necessary to list all the duties (columns) that satisfy the constraints mentioned in Section 2.2. However, the number of duties satisfying the constraints is several million or more in reality. Therefore, the number of columns is enormous, which makes solving the problem in a short time difficult. Therefore, we use a column generation method (see Ref. [8]) that will only extract efficient columns. The following procedure outlines how to apply the column generation method to the duty generation problem.

Step 2-1: The algorithm prepares a set of initial columns and adds them to Restricted Linear Programming Master problem (RLPM).

Step 2-2: The algorithm solves the RLPM using the current set of generated columns.

Step 2-3: Based on the best solution of the RLPM in Step 2-2, the algorithm solves the column generation sub-problem to generate new columns with negative reduced costs. If a column with a negative reduced cost is found, it is added to the RLPM, and the process returns to Step 2-2. Otherwise, column generation is terminated, and the process goes to Step 2-4.

Step 2-4: The algorithm obtains a feasible solution using the set of generated columns so far.

3.3.2 Restricted linear programing master problem (Step 2-1 and Step 2-2)

RLPM refers to a mathematical optimization problem in which only certain columns are included, and the variables are linearly relaxed. The formulation of RLPM is given below. Table 1 shows the definitions of the notations used.

  
Min. k K j J k c j k x j k + i M d i y i (1)

  
s.t. k K j J k a ij k x j k y i = m i , i I (2)

  
k K j J k ( e j k c j k f k ) x j k 0 , k K (3)

  
k K j J k 𝑔 j kl x j k q l , l L (4)

  
k K j J k c j k x j k r k , k K (5)

  
x j k 0 , j J k , k K (6)

  
y i 0 , i I (7)

Table 1 Notations for formulation of RLPM

Notation Definition
K Set of crew bases
I Set of trips
Jk Set of candidate duties of crew base k
L Set of crew accommodations
a ij k 1 if candidate duty j of crew base k is assigned to trip i, 0 otherwise
c j k Workday of candidate duty j of crew base k
di Weight (Cost) for deadheading of trip i
mi Number of crew required for trip i
e j k Paid working hours of candidate duty j of crew base k
𝑔 j kl 1 if candidate duty j of crew base k uses accommodation l, 0 otherwise
fk Upper limit of average paid working hours for crew base k
ql Upper limit of crew accommodation l
rk Upper limit of the number of workdays of crew base k
x j k 1 if candidate duty j of crew base k is selected, otherwise 0
yi Number of crew deadheading in trip i

Equation (1) is the objective function, where the first term refers to the number of working days and the second term refers to the cost of crew deadheading. Equation (2) to (7) represent the constraints. Equation (2) to (5) imply constraints a) to d) described in Section 2.2. Equations (6) and (7) imply the possible values of the variables. Compared with the example in Fig. 5, the following points are different: in equation (2), the difference between the right and left sides (excess allocation) is obtained as yi, which is reflected in the second term of the objective function equation (1); in equation (2), the right-hand side is not uniformly 1 but mi; equation (3) to (5) has been added; and variable x j k is a real number.

3.3.3 Column generation sub-problem (Step 2-3)

A column generation sub-problem involves finding a new column (duty) to be added using the optimal solution of RLPM. Here, we seek columns for which the following reduced cost is negative.

  
c j k k K j J k a ij k π i + ( e j k c j k f k ) θ k + 𝑔 j kl μ l + c j k ρ k (8)

where πi, θk, μl and ρk are the dual variables of equations (2) to (5), respectively, obtained by solving the RLPM. Since a column implies a duty, the generating column must satisfy the constraints e) to n) described in Section 2.2.

This problem can be modeled as a constrained shortest path problem on a network, with trips represented by nodes and connectivity between trips represented by arcs. By applying a labeling method to solve this problem, the optimal solution can be obtained in a short time (see Ref. [9] for details).

3.3.4 Obtaining a feasible solution (Step 2-4)

In the process of the column generation method, x j k is linearly relaxed, so a feasible solution (a solution where x j k is an integer) cannot be obtained. Therefore, it is necessary to calculate a feasible solution after the column generation method has converged. Then, we apply a heuristic algorithm based on Nishi et al. [5] to obtain a feasible solution. At the stage of convergence of column generation, some x j k are fixed to 1. Here, variable fixing is based on the following ideas.

・When the objective function values of the RLPM converge, all values of x j k are fixed to 1 if x j k is equal to 1 in the RLPM.

・If there is no x j k whose value is equal to 1, only one x j k closest to 1 is fixed to 1.

After fixing some x j k , return to Step 2-2 in Section 3.3.1 and column generation is applied again. In this way, the number of x j k to be fixed is increased by repeating column generation. Finally, column generation is terminated when all trips are covered by the set of columns corresponding to the fixed variables.

3.4 Application of roster generation algorithm (Step 3)

3.4.1 Modelling as TSP

Give the set of duties generated by the above algorithm, roster generation algorithm gives a set of rosters that satisfy the constraints o) to t) in Section 2.2.

We model the crew rostering problem as a TSP by representing the generated duties as nodes and the connections between duties as arcs. The cyclic paths of the TSP solution pass through all nodes and correspond to the roster. That is, the constraint o) in Section 2.2 can be satisfied.

Since there are three cases between two sequence duties on a roster: no rest day between two duties, a rest day between two duties, and double rest day between two duties, three types of arcs are defined: a “normal arc” with no rest day, a “rest day arc” with a rest day, and a “double rest days arc” with double rest days. Therefore, up to three types of arcs can be drawn between two nodes. However, if any of the constraints q) to s) mentioned in Section 2.2 are not satisfied, the arc is not drawn. As described in section 3.1, the smallest buffer time from the required home rest time with a rest day or double rest day is maximized. Therefore, the cost of each arc is set to zero for a normal arc and the smallest buffer time from the required home rest time for a rest day arc and a double rest days arc.

Figure 6 shows an example of a TSP network. In this example, the duties of crew base B in Fig. 2 are given. Duties 3 to 6 correspond to nodes 3 to 6, respectively. Arcs are drawn only when all three types of arcs satisfy the constraints. In this network, we find a cyclic path that passes through any of these four nodes only once with the lowest cost.

Fig. 6 Example of network based on TSP model

3.4.2 Formulation as TSP

The following is an outline of the formulation as a mathematical optimization problem (see Ref. [9] for details).

<Objective function>

Maximization of the smallest buffer time in the required home rest time with a rest day or double rest days

<Constraints>

・Assignment of each duty to one of the rosters

・Subtour elimination constraints

・Constraints for consecutive working days

・Ensuring the required number of rest days

・Constraints on possible values of each variable

4. Case study

4.1 Lines and settings

In order to evaluate the effectiveness of the proposed method, we show the results of a case study with real Japanese railway data. The outline of each line is shown in Fig. 7. We generate a conductor schedule in Line I, where there are two crew bases adjacent to Stations B and E, and seven accommodation stations including these two stations. On the other hand, we generate a driver schedule in Line II, where there is one crew base adjacent to Station J and seven accommodation stations including Station J.

Fig. 7 Outline of each Line

Table 2 also shows the number of crew bases, number of trains, and number of trips for each line as information on the size of the two Lines. All of these lines are relatively large with more than 400 trains each. Although the number of crew bases and the number of trains on Line I are both larger than Line II, the trains on Line I include many trains of out-of-service. Since a train which is out-of-service does not require a conductor, the scale of the study of Line II is bigger than that of Line I. In addition, the covering area of the two crew bases on Line I are different.

Table 2 Characteristics of each Line using case

LineCrew typeNo. of crew basesNo. of trainsNo. of trips
IConductor2483430
IIDriver1402403

The performance of the proposed method is evaluated using criteria such as the number of working days and computational time. Here, we compare the evaluation criteria for the schedule generated by the proposed method with those for the actual schedule produced by experts. We use a PC with a Windows 10 Professional OS, Core i7-8700K CPU and 64 GB memory for the calculation and Gurobi Optimizer 10.0.1 [10] to solve the mathematical optimization problem.

4.2 Results of computational experiments

The results of the proposed method are shown in Tables 3 and 4. Table 3 compares the crew duties generated by the duty generation algorithm with the actual schedules for Lines I and II. The table shows the number of working days, the average paid working hours per a day, the average working hours (counted only for overnight duties), and the computational time (in seconds). The number of working days is lower than the actual schedule for both Lines I and II, indicating that the duty generation algorithm can produce an efficient schedule. On the other hand, the average paid working hours are slightly lower than that of the actual schedule for Line I, but higher for Line II. The average working hours increase significantly in both Line I and II. Although there is no problem with the results because both the paid working hours and working hours satisfy the constraints, in practice it is suggested that greater consideration is given to crew workload, not just in terms of crew size but also based on indicators such as paid working hours and working hours.

Table 3 Results of duty generation

LineMethodNo. of working daysAverage paid working hoursAverage working hoursComputational time (sec.)
IProposed726h57m23h40m125.7
Actual737h05m20h48m
IIProposed806h48m20h43m237.2
Actual826h12m19h17m
Table 4 Results of roster generation

LineMethodNo. of crew requiredMinimum buffer timeComputational time (sec.)
IProposed1047h43m32.4
Actual1052h48m
IIProposed1169h12m1010.7
Actual1190h32m

Table 4 compares crew rosters generated by the roster generation algorithm with the actual schedule. The table shows the number of crew required, the minimum buffer time from the required home rest time with a rest day or double rest days, and the computational time (in seconds). It is understood that the larger the buffer time, the lower the workload and the better the scheduling. The proposed required crew sizes are smaller than that in the actual schedule for both Lines I and II. The minimum buffer times are also larger than that in the actual schedule. Therefore, we can produce a plan that is more efficient than the actual schedule in terms of both crew size and workload.

The computational time for both Line I and II is less than 30 minutes for the generation of the duty and the roster. Considering that the current manual work takes several days to several weeks, the proposed algorithm can generate a crew schedule plan in a sufficiently short time.

5. Conclusion and future work

This paper discusses the generation of crew scheduling plans for train timetable revisions and proposed a crew scheduling algorithm to minimize required crew sizes. The proposed algorithm uses mathematical optimization and is based on a two-stage process: first, a set of duties is generated, and this is used to generate a set of rosters, in sequence. We also presented case studies using data from several Japanese railway lines, including both drivers and conductors. We confirmed that the proposed algorithm can automatically generate a schedule plan with smaller crew sizes than required by the actual schedule within 30 minutes. On the other hand, the working hours and paid working hours are longer than in actual schedules, indicating that experts produce scheduling plans that consider the crew’s workload.

In the future, we will develop a more practical method for automatically generating crew schedule plans by incorporating a new perspective on crew workload.

References
Authors

Satoshi KATO
Senior Researcher, Transport Operation Systems Laboratory, Signalling and Operation Systems Technology Division Research Areas: Transportation Planning, Mathematical Optimization
Taichi NAKAHIGASHI
Researcher, Transport Operation Systems Laboratory, Signalling and Operation Systems Technology Division (Former)
Research Areas: Transportation Planning, Train Rescheduling

 
© 2025 by Railway Technical Research Institute
feedback
Top