Personalized Crew Rostering at Railways

Geert de Pont University of Tilburg

Preface

Before you lies the thesis Personalized Crew Rostering at Netherlands Railways. The research and the writing were done during a 7-month internship at Nether- lands Railways, division NS reizigers, department of logistics, in order to finalize my studies Econometrics and Operations Research at the University of Tilburg. Here I want to express my gratitude to my family and friends who helped me finishing my studies. In particular, my parents. Without their continuous support I would not have been in the position where I am right now. Furthermore, I would like to thank a number of people, who helped me finishing this thesis. First of all, I would like to thank my supervisors at NS, Dennis Huisman and Erwin Abbink for giving me the opportunity to conduct this research. Their knowledge, assistance and advice during my internship have been of great value to me. Special thanks goes out to my supervisor at the University of Tilburg, Willem Haemers, as well. Furthermore, I would like to thank my colleagues at NS – Roger Haenen, Pieter-Jan Fioole and Martijn van Beek – for creating a pleasant atmosphere for me to work in. Finally, I would like to thank G´abor Mar´oti for teaching me the basics of LATEX. I have worked with great pleasure and interest at this assignment. It has given me great insight in the practical side of Operations Research, especially in the field of linear programming problems. The expertise at NS and the quality of the available software were very high and I am thankful that they were available to me.

Geert de Pont November 29, 2006

iii iv Abstract

For each driver and conductor of a passenger railway operator a roster needs to be constructed, specifying which tasks he/she has to execute each day. Constructing rosters for such large transport organizations is a very complex problem. Therefore, the roster process at many railway operators is simplified by con- structing non-personalized rosters. As a result, personal prefer- ences on working hours cannot be taken into account. In this thesis, the crew rostering problem is discussed, in par- ticular at the main Dutch passenger railway operator, Nether- lands Railways. A method to construct personalized rosters is explained in detail. This method constructs rosters by split- ting the roster process in two phases. The performance of the method is tested on real-life instances of Netherlands Railways.

v vi Contents

Abstract v

1 Introduction 1

2 Netherlands Railways 3

3 Problem definition 7 3.1 CrewSchedulingandCrewRosteringatNS ...... 7 3.1.1 Creatingduties ...... 7 3.1.2 Constructingtherosters ...... 8 3.2 Analysisofthecurrentrostermethod ...... 9 3.3 Personalrosters...... 10 3.4 Objectivesoftheresearch ...... 10

4 Review on literature of crew rostering 11 4.1 Twoapproaches...... 11 4.2 Personalizedrostering ...... 12

5 A method to construct rosters for NS 15 5.1 Twophases ...... 15 5.2 Solutionapproach ...... 16

6 First phase 17 6.1 Enumerationprocess ...... 17 6.1.1 Enumerationprocess...... 18 6.1.2 Legalityconditions ...... 19 6.2 Selectingtherosters ...... 21 6.2.1 Thesetpartitioningproblem ...... 21 6.2.2 Thecostfunction...... 22 6.3 Reducing the combinatorial size of the problem ...... 23

7 Second phase 25 7.1 Notation...... 25 7.2 Decisionvariables...... 26 7.3 Constraints ...... 26 7.3.1 Assignmentconstraints ...... 26 7.3.2 Constraints due to the CAO and ATW ...... 27 7.3.3 “Overtime”distribution ...... 35 7.3.4 “SweetandSour”distribution ...... 35

vii viii CONTENTS

7.4 Theobjectivefunction ...... 36 7.4.1 Objectivefunctions...... 37

8 Implementation issues 39 8.1 Firstphase ...... 39 8.2 Secondphase ...... 40

9 Data and cases 41 9.1 Data...... 41 9.2 Cases ...... 41 9.2.1 Preferences ...... 42 9.2.2 Cyclic pattern rosters and adjusted preferences ...... 44

10 Computational results 47 10.1Firstphase ...... 47 10.1.1 Parametersetting ...... 47 10.1.2 Results ...... 48 10.2Secondphase ...... 49 10.2.1 Parametersettings ...... 49 10.2.2 Results ...... 49

11 Conclusions and recommendations 55 11.1Conclusions ...... 55 11.2 Recommendations and further research...... 56

A Lists of definitions and rules 59 A.1 Duties ...... 59 A.2 Legalityrules ...... 60 A.2.1 The Collective Labour Agreement of NS (CAO)...... 60 A.2.2 The Dutch working hours act (ATW) ...... 61 A.2.3 “SharingSweet&Sour”rules ...... 61 Chapter 1

Introduction

Netherlands Railways (NS) is the major Dutch passenger railway operator. Every day around five thousand passenger trips are carried out by NS around their railway network. The trains used for the transport are staffed with con- ductors and drivers. There are currently around seven thousand drivers and conductors working at NS. For every driver and conductor a roster needs to be created that indicates at what times which tasks he/she has to do. Conductors and drivers are called crew members in the literature on rail crew rostering. In the remainder of this chapter, we refer to drivers and/or conductors if we use the words crew members. The drivers and conductors are working at crew bases. The tasks for the crew members are allocated to the crew bases and combined till complete units of work are generated. This process is called crew scheduling. The allocation of the complete units of work to the crew members is called crew rostering. The largest crew base of NS is , where around 300 drivers and 400 conductors work. Rostering all the crew members of a crew base is a complex problem. NS reduces the complexity of the problem by dividing the group of crew members into smaller subgroups. Each subgroup gets assigned a part of the amount of work. Instead of creating a personal roster for every crew member in that subgroup, one roster is created for the subgroup. Since the roster is used by all crew members in the subgroup, personal preferences on working hours cannot be taken into account. A more detailed description of the crew planning process is described in Chapter 3. Over the years there has been a lot of progress in the field of crew rostering. Commercial crew rostering systems have been implemented successfully at some major airlines. With the help of these systems, personal rosters can be created. NS is interested in implementing a commercial crew rostering system to create personal rosters. This thesis reports on an method to create personal rosters. The method is tested on drivers working at crew base Utrecht. This test will give more insight into personalized rostering and its applicability at NS is attained. Before giving a detailed description of the method, Chapter 2 provides us with a brief overview of the company structure of the NS. Next, the current crew planning process is discussed in Chapter 3. Chapter 4 gives an overview of the literature on crew rostering. The method to create rosters is introduced in Chapter 5. This method splits the roster process in two phases. The first phase is explained in Chapter 6, the second in Chapter 7. Chapter 8 discusses

1 2 CHAPTER 1. INTRODUCTION the implementation issues of the method. The used data and the cases that are tested are described in Chapter 9. The results of the tests are presented in Chapter 10, followed by some concluding remarks in Chapter 11. Chapter 2

Netherlands Railways

The NS as we know it today did not exist up till 1937. Before that time, a couple of small companies controlled the railway network. Then, in 1937, a company was established that was fully responsible for all the train services in the country. This company is known as (NS) and is still operative today. Until 1995, the Dutch government was complete owner of the company. Thereafter, it retreated as owner and the NS became an independent company with the government as sole stockholder. NS provides the passenger transport over the most heavily used railway network of the world. It is the ambition of the NS to be one of Europe’s best passenger railway operators with reliable passenger transport and high customer satisfaction. The current mission statement of NS is therefore formulated as:

“Providing safe, comfortable and non-delayed transportation of pas- sengers through attractive stations.”

After the privatizing there was a massive restructuring of the organization in 2001. From this time on, NS split the company in several sections, namely Passenger Transport, Hub Development and Construction. An overview of the current structure of the company is visualized in Figure 2.1. The sections are split in subsections, each with its own tasks and responsibilities. For exam- ple, NS Stations has full responsibility for all the station buildings. NS Com- merce makes sure the products and services are customer directed. From all subsections NS Reizigers (NSR), having 10,000 employees and over 1,000,000 customers, is the largest subsection. They are responsible for the domestic pas- senger transport. Furthermore, they try to provide a robust timetable for the trains and spread reliable information during disruptions. Moreover, they try to provide their customers with sufficient and comfortable rolling stock. To summarize, NSR has full responsibility for all the issues concerning passenger railway transport. An overview of the structure of NSR is depicted in Figure 2.2. As can be seen from the chart, NSR is divided into a couple of departments and four networks. These networks are Randstad South, Randstad North, North East and South. Each network has its own center for adjusting the train network

3 4 CHAPTER 2. NETHERLANDS RAILWAYS

Executive Board

Support Companies Company Units and Subsidiaries

Passenger Transport Hub Development Construction

NS Passengers NS Commerce NS Stations Strukton NS International NS Real Estate

NedRailways NedTrain

Figure 2.1: Organization chart of NS for the specific network. However, the most central departments of NSR are situated at the NS Headquarters in Utrecht. Within NSR there is the Logistics department. The NSR Logistics depart- ment is responsible for the creation of a timetable and the planning of rolling stock and personnel. Looking at Figure 2.3, we see that the department itself is subdivided into four sections. Product design is responsible for the long term planning process (up till 10 years from now). IT manages the systems used by all divisions and develops new systems as well. The daily plan department is responsible for temporary changes in the timetable, rolling stock or personnel due to disruptions in the railway network or temporary changes in the demand (holidays). The fourth and final section is the annual plan department. Annual plan department has three tasks. First of all, it is responsible for the production of the timetable. Furthermore, it’s annual plan’s task to schedule the rolling stock, by taking into account the passengers forecast by NS Commerce. Finally, annual plan section assembles tasks for conductors and drivers, such that complete units of work, called duties are generated. The duties are delivered to the crew bases, where they are assigned to the drivers and conductors. The roster process is explained in detail in Chapter 3. 5

Executive Board NSR

Finance P&O

Rolling stock & Infra policy

Logistics

Production services

Operations control

Net. Randstad South Net. Randstad North Net. North East Net. South

Drivers Guards Process Managers

Figure 2.2: Organization chart of NS Reizigers

NSR Logistics

Product Design Annual Plan Daily Plan IT

Timetabling Train Schedule Long term Development Rolling Stock Projects Scheduling

Crew Extra Scheduling Transportation

Figure 2.3: Organization chart of NSR Logistics 6 CHAPTER 2. NETHERLANDS RAILWAYS Chapter 3

Problem definition

This Chapter describes the objectives of our research. Since our research deals with crew rostering, it seems natural to start by describing the current crew rostering process at NS in Section 3.1. For a more detailed description of the current roster process, we refer to [4]. An analysis is given in Section 3.2 to point out the consequences of the simplifications used in the process. Person- alized rostering and the consequences in relation to the current roster process are described in Section 3.3. We conclude with the objectives of the research, described in this thesis.

3.1 Crew Scheduling and Crew Rostering at NS

As mentioned in Chapter 2, complete units of work are constructed by the Annual Plan section. These units of work are called duties. A duty is a serie of tasks for one crew member from a specific crew base on a certain day. The specifics of a duty are in the appendix. A task is an indivisible activity between two railway stations or at a single railway station. The duties are constructed, such that they begin and end at the same location. This location is called a crew base. Furthermore, the duties have to satisfy all kinds of rules. The problem of creating duties out of the total package of tasks is in the literature known as the crew scheduling problem. After the duties have been constructed, they need to be assigned to the crew members, such that legal rosters are constructed. Since each duty belongs to a crew base, rosters should be created for each crew base separately. A legal roster is a roster that satisfies all the rules of the Collective Labour Agreement (CAO) and the working hours act (ATW). These rules can be found in the appendix. The problem of creating rosters is known as the crew rostering problem. The scheduling process and rostering process at NS are explained in more detail in the following subsections.

3.1.1 Creating duties Annual plan section creates duties for generic days (e.g. a Monday) on the basis of the new timetable and rolling stock schedule. The duties for generic days are constructed by combining the tasks for generic days. The set of tasks for the generic days is modified about six times a year. Some roster aspects need to be

7 8 CHAPTER 3. PROBLEM DEFINITION taken into account when the duties are constructed. For example, the average duty length should not exceed a certain length. Furthermore, it is important that the popular and unpopular tasks are divided fairly over the crew bases. Driving on an A-train (Intercity or semi-fast train) is for example preferred over driving on a B-train (regional train). Since variety is desired, similar tasks in a single duty are unpopular. The constraints with regard to a fair division of the popular and unpopular work over the crew bases are typical for the Dutch situation and are known as the “Sharing Sweet and Sour” rules. A few rules are listed in the appendix. We refer to [1] for a more detailed description of these rules. The duties for a specific day (e.g. Monday 16 October) are based on the duties for the corresponding generic day (Monday). The rosters are created after the construction of the generic duties since all duties are determined then. When the generic tasks are modified by Daily Plan section then the duties will be affected. The duties will be modified then, such that the rosters are still legal. Only if the duties cannot be modified otherwise, the rosters are modified.

3.1.2 Constructing the rosters

The basic rosters are constructed in two steps. First, the crew members of each crew base are clustered into groups. Such a group is called a roster group and varies in size between 4 and 20 crew members. All the crew members in the roster group have the same characteristics (e.g. drivers, full time crew members, same route knowledge). The duties are allocated to the roster groups. This allocation should satisfy all kinds of rules, ensuring a high probability of a legal roster for each crew member in the roster group. Furthermore, it is desired that the popular and unpopular work is allocated fairly over the roster groups. Therefore, each roster group is represented by one crew member, who is responsible for the allocation of the duties to the roster group. Next, the same representative constructs one roster for all crew members in the roster group. This roster is a so-called cyclic roster and is explained in detail below. Constructing a cyclic roster is a complex process, which is solved manually. When the representative cannot construct a legal roster, then he/she can exchange duties with the other roster groups. Table 3.1 is an example of a cyclic roster for a roster group of 12 crew members. For simplicity the exact duty numbers and times are left out and only the type of duty is shown (DO is a day-off, ED is an early duty and LD is a late duty). The roster is called cyclic because after executing the last week of the roster, the first week of the roster is executed again. A cyclic roster for k crew members has a length of k weeks. Every crew members starts in a different week of the roster. In the first week, crew member 1 executes the work of week 1. In the second week, crew member 1 executes the work of week 2, etc. Crew member 2 executes the work of week 2 in the first week. In the second week, crew member 2 executes the work of week 3, etc. So, crew member i executes the work of crew member i + 1 exactly one week later. The quality of a cyclic roster depends on the order of the duties. Some examples of preferences are:

• Two or more adjacent days off are preferred over non- adjacent days off. 3.2. ANALYSIS OF THE CURRENT ROSTER METHOD 9

Table 3.1: A cyclic roster for a roster group with 12 crew members Week Mon Tue Wed Thu Fri Sat Sun 1 DO DO DO ED ED ED ED 2 ED DO ED ED ED DO DO 3 LD LD LD DO DO ED ED 4 DO LD LD LD LD DO DO 5 LD DO LD LD LD DO DO 6 ED ED DO DO DO LD LD 7 LD LD LD LD LD DO DO 8 DO ED ED ED ED ED ED 9 DO LD LD LD DO DO DO 10 ED ED ED DO DO LD LD 11 LD LD LD LD LD DO DO 12 LD DO DO DO LD LD LD

• Similar duties are preferred to be spread over the weeks of the roster. A lot of variety in the work with respect to trajectories, rolling stock types, etc. is preferred.

The final rosters can differ from the original rosters due to illness, vacation or adjustments by Daily plan section. The final rosters for a single week have to be ready on the last Thursday before this week starts. A cyclic roster for a roster group is constructed manually. The legality of a roster can be checked with the help of the software Dysis. Hartog et al. [4] have developed a method to construct a cyclic roster. The cyclic roster is constructed such that as many preferences as possible are satisfied. The software using this method is only used to roster the conductors of Utrecht.

3.2 Analysis of the current roster method

The rostering process is split into two steps. This simplifies the process but has a major influence on the final rosters. For a cyclic roster it is required that the crew members are clustered roster groups. A crew member of a certain roster group executes only the duties assigned to his/her roster group. The exclusion of the other duties causes a loss in flexibility. A cyclic roster reflects fairness in the following sense: If there is a particular desired or undesired duty, all crew members will get their turn to execute this duty. However, the drawback of the cyclic roster is the fact personal preferences of the crew members cannot be taken into account. The cyclic roster is used by all crew members in a roster group and is therefore not a personal roster. When a crew member wants to have a day-off then he/she needs to swap a duty with another crew member. 10 CHAPTER 3. PROBLEM DEFINITION

Crew members who have the same preferences are grouped in the same roster groups. By assigning duties they prefer most, e.g. late duties, still many preferences can be fulfilled, with regard to working hours.

3.3 Personal rosters

A personal roster for each crew member of a roster group could be created, instead of one cyclic roster for all crew members of a roster group. These rosters could be created such that as many preferences as possible are satisfied. For instance, preferences on working hours, which cannot be satisfied in the current roster process. In the remaining of this thesis, we refer to preferences on working hours and days-off when we use the word preferences. As a result, roster groups would not be required anymore. The duties of other roster groups which are excluded in the current roster process would be available now. Due to this increase in flexibility more preferences could be satisfied. The personal rosters do not reflect fairness like a cyclic roster does. Therefore it is important to monitor if the popular and unpopular work are distributed fairly over the crew members.

3.4 Objectives of the research

There are a number of software companies who are specialized in creating crew rostering software. With the help of this software, personal rosters can be created. NS is interested in implementing such a system and wants to study personalized rostering applied at NS. The objective of this research is formulated as:

Create a method to construct personalized rosters by taking into ac- count the preferences on working hours and test this method on real life instances of NS to gain insight in the applicability and complexity of personalized crew rostering at NS.

An important aspect of the applicability is the effectiveness of personalized rostering, i.e. the percentage of preferences that can be fulfilled. This percentage depends on the number and specifications of the preferences. An important question is how many and how specific the preferences of the crew members should be in order to fulfil a large percentage of them. Chapter 4

Review on literature of crew rostering

Crew rostering problems are very complex problems. A crew members roster has to specify each day which duty has to be executed. Since the number of duties each day is very large, the number of possible roster for all the crew members is enormous. However, each roster has to satisfy quite an extensive set of rules and constraints. Therefore it is quite hard to find legal and complete rosters for all the crew members. This chapter gives an overview of literature on crew rostering. The ap- proaches to create an individual roster for each crew member can roughly be divided into two groups. These two groups are described in Section 4.1. Two articles about rostering air crew members will be discussed in Section 4.2. The articles both report on a personalized rostering based approach to roster air crew members.

4.1 Two approaches

Kohl et al. [5] give an overview of the literature on crew rostering, describe the complexity of it and give an example of a commercial crew rostering system. The system has been successfully taken into production at eight airlines in Europe and North America and two railway companies in Europe. The largest problems that have been solved with the help of this system contained 1600 crew members and 5000 duties. Problems of this size can be solved usually in less than 10 hours. However the problem size itself is not the only factor influencing solution times. The complexity of the rules and objectives tends to be of greater importance. Two approaches can roughly be distinguished according to Kohl et al. when personal rosters are created. The first approach creates anonymous rosters (so- called ”bid lines”). These rosters are then assigned to individuals based on bids for these anonymous rosters. This approach is called the bid lines approach. The second approach is called personalized rostering. This approach con- structs individual rosters for each crew member. These rosters are constructed by considering the individual preferences. The preferences can be awarded on a fair share basis. An alternative is to award them according to seniority.

11 12 CHAPTER 4. REVIEW ON LITERATURE OF CREW ROSTERING

The bid lines approach has the advantage that a crew member exactly knows what he/she will get if the bid is granted. However, the rostering becomes more complex when bid lines cannot be assigned to crew members completely and hence some duties are not covered. The roster process then needs to execute a few more phases in order to create complete and legal rosters for every crew member. Bids can be satisfied in order of decreasing order of seniority in the crew rank. If however all crew members are equal in corporate hierarchy then the assignment of bid lines can be a problem. The personalized rostering approach offers the possibility to optimizing the allocation of preferences while ensuring the construction of complete and legal rosters.

4.2 Personalized rostering

Information is available about the preferences on working hours of individual crew members. So a personalized rostering algorithm can be tested. Also drivers are equal in corporate hierarchy. Therefore the bid lines approach seems less suitable for NS. Gamache et al. [3] describes a solution method based on a column generation algorithm. For every crew member a number of rosters are created. The problem of selecting one roster for every crew member by covering as many duties as possible is formulated as a generalized set partitioning problem. After a first solution is achieved (feasible or not) new rosters are created by solving a shortest path problem. These rosters are added to the linear relaxation of set partitioning problem, which is then solved again. The algorithm is tested by constructing rosters for departments of Air France. The objective is to maximize the total duration of duties to be covered by the regular crew members. The duties that cannot be covered are assigned to sup- plementary crew members. Monthly rosters have to be created for groups of crew members. The number of crew members in these groups differ from 50 to 300 people. The number of duties that have to be executed during a month varies over the groups but is relatively small compared to rail crew rostering as explained in Section 3.1. The heuristic turns out to be very effective. The effectiveness is due to a few characteristics of this problem. First, duties have to be assigned to more people. This reduces the risk of taking a bad decision. Second, each crew member can be assigned almost any duty, so the risk of obtaining an infeasible solution is not significant. Third, the objective is to cover as many duties as possible. Uncovered duties are allowed. These uncovered duties allow for additional flexibility. Day et al. [2] describe an algorithm to construct rosters that was imple- mented at Air New Zealand in 1993. This algorithm has been successful in allocating domestic flights along air crew members. The length of the domestic flights are quite similar to duties of NS. Eighty crew members and around 600 duties must be scheduled over a roster period of 14 days. In order to reduce the combinatorial complexity of allocation of duties, the problem is separated into two distinct sub problems. The first problems concerns the allocation of 5 days-off over the roster period of 14 days, by meeting as many preferences as possible. Such a roster is called a days-off 4.2. PERSONALIZED ROSTERING 13 roster. The days-off allocation solution approach involves complete enumera- tion of all possible days-off allocations for each crew member over the roster period. Days-off rosters are then selected by solving a set partitioning problem. Next, the duties have to be allocated to each crew member, given the days-off allocation. The duties are first assigned to a smaller sub period of 5 days. Next the duties are assigned to the following sub period, till a roster is created for a complete roster period. After the creation of complete rosters, rescheduling is done to improve the solution. The approach works well because the majority of duties have a length of one day, thus the day-off assignment does not cost much in terms of flexibility in the duty assignment. 14 CHAPTER 4. REVIEW ON LITERATURE OF CREW ROSTERING Chapter 5

A method to construct rosters for NS

Crew rostering is the assignment of duties to crew members. This problem can be formulated as an assignment model with additional restrictions. However it is expected from previous research on rostering at NS by Hartog et al. [4] that the assignment model cannot be solved in a reasonable amount of time. This Chapter describes a method to construct rosters. The rostering problem is split into two phases to reduce the combinatorial size of the problem. These phases are described in Section 5.1. This split is rather similar to the split that is described by Hartog et al. [4]. Section 5.2 explains in detail the solution approaches in the two phases.

5.1 Two phases

In the first phase, for each driver a pattern roster is created. A pattern roster indicates what type of duty needs to be executed on a certain day. There are five duty types distinguished: An early duty (ED), a late duty (LD), a night duty (ND), a reserve day (RES) and a day-off (DO). The definitions of each duty type can be found in the appendix. Although a reserve day and a day off are in fact not duties, they are considered as duty types. In the second phase, the duties are assigned to the crew members. The type of the duty that is assigned has to correspond to the type of duty of the pattern roster for a certain day and crew member. The objective is to construct complete and legal rosters, by considering the preferences of the crew members. Days-off are assigned to crew members in the first phase. If a day-off is requested, then this request can be satisfied only in the first phase. However, if a crew member wants to start/end working before/after a certain point of time, then there is not always certainty if this request is satisfied. For example, if a crew member wants to start working after 3.00 PM, then this request can only be satisfied with certainty when a night duty or a day-off is assigned. A roster with an early duty rostered on this day will never start before 3.00 PM regardless of the actual early duty that is assigned. There is no certainty that the request is satisfied when a late duty is assigned. This depends on the actual duty that is assigned in the second phase.

15 16 CHAPTER 5. A METHOD TO CONSTRUCT ROSTERS FOR NS

Although rostering in two phases reduces the complexity, there is a drawback to it. The duty type assignment cost much in terms of flexibility in the duty assignment. Therefore, it is possible that the optimal or even good rosters are excluded because of the assignment of the duty types. More importantly, this loss in flexibility might exclude all legal rosters for any crew member. Therefore, additional restrictions should be taken into account in the first phase such that there is a large probability to construct legal rosters out of pattern rosters in the second phase.

5.2 Solution approach

In the first phase, pattern rosters are constructed for every crew member. The solution approach to this construction involves complete enumeration of all pos- sible legal pattern rosters for each crew member over the roster period. The problem of selecting rosters is formulated as a generalized set partitioning prob- lem with additional constraints. Consider the set of duty types that need to be executed each day. Each roster is a subset of this set. The selected rosters together need to partition the set of duty types. Furthermore, the additional constraints guarantee that for every crew member one roster is selected. The objective function of the set partitioning problem is to minimize the cost as a function of the selected rosters. The number of possible rosters per crew member grows exponentially with the length of the roster period. However the number of legal rosters per crew member depends on the rules of the CAO and ATW. If the set of legal rosters for a crew member becomes too large, then complete enumeration becomes unfeasible. Additional conditions to the pattern rosters and/or a heuristic might be required then to construct a pattern roster. Hartog et al. [4] have developed a method to construct cyclic rosters for NS. The rosters are constructed in two phases as well. In the first phase, a cyclic pattern roster is constructed, similar to the pattern rosters in this thesis. The problem of constructing one cyclic pattern roster for k members in a roster group is formulated as an assignment problem with additional constraints. It is more or less similar to creating k rosters of one week (for every crew mem- ber one roster of one week). The results of the method of Hartog et al. [4] were pretty poor when k was larger than 20. Recall that in the first phase of our method all legal rosters are enumerated and the problem of selecting the rosters is formulated as a generalized set partitioning problem. Instead of this approach, the problem could be formulated as an assignment problem with ad- ditional constraints as well. However, the assignment problem for k individual rosters for N weeks has at least N times more decision variables and constraints than the assignment problem of one cyclic pattern roster for k crew members. Considering the number of crew members and the length of a reasonable roster period it can be concluded that the problem of finding pattern rosters, formu- lated as an assignment problem with additional constraints cannot be solved in a reasonable amount of time. In the second phase, the duties are assigned to the crew members. The problem is formulated as an assignment problem with additional constraints. The constraints guarantee that all the duties are assigned and the constructed rosters are legal. Again, the duties are assigned by considering the preferences. Chapter 6

First phase

In the first phase we select for each crew member a pattern roster. The approach consists of enumerating all legal pattern rosters. For each crew member, one roster is selected, by considering the preferences of the crew members. The problem of selecting the best rosters, such that all duty types are assigned, is formulated as a set partitioning problem. In the remaining of this section, a roster refers to a personal pattern roster. Section 6.1 describes the enumeration process and the conditions, with regard to legality, that need to be checked. The generalized set partitioning model is explained in detail in Section 6.2. We conclude this Chapter with a section on a possibility to reduce the combinatorial size of the problem.

6.1 Enumeration process

In this section the enumeration process of the legal rosters is described. Some notation is introduced first:

• P is the set of crew members. p∗ = |P | is the number of crew members for which rosters are created.

• T is the set of days in the roster period.

• ED, LD, ND, RES and DO are duty types, that can be assigned each day. Although a reserve day and a day-off are not duties, they are considered as duty types. An ordering of the duty types is required

– d1 = ED (early duty)

– d2 = LD (late duty)

– d3 = ND (night duty)

– d4 = RES (reserve day)

– d5 = DO (day off)

DT = {d1, d2, d3, d4, d5} is the set of duty types.

• Rp is the set of legal rosters for crew member p, with p ∈ P .

17 18 CHAPTER 6. FIRST PHASE

6.1.1 Enumeration process

For a crew member p, a set of legal rosters Rp is created. The enumeration process of the legal rosters can be represented by a search tree. The search tree is shown in Figure 6.1. S is a starting node. The other nodes represents a roster constructed so far. Any type of duty can be rostered after another duty type. Therefore there are five arcs out of any node in the search tree. The order in which types of duties and days-off are rostered is similar to the depth-first strategy in the search tree.

S

t =1 d1 d2 d3 d4 d5

t =2 d1 d2 d3 d4 d5 d1 d2 d3 d4 d5 d1 d2 d3 d4 d5 d1 d2 d3 d4 d5 d1 d2 d3 d4 d5

Figure 6.1: A part of the search tree. Only the starting node and the nodes corresponding to rosters for day 1 and day 2 are shown.

Every day a duty type is rostered. Next, the roster constructed so far is checked on legality. Consider for example the following roster:

. . . −→ d5 −→ d2 −→ d2

If the roster is legal, then duty type d1 is rostered on the next day, e.g.

. . . −→ d5 −→ d2 −→ d2 −→ d1

If the roster is not legal, then the duty type is removed and the next duty type is rostered ( i.e. all the remaining rosters in the search tree will be skipped), e.g.

. . . −→ d5 −→ d2 −→ d3

If a roster for crew member p is legal after a duty type is rostered on the last day of the roster period, then the roster is added to the set Rp. The duty type of the last day is removed and the next duty type is assigned on the last day, similar to the situation when a roster is not legal. The enumeration process stops when the last possible roster is checked on legality. Note that the enumeration process is set up, such that not all rosters need to be checked on legality, i.e. 6.1. ENUMERATION PROCESS 19 all the remaining rosters in the search tree will be skipped as soon as a pattern roster is not legal. The number of possible rosters grows exponentially with the length of the roster period. The number of legal rosters depends on the rules of the CAO and ATW.

6.1.2 Legality conditions After a duty type is rostered, the roster needs to be checked on legality. A few of the rules of the CAO and ATW can be tested directly on the pattern rosters. These are listed below: 1. Every week a crew member has the right of two days-off. Only one of these days-off has to be rostered in that week. The other can be rostered in the preceding or next week. 2. Of every two consecutive weeks, only one of these weeks can contain 6 duties. 3. A roster contains at most 25 night duties per 13 weeks. 4. A serie of consecutive night duties has a maximum length of 5 duties. 5. After a serie of consecutive night duties, 2 days-off should be rostered. A serie of consecutive night duties has a minimum length of 3 duties. The other rules of the ATW and CAO can be checked only in the second phase, since the specifics of the duties are required to test these rules. How- ever, allowing all combinations of duty types might lead to an infeasible legal assignment of the duties in the second phase. Therefore, certain combinations of duty types are excluded to increase the probability of a legal assignment of the duties in the second phase. After excluding these combinations, the rules still need to be checked in the second phase. The conditions with regard to these combinations are described below.

Condition 6, based on Rule 3 of the ATW Due to this rule a minimum rest time between two duties is required. It is excluded to roster an early duty after a night duty and guaranteeing a rest of at least 14 hours. Furthermore, the combination of a late duty followed by an early duty or the combination of a night duty followed by a late duty is excluded to increase the probability of a legal final roster.

Condition 7, based on Rule 4 of the CAO A day-off, rostered after a duty has a minimum length of 30 hours and a day off rostered after another day-off has a minimum length of 24 hours. A minimum rest time is required between the end of a duty preceding a serie of days-off, and the beginning of a duty, following after the same serie of days-off. To increase the probability of a legal assignment of the duties in the second phase, we exclude a serie of adjacent days-off, preceded by a night duty and followed by an early duty. A serie of days-off, in this context, has a minimum length of one day off and a maximum length of four days-off. 20 CHAPTER 6. FIRST PHASE

Condition 9, based on Rule 4 of the ATW

Rule 4 of the ATW states that on every period of 7 adjacent days a rest period of 36 hours should be rostered, or in every period of 9 adjacent days a rest period of 60 hours should be rostered. When on a period of 7 adjacent days no rest period of 36 hours is rostered, then it is required that directly before and after these 7 days a rest period of 60 hours is rostered. To increase the probability of satisfying Rule 4 of the ATW in the second phase, extra conditions are included with regard to combination of duty types. However, in contrary to the previous conditions, these conditions require that certain combinations of duty types exist in a roster, instead of excluding them. These required combinations of consecutive duty types are called patterns. A pattern ps = [ED, LD] exists if a late duty is assigned the day after an early duty is assigned. The set of all patterns is called PS. Consider the following sets of patterns: R36G = {[ED, DO, 6= ED], [LD, DO, 6= ED/LD], [ND, DO, 6= ED/LD/ND], [DO/RES, DO]} is a set of patterns that guarantee a rest period of 36 hours, regardless of the assigned duties in the second phase. R60G = {[ED, DO, DO, 6= ED], [LD, DO, DO, 6= ED/LD], [ND, DO, DO, 6= ED/LD/ND], [DO/RES, DO, DO]} is a set of patterns that guarantee a rest period of 60 hours, regardless of the assigned duties in the second phase. Furthermore, the set of patterns R36D is introduced. R36D = {[ED, DO, ED], [LD, DO, LD], [ND, DO, ND]}. This set contains patterns that do not yet guar- antee a period off work of 36 hours. This depends on the assigned duties in the second phase. However, there is a large probability that it can be transformed into a rest period. Analogous to R36D, the set R60D = { [ED, DO, DO, ED], [LD, DO, DO, LD], [ND, DO, DO, ND]} contains patterns that could result in a rest of 60 hours, depending on the assigned duties in the second phase. It is defined that a pattern ps exists on day t if it starts on day t − 1. This definition is made for notational convenience, since day t corresponds with the first day-off. A pattern that exists on day t thus has a its rest on day t. A condition to increase the probability of a legal final roster, with regard to rule 4 of the ATW, can be introduced now. On every 7 adjacent days, a pattern of the set R36G and/or R36D should exist. If not, then two days before this period and one day after this period a pattern of the set R60G and/or R60D must exist.

Condition 10, based on Rule 5 of the CAO

Similar to the rule above, patterns with regard to red weekend are required to satisfy Rule 5 of the CAO. A red weekend is a rest period of 60 hours. Further- more, a red weekend should also start before Friday 12.00 PM and end after Monday 4.00 AM. The set RWG = {[ED, DO, DO, 6= ED], [DO/RES, DO, DO]} consists of patterns that construct a red weekend is one of these patterns exists on a Saturday. Furthermore, the set RWD is introduced. RWD = {[LD, DO, DO, 6= ED], [ED, DO, DO, ED]} is a set of patterns, that do not yet guarantee a red weekend if the pattern exists on a Saturday. This depends on the assigned duties in the second phase. A condition to increase the probability of a legal final roster, with regard to Rule 5 of the CAO, can be introduced now. 6.2. SELECTING THE ROSTERS 21

On every 3 adjacent weeks, at least one pattern of RWG and/or RWD should exist on a Saturday.

Condition 11, based on Rule 2 of the ATW Each crew members roster should have a rest period of at least 48 hours after a serie of consecutive night duties. According to Condition 5 it is required to assign two days-off after a serie of adjacent night duties. However, there are combinations of late and night duties that are not series of night duties by definition. This depends on the end of the late duties, and therefore can only be checked in the second phase. R48 is a set of patterns that could construct a serie of ATW night duties. R48 = {[LD, LD, LD], [LD, LD, ND], [LD, ND, ND]}. It is required that each pattern is either continued or discontinued and followed by (a) day(s)-off. Note that Condition 6 excludes assigning an early duty after one of the patterns. A condition to increase the probability of a legal final roster, with regard to Rule 2 of the ATW, can be introduced now. It is excluded to assign a reserve day after a pattern of the set R48.

6.2 Selecting the rosters

Recall from the previous Chapter that the problem of selecting for each crew member a roster will be formulated as a set partitioning problem. It is required that some notation is introduced first. The cost function is described in more detail in a different subsection.

6.2.1 The set partitioning problem Some extra notation needs to be introduced.

• Np = |Rp| is the number of rosters created for crew member p, with p ∈ P .

• rp,i ∈ Rp is a roster with number i for crew member p, with p ∈ P and i ∈{1,...,Np}.

• cp,i is the cost associated with roster rp,i. The cost of a roster is explained in more detail in Subsection 6.2.2.

It is possible that a roster rp,i ∈ Rp and a roster rp0,j ∈ Rp0 , have the same type of duty assigned every single day. However, they are corresponding to different crew members, can have different cost and are therefore genuinely different.

• For p ∈ P,i ∈{1,...,Np},t ∈ T and d ∈ DT ,

1 if roster r has a duty of type d on day t, ad,t = p,i p,i  0 otherwise.

• bd,t is the number of duties of type d that have to be executed on day t, with t ∈ T and d ∈ DT \ d5 (a day-off does not need to be assigned). 22 CHAPTER 6. FIRST PHASE

• M = p∈P Np. X is the M-dimensional vector of decision variables. Xp,i is an elementP of X, with p ∈ P and i ∈{1,...,Np} and defined as:

1 if roster rp,i is selected Xp,i =  0 otherwise.

• f(X) are the costs as a function of the selected rosters.

The problem of selecting the optimal rosters, such that every day all duty types are assigned can then be formulated as a generalized set partitioning problem.

Minimize f(X) (6.1)

Np

Such that Xp,i =1 ∀p ∈ P, (6.2) Xi=1

Np d,t d,t ap,i · Xp,i = b ∀t ∈ T, ∀d ∈ DT \ d5, (6.3) pX∈P Xi=1

Xp,i ∈{0, 1} ∀p ∈ P and ∀i ∈{1,...,Np}. (6.4)

Constraints (6.2) guarantee that for every crew member one roster is selected. Constraints (6.3) ensure that every day each duty type is covered a certain number of times. Constraints (6.4) specify the range of the decision variables.

6.2.2 The cost function A roster for crew member p specifies each day, which duty type has to be executed. If a duty type excludes the fulfilling of a preference then a penalty is given. The cost of a roster is equal to the sum of all the penalties. The objective function aims at minimizing a function of the cost of the selected rosters. Two objective functions are introduced below.

The first objective function

Np

Minimize Xp,i · cp,i (6.5) pX∈P Xi=1

This objective function aims at minimizing the sum of the cost of the selected rosters.

The second objective function

Np

Minimize max Xp,i · cp,i (6.6) p∈P Xi=1 6.3. REDUCING THE COMBINATORIAL SIZE OF THE PROBLEM 23

Table 6.1: Example. Cost1 Cost2 Cost3 Obj. (6.5) Obj. (6.6) Set 1 2 4 6 12 6 Set 2 1 1 9 11 9 Set 3 5 5 5 15 5

This objective function aims at minimizing the maximum of the cost of the selected rosters. It is not a linear function, but can be transformed into one ∗ by including p extra constraints and an extra decision variable, z ∈ R+. It is required for each p ∈ P :

Np

z ≥ Xp,i · cp,i (6.7) Xi=1 If these constraints are included in the model, then objective function (6.6) is equivalent to:

Minimize z (6.8)

Consider Table 6.1. Three sets of rosters are created for 3 crew members. The second, third and fourth column correspond to the cost of the rosters for crew member 1,2 and 3. The fifth column shows the value of objective function (6.5), while the sixth column shows the value of objective function (6.6). Roster set 2 is qualified as the best roster set by objective function (6.5). Note that roster 3 in set 2 has rather high costs. The other two sets spread the unfulfilled preferences better over the crew members. Objective function (6.6) qualifies roster set 3 as the best roster set. The unfulfilled preferences are spread better over the crew members for roster set 3. However, roster set 3 has the most unfulfilled preferences. So, objective function (6.5) focuses only on overall satis- faction and not on individual satisfaction. Objective function (6.6) focuses only on the individual satisfaction and not on overall satisfaction.

6.3 Reducing the combinatorial size of the prob- lem

As can be seen from Section 6.1 the set of rosters increases exponentially if the roster period increases. It is expected that the number of legal roster will increase exponentially as well. In order to reduce the combinatorial size of the problem, rosters are created for small roster periods with a length of t days (t < |T |). These rosters are called sub-rosters. The solution method to the sub-rostering problem is equal to the solution method to the rostering problem; complete enumeration of all legal sub-rosters and the selection of the sub-rosters by solving a generalized set partitioning problem. Complete rosters are constructed by linking all the sub-rosters. This is explained in more detail below: A legal sub-roster is constructed for each crew member for the shorter roster period of t days. An attempt is then made to find all legal sub-rosters for the 24 CHAPTER 6. FIRST PHASE next t days. A sub-roster should not only be legal but also constructed such that it can be linked to the previous constructed sub-rosters, i.e. the complete roster should be legal. It might occur that no legal sub-roster can be constructed such that it can be linked to the previous constructed sub-rosters. Day et al. [2] describe an approach to continue the roster process if this problem arises. The approach concerns “unconfirming” the last day of the previous sub- roster period. Next, all sub-rosters of t days starting on that last day are enumerated. This process is called “stepping back” by Day et al. The stepping back approach is intended to reduce infeasibility by removing duties that may be restricting feasible continuation into the next sub-roster period. Instead of “stepping back” when the problem arises, the problem can be anticipated by “confirming” only t days of a feasible sub-roster (t < t). This would guarantee t − t days of feasible continuation into the next sub-roster period. b b The average amountb of work of each roster should be approximately equal to the number of contract hours. This requirement encompass the whole roster period. Therefore, it cannot be tested on the sub-rosters. However, we can include a condition that restricts the number of days-off. The number of assigned days-off should be every day between a certain range. This range depends on the number of contract hours and vacation days. Chapter 7

Second phase

In the second phase, the actual duties are assigned to the pattern rosters. The problem of creating legal rosters by considering the preferences is formulated as an assignment model with additional restrictions. The assignment model is a MIP problem that consists of 3 basic components: decision variables, constraints and the objective function. These components are explained in detail in Sections 7.2 - 7.4, respectively. We start this chapter by introducing some notation.

7.1 Notation

Some notation has been introduced in Chapter 6. In this chapter we use the sets DT, P , T , PS as well. Recall that DT is the set of duty types, P the set of crew members, T the set of roster days and PS the set of patterns. Two binary parameters, v and w are introduced. • For p ∈ P,t ∈ T and dt ∈ DT , 1 if crew member p has to execute a duty of type dt on day t vdt = p,t  0 otherwise.

• For p ∈ P,t ∈ T and ps ∈ PS, 1 if pattern ps exists on day t in the roster for crew member p wps = p,t  0 otherwise.

Note that the binary parameters v and w are set after the first phase. Some new notation with regard to duties is introduced as well. • D is the set of all duties that need to be assigned. Each duty has some characteristics. We define for each d ∈ D: – a(d) is the length of the work on an A-train of duty d in minutes. – b(d) is the length of the work on a B-train of duty d in minutes. – begin(d) is the point of time in minutes at which duty d starts. – end(d) is the point of time in minutes at which duty d ends. If a duty ends or starts after 12.00 PM then 24 · 60 minutes are added to this point in time.

25 26 CHAPTER 7. SECOND PHASE

– day(d) ∈ T is the day that duty d needs to be executed. – length(d) is the length of duty d in minutes. With the exception of amplitude duties, the length of a duty is equal to the end of the duty minus the start of the duty. – wt(d) is the work-time of duty d in minutes. – number(d) is the number of duty d. The number of a duty specifies the content of a duty and can be found in the appendix. – type(d) ∈ DT is the duty type of duty d.

• T1 ⊂ T is the set of Mondays in the roster period T .

• T6 ⊂ T is the set of Saturdays in the roster period T .

7.2 Decision variables

The first set we define is FP. The set FP (feasible pairs) is a set of pairs of duties and crew members. A pair (d, p) is an element of FP if duty d can be assigned to crew member p, i.e. if the type of duty d corresponds to the pattern roster for crew member p on day(d). This set is defined as

type(d) FP = {(d, p): d ∈ D, p ∈ P, vp,day(d) =1} (7.1)

The set of decision variables can be defined now. We include in our model:

Xd,p ∈{0, 1}, ∀ (d, p) ∈ FP (7.2)

where Xd,p = 1 if duty d is assigned to crew member p, and 0 otherwise. Furthermore, we use two types of decision variables Yp,t and Zp,t, which are necessary for certain constraints. They will be introduced in Section 7.3.2.

7.3 Constraints

The set of constraints can be split into four categories: assignment constraints, constraints due to the CAO and ATW, constraints with regard to the “overtime” distribution and constraints with regard to the “Sweet and Sour” distribution. Each of the following four subsections correspond to a category.

7.3.1 Assignment constraints To each day t ∈ T corresponds a set of duties that needs to be executed that day ({d ∈ D : day(d) = t}). Each duty of this set needs to be assigned to one crew member. This is expressed by requiring for each t ∈ T and for each d ∈ D, with day(d)= t:

Xd,p =1 (7.3) (d,pX)∈FP

To each day t ∈ T corresponds a set of crew members, who have to execute these duties that day, i.e. who do not have a reserve day or day off assigned 7.3. CONSTRAINTS 27

RES DO ({p ∈ P : vp,t + vp,t =0}). Each crew member of this set needs to be assigned one duty. This is expressed by requiring for each t ∈ T and for each p ∈ P , with RES DO vp,t + vp,t = 0:

Xd,p =1 (7.4) (d,pX)∈FP: day(d)=t

7.3.2 Constraints due to the CAO and ATW A number of rules are already guaranteed by the pattern rosters. Some rules were taken partially into account by excluding or requiring certain combinations of duty types in the first phase. The other rules need to be checked completely in the second phase by including constraints in the assignment model. Important to notice is that the ATW and CAO have a different definition of a night duty. According to the ATW, a night duty ends after 0.00 AM or begins before 6.00 AM. A night duty is defined as a duty that ends after 2.00 AM or starts before 4.00 AM, according to the CAO.

Constraints based on Rule 6 of the CAO There is maximum of 12 duties per year (365 days), with a length longer than 9 hours (540 minutes) or shorter than 5 hours (300 minutes). This is expressed by requiring for each p ∈ P :

365 Xd,p + Xd0,p ≤ 12 (7.5) 0 Xt=1(d,pX)∈FP: (d ,pX)∈FP :  0 day(d)=t & day(d )=t & 0 Length(d)<300 Length(d )>540

Constraints based on Rule 7 of the CAO There is a maximum of one amplitude duty per week. Amplitude duties are duties with a number larger than or equal to 800. For a more detailed description of amplitude duties, we refer to the appendix. This rule is expressed by requiring for each t ∈ T1 and for each p ∈ P :

t+6 Xd,p ≤ 1 (7.6) Xn=t (d,pX)∈FP : day(d)=n & number(d)≥800

Constraints based on Rule 1 of the ATW A serie of consecutive night duties has a maximum length of 5 duties and a maximum length of 6 duties, if all these duties end before 2.00 AM. Condition 4 of the first phase excludes series of 6 or more adjacent night duties. A series of 7 or more adjacent late duties is not excluded in the first phase. If all duties of a serie of 7 late duties end after 12.00 PM, then Rule 1 of the ATW is violated. S7L (Series of 7 late duties) is a set of pairs of crew members and days. A pair 28 CHAPTER 7. SECOND PHASE

(p,t) is an element of S7L if crew member p has to execute 7 consecutive late duties starting on day t. S7L is defined as

t+6 LD S7L = {(p,t): p ∈ P, t ∈ T, vp,n =7} (7.7) Xn=t If a serie of 7 consecutive late duties exists, then at least one of these duties should end before or on 12.00 PM. It is required that for each (p,t) ∈ S7L:

t+6 Xd,p ≥ 1 (7.8) Xn=t (d,pX)∈FP: day(d)=n & end(d)≤24·60

Constraints based on Rule 5 of the ATW The actual working time of a duty needs to be defined. A duty longer than or equal to 5.5 hours has a lunch break of 30 minutes which is not part of the working time. For each d ∈ D, length(d) if length(d) < 330, wt(d)= (7.9)  length(d) − 30 if length(d) ≥ 330. A reserve day is 450 minutes of work. This is equal to the average length of a duty, 8 hours minus a break of 30 minutes. A day off is not considered as work.

The maximum working time per week is 45 hours. The duties should be assigned such that the working time of these duties together with the working time of the reserve days in one week is not more than 45 hours. This is expressed by requiring for each t ∈ T1 and for each p ∈ P :

t+6 wt(d) · Xd,p ≤ 45 · 60 − c (7.10) Xn=t (d,pX)∈FP: day(d)=n with c equal to the working time in minutes due to reserve days in that week, i.e. t+6 RES c = 450 · vp,n (7.11) Xn=t For a period of 13 consecutive weeks, the average working time per week is at most 40 hours. This is similar to requiring for every crew member not working more than 40 · 60 · 13 minutes over a period of 91 consecutive days (13 weeks), starting on a Monday. The duties need to be assigned such that the length of these duties together with the working time of the reserve days is less than 40 · 60 · 13 minutes. This is expressed by requiring for each t ∈ T1 and for each p ∈ P :

t+90 wt(d) · Xd,p ≤ 40 · 60 · 13 − c (7.12) Xn=t (d,pX)∈FP: day(d)=n 7.3. CONSTRAINTS 29 with c equal to the working time in minutes due to reserve days in a period of 13 weeks starting on day t, i.e.

t+90 RES c = 450 · vp,n (7.13) Xn=t

Constraints based on Rule 6 of the ATW This rule states that there is an upper limit on the number of ATW night duties, for every 28 consecutive days (4 weeks) and for every 91 consecutive days (13 weeks), both starting on a Monday. All the duties that end after 12.00 PM (24 · 60 in minutes) or start before 6.00 AM (6 · 60 in minutes) are ATW night duties. This rule is expressed by requiring for each p ∈ P and for each t ∈ T1:

t+27 Xd,p + Xd0,p ≤ 10 (7.14) 0 Xn=t (d,pX)∈FP: (d ,pX)∈FP :  0 day(d)=n & day(d )=t & 0 end(d)>24·60 begin(d )<6·60 and for each p ∈ P and for each t ∈ T1:

t+90 Xd,p + Xd0,p ≤ 32 (7.15) 0 Xn=t (d,pX)∈FP: (d ,pX)∈FP :  0 day(d)=n & day(d )=t & 0 end(d)>24·60 begin(d )<6·60

In the first phase, a number of combinations of duty types were excluded or required (patterns) to increase the probability of a feasible legal assignment of the duties. Therefore the following four constraints do not need to be checked every day for every crew member. With the help of a few sets, the number of constraints can be reduced.

Constraints based on Rule 3 of the ATW This rule states that the rest time between two duties is at least 12 hours if the first duty ends before 2.00 AM, otherwise it is 14 hours. Too little rest between two duties could originate if on two consecutive days the same duty type is rostered. Other combinations of duty types are excluded in the first phase by Condition 6, or guarantee enough rest regardless of the assigned duties. CED (two consecutive early duties), CLD (two consecutive late duties) and CND (two consecutive night duties) are three sets of pairs of crew members and days and are defined as:

t+1 ED CED = {(p,t): p ∈ P, t ∈ T, vp,n =2} (7.16) Xn=t

t+1 LD CLD = {(p,t): p ∈ P, t ∈ T, vp,n =2} (7.17) Xn=t 30 CHAPTER 7. SECOND PHASE

t+1 ND CND = {(p,t): p ∈ P, t ∈ T, vp,n =2} (7.18) Xn=t Consider the duties d and d0 that need to be executed by crew member p on day t respectively t + 1. The time in minutes between the end of duty d and the start of duty d0 is 24 · 60 + begin(d0) − end(d) minutes. The length of this period should be at least 12 hours if duty d ends before 2.00 AM (i.e. duty d is an early or late duty), and 14 hours otherwise (i.e. duty d is a night duty). A minimal rest of 12 hours between two early duties is expressed by requiring for each (p,t) ∈ CED:

0 end(d) · Xd,p − begin(d ) · Xd0,p ≤ (24 − 12) · 60 (7.19) 0 (d,pX)∈FP: (d ,pX)∈FP : 0 day(d)=t day(d )=t+1

A minimal rest of 12 hours between two late duties is expressed by requiring for each (p,t) ∈ CLD:

0 end(d) · Xd,p − begin(d ) · Xd0,p ≤ (24 − 12) · 60 (7.20) 0 (d,pX)∈FP: (d ,pX)∈FP : 0 day(d)=t day(d )=t+1

A minimal rest of 14 hours between two night duties is expressed by requiring for each (p,t) ∈ CND:

0 end(d) · Xd,p − begin(d ) · Xd0,p ≤ (24 − 14) · 60 (7.21) 0 (d,pX)∈FP: (d ,pX)∈FP : 0 day(d)=t day(d )=t+1

Constraints based on Rule 4 of the CAO There should be enough rest between the duties preceding and following a serie of days-off. In this context, a serie of days-off has a minimum length of one day-off and a maximum length of four days-off. Rm is a set of pairs of crew members and days. A pair (p,t) is an element of Rm if crew member p has m day(s) off, and duties could be assigned on day t and day t + m + 1, such that there is too little rest between the duties. Too little rest could originate if on day t a night duty is rostered and on day t + m + 1 a late duty, or on day t a late duty and on day t + m + 1 an early duty. Other combinations guarantee enough time between the duties or are excluded already in the first phase by Condition 7. Rm with m ∈{1, 2, 3, 4} is defined as:

Rm = {(p,t): p ∈ P, t ∈ T, t+m ND DO LD vp,t + vp,n + vp,t+m+1 = m +2 nX=t+1 (7.22) t+m LD DO ED ∨ vp,t + vp,n + vp,t+m+1 = m +2} nX=t+1 Consider duties d and d0 that need to be executed by crew member p on day t respectively t + m + 1. The time between the end of duty d and the begin of 7.3. CONSTRAINTS 31 duty d0 is 24 · 60 − end(d)+ m · 24 · 60 + begin(d0). It is required for each pair 0 (p,t) ∈ Rm that duty d on day t + m +1 starts (6+24 · m) · 60 minutes after the end of duty d on day t. This is expressed by requiring for each (p,t) ∈ Rm:

0 end(d) · Xd,p + begin(d ) · Xd0,p ≤ (24 − 6) · 60 (7.23) 0 (d,pX)∈FP (d ,pX)∈FP 0 day(d)=t day(d )=t+m+1

In order to increase the probability of satisfying Rule 4 of the ATW, Rule 5 of the CAO and Rule 2 of the ATW, sets of patterns were introduced. These sets are used in the second phase as well. For a detailed description of the pattern sets R36G, R36D, R60G, R60D, RWG, RWD and R48 we refer to Section 6.1. Recall the definition that a pattern exists on day t, if it starts on day t − 1.

Constraints based on Rule 4 of the ATW In order to find out if a rest period of 36 hours is constructed, a set D36 of pairs of duties and crew members is introduced. A pair (d, p) is an element of D36, if the assignment of duty d to crew member p could lead to a rest period of 36 hours. This is conditional to the existence of a pattern ps ∈ R36D on day(d)+1. Recall that R36D is a set of patterns that could result in a rest period of 36 ps hours, and wp,t is a parameter with regard to the existence of a pattern ps on day t in the pattern roster of crew member p. The set D36 is defined as:

ps D36 = {(d, p) ∈ FP: wp,day(d)+1 =1} (7.24) ps∈XR36D

36 We define the second type of decision variable, Yd,p for each (d, p) ∈ D36. 36 0 Yd,p = 1 if duty d is assigned to crew member p and a duty d is assigned on day t + 2, such that the time in minutes between the end of duty d and the start of duty d0 (begin(d0)+48 · 60 − end(d)) is longer than or equal to 36 hours. Since a day-off is rostered on day t + 1, a rest period of 36 hours is originated. For each (d, p) ∈ D36, we include in our model:

36 Yd,p ≥ Xd,p + Xd0,p − 1 (7.25) 0 (d ,pX)∈FP: 0 day(d )=day(d)+2 & 0 end(d)−begin(d )≤(48−36)·60

36 Yd,p ≤ Xd,p (7.26)

36 Yd,p ≤ Xd0,p (7.27) 0 (d ,pX)∈FP : 0 day(d )=day(d)+2 & 0 end(d)−begin(d )≤(48−36)·60

36 Yd,p ∈ [0, 1] (7.28) 36 Constraints (7.26) and (7.27) guarantee that Yd,p is set to zero if no rest period of 36 hours exists. If a rest period of 36 hours exists then constraint 36 36 (7.25) guarantees that the value of Yd,p is set to one. Although Yd,p is not 32 CHAPTER 7. SECOND PHASE declared as a binary variable (Constraint (7.28)), the combination of constraints 36 (7.25)-(7.28) confirm Yd,p to either zero or one. 36 36 A third decision variable Zp,t is defined. Zp,t = 1 if crew member p has a rest period of 36 hours starting on day t − 1 and 0 otherwise. In other words, a rest pattern ps ∈ R36D that exists on day t has turned into a rest period of 36 36 hours, due to the assigned duties. For each p ∈ P and for each t ∈ T , Zp,t is defined as:

36 36 Zp,t = Yd,p (7.29) (d,p)X∈D36: day(d)=t−1

Analogous to a rest period of 36 hours, we define the set D60, and the 60 60 decision variables Yd,p and Zp,t for the rest periods of 60 hours. Rule 4 of the ATW requires on every period of 7 days a rest period of 36 hours. If not, then two days before this period and one day after this period a rest period of 60 hours should exists. This is expressed by requiring for each p ∈ P and for each t ∈ T : t+6 60 36 Zp,t−2 + Zp,n ≥ 1 − c (7.30) Xn=t with t+6 ps ps c = wp,t−2 + wp,n (7.31) ps∈XR60G Xn=t ps∈XR36G and by requiring for each p ∈ P and for each t ∈ T :

t+6 60 36 0 Zp,t+7 + Zp,n ≥ 1 − c (7.32) Xn=t with t+6 0 ps ps c = wp,t+7 + wp,n (7.33) ps∈XR60G Xn=t ps∈XR36G Note that c and c0 do not depend on the decision variables, but on the constructed patterns in the first phase. The value of c is greater than or equal to 1 if enough rest is guaranteed in the pattern roster. Provided that enough rest is guaranteed for a certain crew member p on a certain day t, constraint (7.30) is redundant.

Constraints based on Rule 5 of the CAO In order to find out if a red weekend is constructed, a set DR of pairs of duties and crew members is introduced. A pair (d, p) is an element of DR if the assignment of duty d to crew member p could results in a red weekend. This is conditional to the existence of a pattern ps ∈ RWD. Furthermore, duty d needs to end on or before 12.00 PM. The set DR is defined as: ps DR = {(d, p) ∈ FP: wp,day(d)+1 =1 ∧ end(d) ≤ 24 · 60} (7.34) ps∈XRWD 7.3. CONSTRAINTS 33

RW Similar to Rule 4 of the CAO, a decision variable, Yd,p is introduced for RW each (d, p) ∈ DR. Yd,p = 1 if duty d is assigned to crew member p and a duty d0 is assigned on day t + 3, such that the time in minutes between the end of duty d and the start of duty d0 (begin(d0)+48 · 60 − end(d)) is longer than or equal to 60 hours. Since duty d ends before Friday 12.00 PM and days-off are rostered on day t + 1 and day t + 2, a red weekend is originated. For each (d, p) ∈ DR, we include in our model:

RW Yd,p ≥ Xd,p + Xd0,p − 1 (7.35) 0 (d ,pX)∈FP: 0 day(d )=day(d)+3 & 0 end(d)−begin(d )≤(60−48)·60

RW Yd,p ≤ Xd,p (7.36)

RW Yd,p ≤ Xd0,p (7.37) 0 (d ,pX)∈FP: 0 day(d )=day(d)+3 & 0 end(d)−begin(d )≤(60−48)·60 and

RW Yd,p ∈ [0, 1] (7.38)

36 RW RW Similar to Zp,t, another decision variable Zp,t is introduced. Zp,t = 1 if crew member p has a rest period of 60 hours starting on day t − 1 before 12.00 PM and 0 otherwise. In other words, a rest pattern ps ∈ RWD that exists on day t has turned into a red weekend, due to the assigned duties. For each p ∈ P RW and for each t ∈ T , Zp,t is defined as:

RW RW Zp,t = Yd,p (7.39) (d,pX)∈DR: day(d)=t−1

Rule 5 of the CAO requires that at least one of every three weekends is a red weekend, i.e. a rest period of 60 hours, starting before Saturday 0.00 AM and ending after Monday 4.00 AM. This rule is expressed by requiring for every t ∈ T6 and for every p ∈ P :

2 RW Zp,t+7·n ≥ 1 − c (7.40) nX=0 with

2 ps c = wp,t+7·n (7.41) nX=0 ps∈XRWG

Note that c does not depend on the decision variables. c is greater than or equal to 1 if there exists a red weekend on a period of 3 weeks in the pattern roster, and 0 otherwise. If so, constraint (7.40) is satisfied, regardless of the assigned duties. 34 CHAPTER 7. SECOND PHASE

Constraints based on Rule 2 of the ATW After a serie of ATW night duties, there should be assigned two days off. In the first phase, the set R48 of patterns is introduced. Each pattern of this set is a possible night duty serie. If the duties are assigned, such that a night duty serie is originated and the pattern is followed by only one day-off, then too little rest is rostered, i.e. Rule 2 of the ATW is violated. The set SN (serie of ATW night duties) is defined as:

SN = {(p,t): p ∈ P, t ∈ T, 0 ps DO dt wp,t+1 + vp,t+3 + vp,t+4 =3} (7.42) 0 psX∈R48 dt X∈DT : 0 dt 6=DO

So (p,t) ∈ SN, if crew member p has to execute three late/night duties starting on day t followed by only one day off. It is not allowed that all the duties on day t,t + 1 and t + 2 assigned to crew member p end after 12.00 PM, since a serie of ATW night duties is constructed then. By definition, a night duty ends after 2.00 AM, so at least one of the late duties should end before or on 12.00 PM. This is expressed by requiring for each (p,t) ∈ SN:

t+2 Xd,p ≥ 1 (7.43) Xn=t (d,pX)∈FP: day(d)=n & end(d)≤24·60

Furthermore, an extra constraint needs to be included to guarantee a rest period of at least 48 hours after an ATW night duty serie. If the final duty of an ATW night duty serie ends after 2.00 AM (i.e. a night duty) and the serie is followed by two days-off and an early duty, then too little rest could originate. The set of patterns R48D is introduced. R48D = {[LD, LD, ND, DO, DO, ED], [LD, ND, ND, DO, DO, ED], [ND, ND, ND, DO, DO, ED]}. If all the late duties of these patterns end after 12.00 PM, then the duties could be assigned, such that too little rest originates. SNDE (serie of ATW night duties, days-off and an early duty) is a set of pairs of duties and crew members. It is defined as:

ps SNDE = {(d, p) ∈ FP: wp,day(d)−1} (7.44) ps∈XR48D So a pair (d, p) is an element of SNDE, if assigning duty d to crew member p could lead to too little rest between the end of the duty d on day day(d) and the beginning of a duty d0 on day day(d)+3. If duty d is assigned to crew member p, then either one of the duties on day day(d) − 2 or day(d) − 1 should end before 12.00 PM (i.e. no serie of night duties is originated) or a duty d0 on day day(d) + 3 should begin 48 hours after the end of duty d. This is expressed by requiring for each (d, p) ∈ SNDE:

day(d)−1

Xd00,p + Xd,p + Xd0,p ≤ 3 (7.45) 00 0 t=dayX(d)−2 (d ,pX)∈FP : (d ,pX)∈FP : 00 0 day(d )=t & day(d )=day(d)+3 & 00 0 end(d )>24·60 begin(d )≤end(d)−24·60 7.3. CONSTRAINTS 35

Recall from Section 3.2 that in the current roster process one cyclic roster is created for every roster group. An implication of a cyclic roster is that all crew members of the roster group execute the same duties but in a different week. With personalized rostering, for each crew member a different roster is created. Therefore, additional constraints need to be included to guarantee a reasonable distribution of the amount of work and a reasonable distribution of the “Sweet and Sour” among the crew members. These constraints are introduced in the Sections 7.3.3 and 7.3.4.

7.3.3 “Overtime” distribution On average over the roster period a crew members work per week should be approximately equal to his/her contract hours. On average over the roster period a crew member with a contract of 36 hours should not work more than 38 hours per week. A crew member with a contract of 32 hours should not work more than 34 hours on average per week over the roster period. The roster period has a length of |T |/7 weeks. This is expressed by requiring for each p ∈ P with a contract of 36 hours per week:

|T |

wt(d) · Xd,p ≤ (36 + 2) · 60 · (|T |/7) − c (7.46) Xt=1 (d,pX)∈FP: day(d)=t with c equal to the working time in minutes due to reserve days over the roster period, starting on day 1:

|T | RES c = 450 · vp,t (7.47) Xt=1

For each p ∈ P with a contract of 32 hours per week, it is required that:

|T |

wt(d) · Xd,p ≤ (32 + 2) · 60 · (|T |/7) − c (7.48) Xt=1 (d,pX)∈FP: day(d)=t with c equal to the working time in minutes due to reserve days over the roster period, starting on day 1:

|T | RES c = 450 · vp,t (7.49) Xt=1

7.3.4 “Sweet and Sour” distribution The popular and unpopular work should be divided fairly over the crew mem- bers. For simplicity we only measure the amount of work on A-trains (Intercities and semi-fast trains). Recall that a(b) and b(d) are the length in minutes of duty d on an A-train respectively a B-train. The percentage of work on A-trains for 36 CHAPTER 7. SECOND PHASE

driver p is Ap. It is defined as:

a(d) · Xd,p (d,pX)∈FP Ap = (7.50) 0 0 a(d )+ b(d ) · Xd0,p (d0,pX)∈FP  For simplicity we assume that all tasks for a driver concern driving, although in practice they do not. Examples are train shunting and dead heading. Hence, the working time of a duty consists only of driving tasks on an A-train or B-train, i.e. wt(d) = a(d) + b(d). Since duties with number 600 or higher (amplitude, shunting and reserve duties) do not contain work on an A-train, they are excluded. The average percentage of A-train work is A. Every roster must have a minimum percentage of work on an A-train. In order to include a constraint in our model guaranteeing enough work on an A-train, it is required that for- mula (7.50) is transformed such that a linear restriction can be constructed. The maximum percentage of A-train work less than the average for each crew member is c. This is expressed by requiring for every p ∈ P :

0 a(d) · Xd,p − (A − c) · wt(d ) · Xd0,p ≥ 0 (7.51) 0 (d,pX)∈FP: (d ,pX)∈FP: 0 number(d)<600 number(d )<600

7.4 The objective function

Rosters could be created by aiming on fulfilling as many preferences as possi- ble. This is similar to minimizing the number of unfulfilled preferences. It is expected that the latter formulation is a more efficient formulation of our aim. An alternative aim is to select only rosters with few unfulfilled preferences. Before we discuss the objective functions, the cost coefficients that corre- spond to the decision variables need to be defined. We introduce some notation: > • qp,t is a point of time in minutes on day t at which a crew member p prefers to start working after. If a crew member p does not prefer to start > working on day t after a certain point of time, than qp,t = 0. < • qp,t is a point of time in minutes on day t at which a crew member p prefers to be finished working before. If a crew member p does not prefer to be < finished working on day t before a certain point of time, than qp,t = 9999.

To each pair (d, p) ∈ FP corresponds a cost coefficient cd,p. If the assignment of duty d to crew member p does not result in an unfulfilled preference, then cd,p = 0. However, if a preference is unfulfilled due to this assignment, then a penalty Pi(d, p) is given. The penalties as a function of crew member p and duty d, are declared in Chapter 10. For each (d, p) ∈ FP the cost coefficient cd,p is defined as: > < P1(d, p) if begin(d) < qp,day(d) & end(d) ≤ qp,day(d) > <  P2(d, p) if begin(d) ≥ q & end(d) > q c = p,day(d) p,day(d) (7.52) d,p  begin > end <  P3(d, p) if (d) < qp,day(d) & (d) > qp,day(d) > < 0 if begin(d) ≥ qp,day(d) & end(d) ≤ qp,day(d)   7.4. THE OBJECTIVE FUNCTION 37

7.4.1 Objective functions The duties are assigned by taking into account the penalties that result from the assignment. It is our aim to minimize a function of the costs of the assigned duties.

First objective function The first objective function aims at minimizing the sum of the costs. The function is:

Minimize Xd,p · cd,p (7.53) pX∈P (d,pX)∈FP

Analogous to the discussion in Section 6.2.2, this objective function focuses on overall satisfaction and not on individual satisfaction.

Second objective function The second objective function aims at finding the set of rosters, of which the worst roster is as good 1 as possible. The function is:

Minimize max Xd,p · cd,p (7.54) p∈P (d,pX)∈FP

This is not a linear objective function. It can be transformed into one by including extra constraints. It is required for each p ∈ P :

z ≥ Xd,p · cd,p (7.55) (d,pX)∈FP

If these restrictions are included into the model, then the second objective func- tion is equivalent to:

Minimize z (7.56)

This objective function focuses on individual satisfaction, instead of overall satisfaction, analogous to the discussion in Section 6.2.2.

1worst and good is terms of the sum of costs 38 CHAPTER 7. SECOND PHASE Chapter 8

Implementation issues

The defined method for the enumeration of the pattern rosters, the selection of the pattern rosters and the model to assign the actual duties to these pattern rosters are implemented in OPL - studio 4.2; a model language for mathematical programming models. The OPL implementation is based on CPLEX, software for the solving of LP problems and MIP problems. The user of CPLEX has control over the algorithmic settings and parameters. The implementation issues for both phases are described in the following sections.

8.1 First phase

As expected, the number of legal roster and thus the size of the generalized set partitioning model increases exponentially if the length of the roster period increases. Since the memory of CPLEX is limited, the set partitioning problem cannot be solved for the complete roster period. In order to reduce the com- binatorial size of the rostering problem, sub-rosters are constructed and linked to complete rosters. Furthermore, additional constraints are included to ignore rosters that have a low probability of being selected. The problem that none of the constructed legal sub-rosters for the sub-roster period could be linked to the already selected constructed sub-rosters occurred frequently. To continue the roster process only a part of the sub-roster that is selected will be “confirmed”. Furthermore, the stepping back technique is used if no sub-roster can be found for any crew member. The first feasible solution that is found for the set partitioning problem is usually the optimal one. The MIP emphasis indicator of CPLEX is adjusted from balance optimality and feasibility to emphasize on integral feasibility over optimality in order to reduce the computation time of the set partitioning model. The computation time varies between a few seconds and a few minutes. Finally, it should be mentioned that OPL - studio 4.2 has some limitations with regard to declaring variables. Each roster is declared, such that for every day and for every duty type is specified if this duty type is assigned that day, or not. Instead of this declaration, the information for every day, which duty type is assigned, is sufficient to solve the set partitioning problem. The set partitioning problem could be formulated more efficient with regard to memory usage, by using the second declaration. Although other modelling languages

39 40 CHAPTER 8. IMPLEMENTATION ISSUES have more options for declaring variables, other modelling languages would still encounter the core of the problem: the exponential increase in the number of legal rosters if the roster length increases.

8.2 Second phase

The assignment model is implemented successfully. The initialization time to built up the model is relatively small and varies between one minute for the small roster groups to fifteen minutes for the largest roster group. For small problems CPLEX finds the optimal solution quick. For larger problems CPLEX has some difficulty with finding a feasible solution. Similar to the first phase, the first founded feasible solution is usually the optimal one. The MIP emphasis indicator of CPLEX is therefore also adjusted to emphasize on integral feasibility over optimality. Chapter 9

Data and cases

This chapter starts with a description of the data used as input for our method to roster crew members. This method is tested on drivers working at crew base Utrecht. The drivers, their preferences and the duties they need to execute is discussed in Section 9.2. In the next chapter the results of our method are presented.

9.1 Data

The input for our method is listed below:

• The crew members. The number of contract hours of each crew member is known. For simplicity the route knowledge of drivers is ignored.

• The preferences of each crew member. If a crew member has a preference on a certain day, then he/she either prefers to have the day-off or only a part of the day off. In the latter case, the preference is specified by a point of time.

• A set of duties that needs to be executed by the crew members. The duties are specified by a number, the day it needs to be executed, the starting time, ending time and the length of work on A-trains.

The information listed above is sufficient to create the (pattern) rosters. The pattern rosters created in the first phase are input for the second phase. Recall that the cost of a (pattern) roster is the sum of the penalties for the preferences that are not fulfilled. After setting these penalties the quality of all (pattern) rosters is determined and solutions of the models can be differentiated.

9.2 Cases

In dialogue with human resources of NS, we agreed to test our model by rostering drivers working at crew base Utrecht. The roster period is set to 13 weeks (91 days). Table 9.1 shows a number of roster groups of crew base Utrecht and their characteristics. The second column shows the number of drivers in a roster group. The number of duties that need to be executed each week by this roster

41 42 CHAPTER 9. DATA AND CASES

Table 9.1: Roster groups of drivers. The drivers are working at crew base Utrecht.

Group Size Duties Av. working hours Specifics A 12 53 36 hours per week no ATW night-duties B 20 83 36 hours per week no night duties D 20 82 36 hours per week all type of duties DO 10 37 32 hours per week only early duties DR 12 44 32 hours per week all type of duties L2 12 49 36 hours per week no early duties O2 10 41 36 hours per week only early duties group is in the third column. The average number of working hours of the crew members in this roster group is in the fourth column. Column five specifies the duties that are executed by this roster group. Our method is tested by creating rosters for these drivers. Note that the number of duties that needs to be executed by each roster group is relative small. In practice, the drivers of each roster group execute some extra duties which are not assigned during the creation of rosters. We will not go into this in detail, since it falls outside the scope of this thesis. As a consequence of relative few duties, the upper bound on the average number of working hours over a period of 13 weeks is rather high. We adjust constraints (7.46) and (7.48) such that each driver with a contract of 36 hours does not work more than 33.5 hours per week on average over the roster period. A driver with a contract of 32 hours does not work more than 30.5 hours per week on average over the roster period. Furthermore, constraint (7.5) is adjusted such that on a period of 13 weeks, every crew member has at most 3 duties, with a length shorter than 5 hours or length longer than 9 hours. Recall that roster groups are not necessary for personalized rostering. Fur- thermore, breaking up the roster groups increases the flexibility. Therefore, the roster groups are clustered into new groups, each labelled with a number. The number of the groups, the original roster groups that are part of it and the size are in Table 9.2. In the next subsection, the preferences that are used will be discussed in detail.

9.2.1 Preferences As part of a pilot a group of 50 drivers working at crew base were asked to indicate their preferences. For numerous reasons these preferences could not be used as input to test our method. However the sample showed some information, which enabled us to generate reasonable preferences. The following assumptions were made during the generation of the preferences.

1. A driver is classified as a driver with early preferences (with a probability of 18%), a driver with late preferences (20%) or a driver with general 9.2. CASES 43

Table 9.2: Roster groups of drivers, clustered in new groups 1 - 13 and their size.

Number Groups Size 1 A, B, D, DO, DR, L2 & O2 96 2 A, B, DO & O2 52 3 D, DR & L2 44 4 A, DO & O2 32 5 B & DR 32 6 D & L2 32 7 A 12 8 B 20 9 D 20 10 DO 10 11 DR 12 12 L2 12 13 O2 10

preferences (60%). A driver with early preferences never prefers a late duty and vice versa. No driver prefers a night duty or a reserve day.

2. A driver is classified as a driver with no vacation (55%), one week of vacation (30%), two weeks of vacation (10%) or three weeks of vacation (5%). The vacation can start on an arbitrary day of the roster period. If a driver has vacation, then a day-off has to be assigned.

3. A driver has a preference for a fixed day in the week with probability of 14%. There are 5 options for these repeating preferences, each with equal probability.

4. Every week, a driver prefers the weekend off with a probability of 24%.

5. Every single day, a driver prefers a day-off or a part of the day off, both with probability 2.2%

6. Work meeting is included in the preferences. The number of work meetings is based on a realized roster. If a driver has work meeting, then an early duty has to be assigned.

In order to test the assignment model, we do not use the pattern rosters that are generated by considering the above mentioned preferences. Therefore, new preferences need to be generated. This is explained in detail in the next section. 44 CHAPTER 9. DATA AND CASES

Table 9.3: The number of preferences per group that can be fulfilled for different values of p Group p =0.2 p =0.4 p =0.6 A 150 292 437 B 220 420 661 D 193 362 561 DO 94 181 265 DR 116 217 308 L2 113 231 337 O2 117 220 326

9.2.2 Cyclic pattern rosters and adjusted preferences Creating pattern rosters is a rather time consuming process. In order to test the assignment model for many different preferences and groups of drivers the cyclic pattern rosters created by Hartog et al. [4] are used. Hartog et al. have created cyclic pattern rosters for the roster groups in Table 9.1. We assume that the constructed cyclic pattern rosters of Hartog et al. were created by considering the preferences of the drivers. Naturally, there is no relation between these cyclic pattern rosters and the generated preferences described above. Therefore, new preferences need to be generated that correspond to these cyclic pattern rosters. The generation of the new preferences is described in detail below. A driver that wants to be finished before a certain point of time prefers an early duty. A driver that wants to start working after a certain point of time prefers a late duty. We assume that a driver who has an early duty rostered, might prefer that day to stop working before a certain point of time. Similar, we assume that a driver who has a late duty rostered on a certain day might prefer that day to start working after a certain point of time. A driver has no preference on a certain day if any of the other duty types are rostered. The assignment model will be tested on different sets of generated prefer- ences. These sets differ in number of preferences. If a driver has to execute an early/late duty then a preference is generated with probability p (and no pref- erence with probability 1 − p). Furthermore, the preferences are specified by points of time. These points of time are selected from scenarios. Each scenario has different options for the points of time. So, the sets of preferences differ both in number and in the points of time corresponding to these preferences. Preferences are generated for three different values of p. The number of generated preferences per roster group for each of the three values of p can be found in Table 9.3. Furthermore, the points of time that specify the preferences are selected from one of the five scenarios in Table 9.4. Scenarios 2-5 have different options for the early and late preferences. We assume that all the points of time from scenarios 2-5 are equally likely to be preferred. Note that all points of time are distributed symmetrically among 2.00 PM / 3.00 PM. Summarized, preferences are generated for three different probabilities and specified by points of time, selected from one of the five scenarios. So in total 5 · 3 = 15 sets of preferences 9.2. CASES 45

Table 9.4: Five different scenarios. Each scenario has different options for the points of time that specify the early and late preferences.

Early preference, i.e. Late preference, i.e. Scenario Finished before Start working after 1 3.00 PM 2.00 PM 2 2.30 PM or 3.30 PM 1.30 PM or 2.30 PM 3 2.00 PM, 3.00 PM 1.00 PM, 2.00 PM or 4.00 PM or 3.00 PM 4 1.30 PM, 2.30 PM, 2.30 PM, 3.30 PM, 3.30 PM or 4.30 PM 4.30 PM or 5.30 PM 5 1.00 PM, 2.00 PM, 12.00 AM, 1.00 PM, 3.00 PM, 4.00 PM 2.00 PM, 3.00 PM or 5.00 PM or 4.00 PM are generated for all drivers. 46 CHAPTER 9. DATA AND CASES Chapter 10

Computational results

This chapter describes the results for the method tested on the cases described in the previous chapter. In Section 10.1 we discuss the parameter settings in the first phase. Moreover, the results of the first phase are discussed. Section 10.2 discusses the results of the second phase and is built up in a similar way.

10.1 First phase 10.1.1 Parameter setting The number of legal pattern rosters increases exponentially if the roster length increases. In order to construct rosters, sub-rosters are linked together to con- struct complete rosters. Additional techniques, described in Section 6.3, are used if the roster process stops. The roster process is described in detail below. After the enumeration of many legal sub-rosters, a sub-roster is selected for each driver. With the exception of the last day, the sub-roster is “confirmed”. This will benefit the fulfilling of the preferences. Suppose for example that on the last day of a sub-roster a night duty is rostered. If an early duty is preferred on the first day of the new sub-roster period, then this preference cannot be satisfied anymore. The stepping back technique is used if for any driver no legal sub-roster can be constructed, such that it can be linked to the previous sub-rosters. The last day of the roster constructed so far will thus be removed then. Furthermore, some rosters have a low probability of being selected. These rosters are excluded by testing the rosters on two extra conditions: 1. Since the number of reserve days that needs to be executed is relative small, we include that on every 7 consecutive days only one reserve day can be rostered. 2. It is expected that sub-rosters with high costs will not be selected. There- fore, any sub-roster can have at most two unfulfilled preferences. The penalties for unfulfilled preferences can be found in Table 10.1. The rows correspond to the preferences, the columns to assigned duty types. NP means no preference. Recall that no driver prefers a night duty. Note that the penalties are set, such that all unfulfilled preferences are penalized equally.

47 48 CHAPTER 10. COMPUTATIONAL RESULTS

Table 10.1: Penalties. The rows correspond to the preferences, the columns to the assigned duty types. ED LD ND RES DO ED 011 1 0 LD 100 1 0 DO 111 1 0 NP 000 0 0

Therefore, the cost of a roster is equal to the number of unfulfilled preferences and objective function (6.5) is equal to the sum of all unfulfilled preferences.

10.1.2 Results The first phase of the rostering process was tested on the drivers of the groups of Table 9.2. Objective function (6.5) was used, i.e. pattern rosters are created by aiming on minimizing the number of unfulfilled preferences. The process turns out to be unreliable. During the creation of the pattern rosters, it occurred frequently that selected sub-rosters need to be removed completely. This is illustrated by an example below. Suppose that a roster is constructed for t days, by linking several sub-rosters. This is called the first stage. Next, for each driver a sub-roster with length t days is constructed and linked to his/her constructed roster, resulting in rosters for t + t days. For one of the drivers no sub-roster can be created, such that it can be linked to his/her constructed roster so far. The last day of every driver’s roster is “unconfirmed”. Next, again for this driver no legal sub-roster can be constructed such that it can be linked to his/her constructed roster so far. Again the last day of all constructed rosters are “unconfirmed”. This process repeats itself until roster day t + 1 of every roster is “unconfirmed ”, i.e. the roster process is back in the first stage. So, although a sub-roster could be linked to a constructed roster for t days, there is no guarantee that the roster for t days is legal. Certain properties of a roster cannot be encompassed by sub-rosters with such a short length. Therefore, creating pattern rosters by linking such short sub-rosters is not reliable.

Table 10.2 gives an indication of the number of sub-rosters, that are created per driver for different lengths of the sub-roster period. Three rosters are created for 32 full-time drivers of group 6 (roster group D and L2). One by linking sub-rosters with a length of 6 days, one by linking sub-rosters with a length of 7 days and one by linking sub-rosters with a length of 8 days. The second column shows the average number of sub-rosters that are created per driver. The set of legal sub-rosters per driver seems to triple in size if the length of the sub-rosters increases by one day, i.e. the number of legal sub-rosters seems to increase exponentially if the length of the sub-roster period increases. The enumeration process of the sub-rosters was about one minute for sub-rosters with a length of 6 days, three minutes for sub-rosters with a length of 7 days and nine minutes for sub-rosters with a length of 8 days. Note that the group size (32 drivers) times the average number of sub-rosters is equal to the average 10.2. SECOND PHASE 49

Table 10.2: Results of the first phase for group 6, by linking sub-rosters with different lengths.

Length Sub-rosters Computation time 6 1578 6s 7 4709 17s 8 13995 91s number of decision variables of the generalized set partitioning model. The length of 8 days for the sub-rosters is the upper limit for group 6, since CPLEX cannot solve models with many more decision variables. The last column shows the average computation time for the generalized set partitioning problem.

10.2 Second phase 10.2.1 Parameter settings

The penalties Pi(d, p) for not fulfilling a preference by assigning duty d to crew member p need to be set. Recall from Chapter 9 that no crew member prefers to start working after a certain point of time and likes to be finished work- ing before a certain point of time. Therefore penalty function 3 is redundant, i.e. P3(d, p) = 0. Furthermore, we do not differentiate between penalties for unfulfilled preferences with regard to starting times and penalties for unful- filled preferences with regard to ending times, i.e. P(d, p)= P1(d, p)= P2(d, p). Moreover, we state that the penalties do not depend on the crew member and/or the duty, i.e. P(d, p)= P ∀ (d, p) ∈ FP. The value of the penalty P is set to 1. Therefore objective function (7.53) is equal to the sum of unfulfilled preferences. Objective function (7.54) aims at finding a set of rosters, of which the roster with the most unfulfilled preferences has as few unfulfilled preferences as possible.

10.2.2 Results The assignment model with additional restrictions is tested on the groups of drivers from Table 9.2. As described in Section 9.2.2, the cyclic pattern rosters created by Hartog et al. [4] are used as input. The set of preferences that are used differ per test and are specified by one of the three values of p and one of the five scenarios. The rosters are created, such that as many preferences can be fulfilled, i.e. objective function (7.54) is used. The number of unfulfilled preferences will be presented as a percentage of all preferences. Table 10.3 shows the percentage of unfulfilled preferences for the five dif- ferent scenarios and p = 0.4. For most roster groups the preferences can be the best fulfilled in scenario 3 (finished working before 2.00 PM, 3.00 PM or 4.00 PM, start working after 1.00 PM, 2.00 PM or 3.00 PM). The results are rather poor for group 7 (roster group A) and group 11 (roster group DR) for all scenarios. This is due to the relative many preferences in combination with rel- ative few duties of each duty type. In the remaining tests, the set of preferences 50 CHAPTER 10. COMPUTATIONAL RESULTS

Table 10.3: Percentage of unfulfilled preferences for 5 different scenarios and p =0.4. CPLEX was not able to find a solution for group 1 and scenario 5 after 24 hours of computation.

Group Scenario 1 Scenario 2 Scenario 3 Scenario 4 Scenario 5 % UP % UP % UP % UP % UP 1 3.3% 2.3% 1.2% 2.2% Noresult 2 5.2% 3.2% 2.2% 3.3% 4.0% 3 6.7% 5.7% 3.5% 5.3% 4.3% 4 10.8% 12.7% 10.4% 15.0% 14.0% 5 11.3% 6.0% 4.9% 3.9% 4.4% 6 4.0% 3.4% 3.5% 5.1% 4.9% 7 36.0% 40.1% 30.8% 40.1% 33.9% 8 11.0% 7.4% 7.1% 6.9% 6.2% 9 9.1% 8.0% 7.2% 10.8% 9.7% 10 8.8% 8.3% 6.6% 8.3% 8.8% 11 30.4% 27.2% 23.0% 24.4% 20.7% 12 0.9% 0.4% 0.4% 3.0% 1.7% 13 3.2% 3.6% 3.6% 8.6% 10.0% corresponding to scenario 3 are used. Table 10.4 shows the percentage of unfulfilled preferences for different values of p and scenario 3. Recall from Table 9.3 that the number of preferences increases if p increases. For most of the groups the percentage of unfulfilled preferences increases if the value of p increases. It seems that relatively fewer preferences can be fulfilled when the number of preferences increases. Furthermore, Table 10.4 shows the computation time for the different groups. Recall that Group 1 consists of 96 drivers, and the roster length is equal to 13 weeks. The optimal rosters can be found in a reasonable amount of time. It seems that the pattern rosters reduce the combinatorial size of the roster problem effectively. Consider the drivers of roster groups A, B, D, DO, DR, L2 and 02 as the joint group of all drivers (Group 1). This group is subdivided into two subgroups (Groups 2 and 3), three subgroups (Groups 4 - 6) and seven subgroups (Groups 7 - 13). Table 10.5 shows the percentage of unfulfilled preferences for the number of subdivisions. The percentage of unfulfilled preferences increases significant when the joint group of drivers in split in more subgroups and rosters are created for these groups separately. For p =0.4 the percentage of unfulfilled preferences has increased from 1.2 % to 11.3 % if for every roster group separately rosters are created (7 subdivisions) instead of jointly for the total group of drivers. The unfulfilled preferences thus increase almost ten times in number for this case. As can be seen from the computation time, creating rosters for the total group of drivers is a much more complex puzzle since the computation time has increased enormously. 10.2. SECOND PHASE 51

Table 10.4: Percentage of unfulfilled preferences and computation time for dif- ferent values of p and scenario 3.

Group p=0.2 p=0.4 p=0.6 % UP C. time % UP C. time % UP C. time 1 0.3% 9.6h 1.2% 6.8h 2.3% 6h 2 0.9% 5.4m 2.2% 42.3m 5.4% 6.2m 3 4.5% 1.4h 3.5% 24.1m 4.3% 40.9m 4 9.7% 3s 10.4% 30s 15.6% 4s 5 3.6% 1.2m 4.9% 50s 8.4% 18s 6 3.3% 1.8m 3.5% 6.6m 4.2% 2.3m 7 28.7% 3s 30.8% 1s 37.5% 1s 8 5.0% 6s 7.1% 3s 10.9% 3s 9 5.2% 5s 7.2% 3s 10.7% 3s 10 2.1% 1s 6.6% 1s 14.7% 1s 11 25.9% 1s 23.0% 1s 26.6% 1s 12 0% 1s 0.4% 1s 0.9% 1s 13 6.8% 1s 3.6% 1s 9.5% 1s

Table 10.5: Percentage of unfulfilled preferences and computation time for dif- ferent values of p and scenario 3.

Divisions p = 0.2 p = 0.4 p = 0.6 % UP C. time % UP C. time % UP C. time 1 0.3% 9.6h 1.2% 6.8h 2.3% 6h 2 2.4% 1.4h 2.7% 1.1h 4.9% 46.2m 3 5.7% 3.1m 6.4% 6.8m 9.6% 2.4m 7 10.4% 18s 11.3% 11s 15.6% 11s 52 CHAPTER 10. COMPUTATIONAL RESULTS

Table 10.6: Comparing two different objective functions. CPLEX was not able to find a solution for group 1 and objective function 2 after 24 hours of compu- tation.

Group Size Objective Function 1 Objective Function 2

% UP Z1 Z2 C. time % UP Z1 Z2 C. time 1 96 1.2% 23 2 6.8h Noresult 2 52 2.2% 24 3 42.3m 4.3% 48 1 40.4m 3 44 3.5% 28 3 24.1m 14.8% 120 3 15.6m 4 32 10.4% 72 9 30s 24.8% 172 6 1.2m 5 32 4.9% 31 4 50s 9.9% 63 2 2.5m 6 32 3.5% 21 4 6.6m 10.3% 61 2 23m 7 12 30.8% 90 11 1s 31.8% 93 8 1s 8 20 7.1% 30 5 3s 9.3% 39 2 15s 9 20 7.2% 26 5 3s 10.8% 39 2 5s 10 10 6.6% 12 3 1s 9.9% 18 2 1s 11 12 23.0% 50 8 1s 26.7% 58 6 1s 12 12 0.4% 1 1 1s 2.6% 6 1 1s 13 10 3.6% 8 2 1s 9.1% 20 2 3s

Recall that objective function (7.53) (objective function 1) aims at minimiz- ing the sum of unfulfilled preferences, while objective function (7.54) (objective function 2) aims at minimizing the number of unfulfilled preferences of the worst1 roster. Table 10.6 shows the results of creating rosters for all the groups by using the two different objective functions and the preferences corresponding to p =0.4 and scenario 3. Z1 is the sum of the unfulfilled preferences and Z2 is the number of unfulfilled preferences of the worst roster (which implies that Z1 for objective function 1 is always equal or smaller than Z1 for objective function 2 and vice versa for Z2). To compare the two objective functions, the size of each group is included in Table 10.6. The results are not consistent to nominate one of the objective functions as the best one. For example, the improvement in the number of unfulfilled preferences for Group 7 is only small if objective function 1 is used instead of objective function 2. However, the rosters for some drivers degrade significant. Therefore, objective function 2 seems a better choice. The situation is vice-versa for Group 6. Rosters that satisfy both aspects can be achieved by a mixture of the two objective functions. For example, the first objective function in combination with extra constraints limiting the number of unfulfilled preferences per crew member. The drawback however is that one should have an idea in advance about the number of unfulfilled preferences to set an effective upper limit. Finally, the effect of a tighter lower bound on the percentage of A-train work

1worst in terms of unfulfilled preferences. 10.2. SECOND PHASE 53

Table 10.7: Computation time for different roster groups and different lower bounds for the percentage of A train work.

Group c=0.09 c=0.06 c=0.03 % UP C. time % UP C. time % UP C. time 1 1.2% 6.8h 1.2% 10.7h 1.2% 24h 2 2.7% 42.3m 2.7% 24.6m 2.7% 42.2m 3 3.5% 24.1m 3.5% 57.6m 3.5% 1.1h 4 10.4% 30s 10.4% 32s 10.4% 54s 5 4.9% 50s 4.9% 1.1m 4.9% 3.6m 6 3.5% 6.6m 3.5% 7.8m 3.5% 14.4m 7 30.7% 1s 30.7% 1s 30.7% 1s 8 7.1% 3s 7.1% 14s 7.1% 8s 9 7.2% 3s 7.2% 5s 7.2% 5s 10 6.6% 1s 6.6% 1s 6.6% 1s 11 23.0% 1s 23.0% 1s 23.0% 1s 12 0.4% 1s 0.4% 1s 0.4% 1s 13 3.6% 1s 3.6% 1s 3.6% 1s for every driver is tested. The lower bound on the percentage of A-train work is expressed by constraint (7.51). The maximum percentage of A-train work less than the average, is equal to c and was set to 9 % in the previous tests. Table 10.7 shows the results of creating rosters for the different groups and different lower bounds, using the preferences corresponding to p = 0.4 and scenario 3. The percentage of unfulfilled preferences is equal for all groups for any of the three values of c. It seems that the required amount of work on A-trains has no influence on the number of preferences that can be fulfilled. Apparently, duties can be interchanged such that every driver has a minimum amount of work on A-trains, without influencing the number of unfulfilled preferences. The computation time increases significantly for Group 1. This could indicate that the rostering problem becomes more complex if more work on A-trains is required for every driver. 54 CHAPTER 10. COMPUTATIONAL RESULTS Chapter 11

Conclusions and recommendations

11.1 Conclusions

In this thesis, we discussed the problem of creating personalized rosters for the crew members of NS. The aim of personalized rostering was to fulfil preferences with regard to working hours. Recall the objective of our research from Chapter 3:

Create a method to construct personalized rosters by taking into ac- count the preferences on working hours and test this method on real life instances of NS to gain insight in the applicability and complexity of personalized crew rostering at NS.

The crew rostering problem is a very complex puzzle. The number of duties that need to be assigned each day is large, while the constructed rosters have to satisfy many rules of the CAO and ATW. In order to construct rosters we have split the roster process in two phases. In the first phase, we assigned to each driver every day a duty type, such that pattern rosters were constructed. The approach to construct pattern rosters involved the enumeration of many legal pattern rosters. The total number of legal pattern rosters increases exponentially with the roster length. Therefore, we were forced to link rosters, with a shorter length to construct pattern rosters. This process is not reliable since certain requirements, which encompass a large part of the roster period, cannot be taken into account. In the second phase, the duties were assigned to the crew members given the pattern rosters. This problem was formulated as an assignment problem with additional constraints. Rosters with a length of 13 weeks could be created for 96 drivers in a reasonable amount of time. We conclude that splitting the roster process in two phases, by first creating pattern rosters reduces the combinatorial size of the roster problem effectively. The method has been tested on real life instances of NS. The results of these test can be found in Chapter 10. On the basis of these results, we do recommendations described in the following section.

55 56 CHAPTER 11. CONCLUSIONS AND RECOMMENDATIONS

11.2 Recommendations and further research

As explained before, NS is interested in implementing a system to construct personalized rosters. Some software companies producing roster software of- fer the possibility to test their system. We would like to make the following recommendations with regard to this test case. The results in Table 10.5 show that a substantial larger part of the prefer- ences can be fulfilled if rosters are created for groups simultaneously instead of separate. Since this “scale-effect” exists, crew rostering software should be able to construct rosters for many crew members simultaneously and preferably for all crew members of a crew base simultaneously. Furthermore, the required amount of work on A-trains does not seem to influence the preferences, according to Table 10.7. Apparently, duties can be in- terchanged between crew members, without increasing the number of unfulfilled preferences. It is reasonable to assume that more requirements can be stated with regard to the “Sweet and Sour” distribution, without a significant increase in the number of unfulfilled preferences. Therefore, crew rostering software should be able to create rosters that both fulfil many preferences and distribute the “Sweet and Sour” reasonable. Finally, NS should determine the criteria for evaluation of the rosters. In our tests, rosters were created by aiming on fulfilling as many preferences as possible. Aiming on this aspect resulted for a few crew members in rosters with many unfulfilled preferences. These crew members could be compensated by means of extra vacation, extra wage, etc. An alternative aim is to construct exclusively rosters with as few unfulfilled preferences as possible. The results in Table 10.6 are not consistent to nominate any of the two aims as the best one. Instead of either choosing between these two aspects, the aim of the roster process could also be to construct rosters that are a mixture of both aspects. However, to qualify the rosters one must have some notion on the number of preferences that can be fulfilled. The constructed rosters of the test case can be improved by using the im- plemented assignment model. As an input, the pattern rosters based on the constructed rosters have to be used. By improving the rosters of the test case, the quality of the constructed rosters can be rated.

As explained before, splitting the roster process in two phases, by first creating pattern rosters reduces the combinatorial size of the roster problem effectively. Further research could be conducted on constructing pattern rosters. Based on our research, complete enumeration of all pattern rosters is not preferred. An alternative method to construct pattern rosters could be based on column generation. Bibliography

[1] Abbink, E., Fischetti, M., Kroon, L., Timmer, G., Vromans, M. (2005). Reinventing Crew Scheduling at Netherlands Railways. Interfaces 35, pages 393-401. [2] Day, P.R., Ryan, D.M. (1997). Flight Attendant Rostering for Short-Haul Airline Operations. Operations research 45(5), pages 649-661. [3] Gamache, M., Soumis, F., Marquis, G., Desrosiers, J. (1999). A Column Generation Approach for Large-Scale Aircrew Rostering Problems. Operations research 47(2), pages 247-262. [4] Hartog, A., Huisman, D., Abbink, E., Kroon, L. (2005) Decision Support for Crew Rostering at NS. Proceedings of CASPT 2006. [5] Kohl, N., Karisch, S.E. (2004). Airline Crew Rostering: Problem Types, Modeling, and Optimization. Annals of Operations research 127, pages 233- 257. [6] NS Reizigers (Januari 2005 - April 2007). CAO NS Reizigers. pages 14-31, 120-121. [7] Odijk, M.A., Herpt, de, E. (2002). Beschrijvenderwijs: Plannen en bijsturen van rijdend NSR personeel. Basis & Beleid/Ortec, pages 1-42

57 58 BIBLIOGRAPHY Appendix A

Lists of definitions and rules

A.1 Duties

Duties can be labelled as a certain type

• An early duty (ED) is a duty that starts after 4.00 AM and ends before 6.00 PM.

• A late duty (LD) is a duty that ends on or after 6.00 PM, but before 2.00 AM.

• A night duty (ND) is a duty that ends after 2.00 AM or starts before 4.00 AM. This is the definition according to the Collective Agreement of the Netherlands Railways. According to the working hours act, a night duty ends after 0.00 AM or starts before 6.00 AM. This type of night duty will be called a ATW night duty.

If a crew member does not execute any of the upper duty types on a certain day, then he/she has a reserve day or day-off rostered.

• A crew member should be available on a reserve day (RES) when another crew member is not able to work. A reserve day is a day of 9 hours without a start or end time.

• A day-off (DO) is day on which a crew member does not have to work.

Duties have to fulfil certain strict requirements. They are summarized below:

• Every duty starts and ends at the same crew base.

• The minimum length of a duty is 4 hours and the maximum length is 9.5 hours. The permitted length of a duty depends on the start time and the end time. Table (A.1) summarizes the maximum duty length.

• Every duty longer than 5.5 hours should contain a break of at least 30 minutes.

All duties have a number, specifying the content of the duty.

59 60 APPENDIX A. LISTS OF DEFINITIONS AND RULES

Start time End time Maximum length 4.00 AM - 4.59 AM x 8 hours 5.00 AM - 5.59 AM x 9 hours ≥ 6.00 AM ≤ 12.00 PM 9.5 hours ≥ 6.00 AM 0.01 AM - 2.30 AM 9 hours ≥ 6.00 AM > 2.30 AM 8.5 hours

Table A.1: The maximum duty length as a function of the start and end time

• Regular duties. Duties with a number smaller than 600.

• Reserve duties (600-numbers). A reserve duty for a crew member, specifies the start and end time this crew member has to be present at a certain crew base. During this period, the crew member can be deployed if for example another crew member is absent.

• Shunting duties (700-numbers). A shunting duty contains only tasks with regard to relocating rolling stock.

• Amplitude duties (800-number). For an amplitude duty only two points of time are fixed. The start and end of the actual duty is between these two points of time and is announced at least one day before the duty. An amplitude duty is eight hours of work.

A.2 Legality rules

The rosters need to satisfy the rules of the Collective Agreement of the Nether- lands Railways and the Dutch working hours act.

A.2.1 The Collective Labour Agreement of NS (CAO) 1. Every week a crew member has the right of two days-off. Only one of these days-off has to be rostered in that week. The other can be rostered in the preceding or next week.

2. Of every two consecutive weeks, only one of these weeks can contain 6 duties.

3. A roster contains at most 25 night duties per 13 weeks.

4. After a duty, a period off work should be at least 30 hours. After a day-off a period off work should be at least 24 hours.

5. At least one of every three consecutive weekends should be a so-called “red weekend”. A red weekend starts before Saturday 0.00 AM, ends after Monday 4.00 AM and has a minimum length of 60 hours.

6. A driver executes not more than 12 duties per year with a length shorter than 5 hours or longer than 9 hours. A.2. LEGALITY RULES 61

7. A crew member has at most one amplitude duty in a week. 8. A driver can only drive on trajectories where he/she has route knowledge of. To maintain route knowledge of a certain trajectory, the track must be driven at least semi-annually.

A.2.2 The Dutch working hours act (ATW) 1. A serie of consecutive night duties has a maximum length of 5 duties. A serie of 6 ATW night duties that all end before or on 2.00h has a maximum length of 6 duties. 2. After a serie of consecutive night duties a crew member must have a rest period of at least 48 hours. A serie has a length of at least 3 duties. 3. The rest time between two duties is at least 12 hours if the first duty finishes before 2.00 AM, otherwise it is 14 hours. 4. On every period of 7 days, a rest of at least 36 hours should be rostered, or on every period of 9 days, a rest period of at least 60 hours should be rostered. 5. A crew member can work at most 45 hours a week. For a period of 13 consecutive weeks the average number of hours of work per week can be at most 40 hours. 6. A roster contains at most 10 ATW night duties per 4 weeks, and 32 ATW night duties per 13 weeks.

A.2.3 “Sharing Sweet & Sour” rules The “Sharing Sweet & Sour” rules are set up to guarantee a fair division of the popular and unpopular work over the crew bases. A few rules are listed below:

• At most 3 crew bases have a minimum of 9 different routes in their package of duties. The average over all the crew bases is 18 different routes. • At most 3 crew bases have an average HBD higher than 3 but lower than 3,3; The other crew bases have an average HBD of 3 or lower; The HBD of a duty is defined as the number of trajectories in a duty divided over the number of different trajectories within that duty. • The work of every crew base contains at least 25% of work on A-trains (Intercities and semi-fast trains). • The work of every crew base contains at most 60% of work on stock ’64. Stock ’64 is one of the oldest types of trains used at NS. • At most 5% of the duties allocated to a crew base are shorter than 5 hours. • At most 5% of the duties allocated to a crew base are longer than 9 hours.

Some restriction should be taken into account such that there is a large prob- ability of being able to construct a feasible roster afterwards. These restrictions are listed below. 62 APPENDIX A. LISTS OF DEFINITIONS AND RULES

• At every crew base their should be a reasonable distribution of the early and night duties. • The percentage of ATW night duties can be at most 53.6%. • Their should be a reasonable distribution of the weekend duties. The average of all duties is about 75% of week duties 13% of the duties on Saturday and 12% of the duties on Sunday.