Rotating schedules by the length and frequency of the work and rest periods and by the way these alternate. By way of an example, let us consider the 5-week cycle shown in Table 1. This cycle ocrresponds to a situation where: (1) There are five ~roups of employees (ideally each group should have the same number of employees); (2) The number of employees working during each of the three shifts is the same each day of the week; (3) employees work on the average 21 days out of 35, i.e.: 4.2 days a week. When this schedule is first implemented, each group is assigned to a different week of the schedule (in the following order: A, B, C, D, E). At the end of each week, each group moves to the following week and the group which was assigned to week 5 moves to week 1. After 5 weeks, each group has gone through the whole cycle. To provide reasonable working conditions, file schedule must follow certain rules which may be summarisod as follows: (1) Shift changes can only occur after a day off. (2) The number of consecutive working days must not exceed a preset bound (normally 6 or 7) and must not normally be less than 2 or 3. (3) Similarly, days off must occur in sequences of at least 2 days and of no more than 6 or 7 days. Upper and lower bounds for work days and rest days can of course be set to any desired value. (4) Long work periods will nor, rally be followed by long rest periods and similarly, short work periods will be followed by short rest per, ors. (5) Schedules should contain as many full week ends off as possible.
G i l b e r t L A P O R T E a n d Yves N O B E R T Ecole des Hautes Etudes Commerciales de Montr~al, Monrrdal, ~ d . , Canada
Jean BIRON Ministry of industry and Trade, Qudbee, Qud., Canada Received July 1978 Revised October 197S In many public servicesand in some industries, work schedules for employees very often consist of a cycle spreading over a few weeks and in which shh't work and holidays alternate. Various constraints relate to the leng~ of work and holiday segmentsin the cyclv and the construction of suitable sckedu!esis in itself a complex corabinatorial problem. This paper presents an effective ILP based algorithm for the construction of such schedules. Computational results are given. Difficulties which may afi~ in the implementation of such schedulesare also d.~scussed.
1. Introduction Many industries and public services operate around the clock, 7 days a week. This is the case in police and fire departments, in hospitals and in m ~ y heavy industries. Typical work schedules for employees of such services and indus~ "es n o r m ~ y consist of a cycle spreading over a few weeks an6 in which shift work and holiday periods alternate, The most frequently encountered case is that of a three 8-11 shifts day (day, evening and night). It is, however, common for firemen to work two 12-h shifts. There are also cases where a fourth shift is introduced to cover periods of peak
activity. These schedule= ,onsist of a cycle which repeats itself afte~ a few weeks. Employees can therefore be seen as continuously going through the same basic work-holiday pattern or rotating schedule. On rotaring schedule is determined by the length of its cycle,
Table 1
The authors would like to thank Dr. A.H. Land for suggesting the cut used in Step 6.
4
H
H
H
5
H
H
E
A 5-week cycle
© North-Holland PublishingCompany European Journal of Operational Research 4 (1980) 24-30.
Week
M
Tu
W
Th
F
Sat
Sun
1
D
D
D
H
H
E
E
A
2 3
E N
E N
H N
H N
N H
N H
N H
B C
D
D
D
D
D
E
E
H
H
E
D = day; E = evening; N = night; H = off 24
Group
25
G. Laporte et al, ~Rotating schedules
(6) Week ends off should be spread in the schedule as evenly as possible. Other rules can be set though these will tend to be more local. One such rule set by the Montreal Police-men's Brotherhood state,:l that night work should be interrupted as little as possible by short rest periods. The reason for such a, constraint was that policemen found it difficult to a~ust to frequent changes between night and day lira. In many circumstances, the workload varies during the day or from one day to the next. It may therefore be desirable to build rotating schedules in which the number of employees on duty at any time is more or less proportional to the workload [4]. The schedule shown in Table 1 is thus most suitable for a situation where the workload is constant. In this paper, we describe a method enabling the construction of rotating schedules which satisfy these constraints. The algorithm exploits the fa~t that a relaxed version of the problem can be formulated as an integer linear program.
Initialisation
1' ..2....Definition i of work- iI [ holidayconfigurations
....
I 3. DefinitioL~of cost 1 functioncoefficients I
linear program
(
-
. _
5. Can a schedule \ ~u ~ 6. Introduction of [ be drawn~____~_~~~ new constraints
I
~YES 7"i
Draw a schedule and print a calendar
[
Fig. 1, Flowchart of HOROT. 2. The construction of rotating schedules Most algorithms [ 1-4, 7-11 ] proposed so far for the construction of rotating schedules seem to be too restrictive in the sense that they can only tackle problems arising in very particular situations and many do not respect the basic constraints which have just been stated. For instance, Bennett and Potts [3] only consider two-shift schedules, while some only deal with one shift [1,2,7]. Smith's interactive algorithm [8] only considers the ease wher~ there must be 2 days off a week. Special attention is given to the number of week ends off and to the length of work stretches. Trfmoli&es [9,10] examines all schedules satisfying a prescribed set of constraints and assumes that the workload is uniform. Heller's method [4] appears to be less restrictive than most algorithms and applies to situations such as the one treated in this paper. However, the method is based on the decomposition of the main problem into several subproblems (one for each shift) end this decomposition appears to be too restrictive at times. Our own computational experience with this method has shown that ha some eases, the method does not produce a feasible schedule when one exists. Moreover, the method does not pick up the best schedule among many feasible solutions.
The algofitlun (HOROT) presented in this paper attempts to build schedules which respect ~ tile rules stated above. Moreover, the model used incorporates a cost function which enables some discrimination between many feasible schedules. HOROT can be decomposed into seven steps (see flowchart on Fig. 1). For the sake of simplicity, only three shifts will be considered in this formuiation and the length of any work or holiday period will not exceed 7 days. The extension of the formulation to other cases is straightforward.
Step 1: Initiatisation Before a schedule can be built, it is necessary to determine: (1) The ratio of days off to working days. This ratio which is normally equal to 2/5 can be increased, - if the employers agree to give the employees a shorter work week; - if the employees agree to work longer hours (such is the case of the Montreal polJcenien who recently adopted 9-h work days); - if statutory holidays are used to reduce the length of the average work week. Thus if 13 holidays are
26
G. Laporte et aL /Rotating ~chedules
granted annually, the ratio will become equal to 2.25•4.75. (2) The number of times the employees must work on each shift, each day of the week, for the total length of the cycle. Some police departments have found it convenient to assign more men to the evening shift at the expense of the night shift. It is obviously desirable that the distribution or'men over the ~ r e e shifts be more or less proportional to the workload for these shifts. In the same way, more policemen can be on duty on days where the service receives more calls and less on quiet days. One c~a thus draw up a workload table for the entire week.
Day Evening Night Off
M
Tu
W
Th
F
Sat
Sun
D! El
D2 E2
N1
N2
H1
H2
D3 E3 N3 It 3
D4 E4 N4 H4
Ds Es NS Hs
D6 E6 N6 H6
D7 E7 N7 H7
where Di(Ei, Ni) = number of groups of employees assigned to day (evening, night) shift on day i; Hi = number of groups of empioyees off duty on day i; Di + Ei + Ni + Hi = length of cycle (a constant positive integer, for all i); ~Hi/~;(Di + Ei + Nt) = preset ratio (days off/days on).
Step 2: Definition of work-holiday configurations Work-holiday configurations are defined as sequences of work days (on a given shift, starting and ending on 2 given days) and of a given number of rest days. For example, let us consider the following configuration: Tu
E
W
E
Th
E
F
E
Sat
H
Sun
This configuration consists o f 4 days work (starting on a Tuesaay and in the evening) foB.owed by two days off. In a typical situation, it is possible and neces. saw to construct around 300 such configurations. In a three shift problem, we considered 266 configurations: there were 38, starting each day of the week and built as shown in Table 2. Only those configurations which respect the constraints described above are constructed. The following configurations would therefore not be valid: M
Tu
W
Th
F
Sat
Sun
M
E
E
N
N
N
H
H
H
Th
F
Sat
Sun
M
N
N
N
N
H
W
Th
F
Sat
D
H
H
H
Step 3: Definition of cost function coefficients Each configuratior ~i is then given a weight c/ which reflects its degree of desirability. In the follow. ing examp~.e, C l preferred C 2 for three main reasons:
H = clay off
w
Th
F
Sat
Sun
M
D
D
D
H
H
H
Sun
M
Th
W
Th
F
Sat
Sun
M
E
E
E
E
E
E
E
H
H
Cl
E = evening
H
D = day E = evening N = night H -- day off
C2
1~able 2 Day
Evening
Night
Leng~ of work segment
Length of holiday segment
Length of work segment
Length of hoiiday segment
Length of work segment
Length of holiday segment
2 3 4 5 6 7
2 2 2 2, 3 2,3,4 2, 3, 4, 5
2 3 4 5 6 7
2 2 2 2, 3 2,3~4 2, 3, 4, 5
4 5 6 7
2,3 2, 3, 4 2, 3, 4, 5 2, 3, 4, 5, 6
G. Laporte et aL / Rotating schedules
(1) it has a better day off/day on ratio; (2) C1 has its work part during the day whereas 6"2 has its work part during the evening; (3) Cl has a full week end off.
27
of the following program:
subject to: Step 4: Solution of integer linear program (i = 1, ..., 7 ; ] such that work is scheduled on day i in cD),
(1)
.~ xE = Ei J
(i = 1, ..., 7 ; / s u c h that work is scheduled on day i in cE),
(2)
. xN = Ni
(i = 1, .., 7 ; ] such that work is
!
HOROT then proceeds to the ~lection of those configurati(ms which: (1) ~ enable the construction of a feasible schedule; (D will have the highest total weight. Let xi be the number of times configuration C~is selected. For the sake of simplicity, we consider three types of variables: xJ~, x E. x~, ~sociated with dayholiday, evening-holiday, night-holiday configurations (CD. C~ and C~/), and their weights cD. c~ and c~. The optimal selection of variables is given by the solution
I
scheduled on day i in Cp), E+~
+
i
xN=H/
(3)
(i = 1, ..., 7; j, k, l such that day i is off in
I
cp,
cp),
(4)
i
[ I I I
xE. 3
)
';
[
1
1 I 1
I
1 I
IT)
1
I
I
Th
i
F
I
Sat Sun
E3 E4 E5
1
m
M
li I
Sat
V2 H3 H4 H5 H6
Sun
F I
O
L
I
i
0
Fig~ 2. Coefficient stracture.
i
= Min(F6'H7)
28
G. Laporte et al. / Rotating schedules
(5)
! (/, k, l such that Saturday and Sunday are off
cf.
x D, x E, x~
(6)
non negative and integer.
The coefficient structure of this program is illustrated in Fig. 2.
Step 6: Introduction o f a new constraint
Step 5: Can a schedule be drawn?
The above integer linear program does not nlways yield a set of configurations wkich can be put together to build a schedule. For example, let us consider the simple case where Di = Ei = Ni = 1 and Hi = 2 (i = 1, ..., 7). Let us suppose that the following configurations have been selected by the program. M
Tu
W
Th
F
Sat
Sun
D
D
D
D
D
H
H
M
Tu
W
Th
F
E
E
E
H
H
Sat
Sun
M
Tu
D
D
H
H
Ca
C2
C3
c4 w
Th
N N
F
Sat Sun M Tu W Th
N N
N
N N
selected configurations. This is done by looking at all feasible ways of juxtaposing the configurations. (If the last day of configuration i is Monday, the first day of configuration i + 1 must be Tuesday.) In general, this search is performed in a few steps only as very few configurations appear in the solution. If no feasible schedule exists, the algorithm goes to Step 6. Otherwise, Step 7 is executed.
H H
F
Sat Sun
H H
This step is only used when no feasible schedule has been found in Step 5. It is then necessary to elimi. nate the current optimal solution of the program by adding a new constraint and by reoptimising. The constraint which is added is such that it eliminates only one integer point. It is relatively easy to show thi-~ (1) the constraint obtained by adding all the const::'aint (including pen negativity constraints) which are effective at the current solution is itself exactly satisfied at the current integer solution; (2) this constraint does not cut any point of the feasible domain; (3) the left hand side of this constraint is maxiraised by the current solution; (4) by subtracting 1 from the right hand side of the constraint, a valid cut is obtained that eliminates only the current solution. if in Step 4, a cutting planes algorithm is used to solve the ILP, there is no difficulty in adding such a cut [5]. If a branch and bound method is used, care must be taken to re.move the constraint when a differ. .*nt branch of the search tree is to be explored. The ~gorithm then goes to Step 4: the ILP which is now solved will include additional constraints.
H Step 7: Draw a schedule and print a calendar
Th
F
Sat
Sun
M
Tu
W
E
E
E
E
H
H
H
Cs
Its easy to check that this particular choice of configurations satisfies all the constraints of the program. However, the five configurations do not form a schedule: C5 ends on a Wednesday and no omer configurations st~ts on a Thursday. This step of th*~ a]goritlun uses an implicit enumeration method to build aU possible schedules from the
The feasible schedules found in Step 5 are then drawn in a form suitable to the user. It is often
Table 3
Day Evening Night Off
M
Tu
W
Th
F
Sat
Sun
2 2 2 3
2 2 2 3
2 2 2 3
2 2 2 3
2 2 2 3
2 2 2 3
2 2 2 3
G. Laporte et al. ] Rotaffng :~hedules
29
Table 4 Computational results with HOROT Problem
1 2 3 4 5 6 7 8 9 10 11 12
Objoctire function *
Length of cycle
(1) (1) (1) (!) (1) (1) (2) (2) (2) (2) (2) (2)
5 9 12 15 33 52 5 9 12 15 33 52
% of work days
60 67 67 67 69 70 60 67 67 87 69 70
Number of iterations
Objective function
First ILP optimum
Fi:st schedule
Optimal schedule
LP optimum
First schedule
Optimal schedule
Exccu tion time (see)
25 38 44 38 38 53 74 43 59 82 37 38
266 463 119 41 196 267 297 119 75 111 37 38
613 583 119 41 196 > 597 119 429 177 37 38
10 15 20 25 50 80 285 50 605 82 168 276
5 10 20 25 50 65 19 50 57 73 168 276
10 15 20 25 50 > 26 50 58 80 I68 276
132 143 20 25 50 300 113 I5 70 19 1l 18
Notes: > Time limit reached (300 see). *(1) c] = 5 if C] contains 3 days off, 2 of which fall on Saturday and Sunday;c] = 0 otherwise. (2) Initially, c] = 5 or 0 as in (I); add 10 to c] if C] contains 7 nights; add k if C] contains (2 + k) days off and work is done during the night; add 3 if C/contains 4 or 5 evenings.
desirable to print the calendar for each employee. HOROT frequently produces many feasible schedules. It is then possible to select the schedule having the best characteristics excluding those explicitly looked after by the integer program. One of these characteristics relates to the even spreading of the weekends off within the schedule.
3. Example
Let us suppose that a town has 108 policemen evenly distributed between 12 stations. It has been agreed that the men should work 84t shifts and 37 1/3 hours a week on the average; moreover, there must be two policemen on d u t y in each station at any
time and work stretches should vary between 2 and 7 days ff the work is done during the day or in the everqng and between 4 and 7 days if the work is done during the night. Rest periods must be at least 2 days long, weekends off should be as frequent and as long as possible, and night stretches lasting 7 days are preferred. The workload table for any statioa (and for all policemen) is Table 3. There are 266 variables in this problem. They are weighted according to "objective function (2)" of Table 4. HOROT obtains seven configurations after 54 simplex iterations (within 8 sec), shown in Table 5. When these configurations are assembled in the right order, the schedule shown in Table 6 is obtained.
Table 5 Number
Shift
Work starts
Work ends
Holiday starts
Holiday ends
Weight
1 2 3 4 5 6 7
E D E N D N E
M Tu W W Th F Sat
F M Sun Tu W Th T~J
Sat Tu M W Th F W
M W Tu Sun F Tu Th
8 0 3 18 0 18 3
30
G. Laporte et al. ~/ Rotating schedules
Table 6 M
Tu
W
Th
F
Sat
Sun
1
E
E
E
E
E
H
H
2 3 4 5 6 7
H D D E N H
D H D E N H
D H D H N E
D D H H N E
D D H N H E
D D E N H E
D D E N H E
8
H
H
N
N
N
N
N
9
N
N
H
H
H
H
H
a 5-week cycle is used in a police service: the number of men in each police station should ideally be a mul~ple of five otherwise, there will be too few or too many people working on some given days. Merging stations or transferring police officiers to other stations .may therefore prove necessary. It can also be seen that shorter cycles offer more flexibility and make the schedules easier to implement. In a police department, it may also be necessary to define different patrol areas for the various shifts if the number of men on duty is allowed to vary during the day
[41. 4. Computational results Extensive tests have been performed with HOROT. Tests problems were built by letting the following characteristics vary: (1) the ratio of work days and holidays and the workload table (see Step 1 above); (2) the coefficients of the objective function. All problems were run on the University of Montreal CYBER 173 computer and the integer program used in Step 4 was the BB program of Land and Powell [5]. HOROT was able to produce at least one feasible schedule in all of these problems. The computational time required in each problem does not depend so much on the length of the cycle as one might have expected but rather on the "tightness" of the problem and on the choice of the objective function. In all cases, however, the computational time was sufficiently low to ensure that HOROT can be used at no great expense to build rotating schedules in practice. Some of the computational results obtained ~ t h HOROT are given in Table 4. (N.B.: only three shifts are considered in these problems; in aIi cases, 266 configurations are used.) 5. lmpl.ementation
HOROT has proved a relatively efficient tool for the construction of rotating schedules. It has been used to build schedules for two policemen unions and for one firemen union in the Montreal area. The authors' experience in implementing such schedules in police and fire departments has revealed some problems which have little to do with the actuai construction of the schedules. One of ~hese problems lies in the fact that the number of employees affected by ~b.esched~es must be a multiple of the number of weeks in the cycle. Thus, if
In the authors' experience fire departments do not offer the same flexibility as police departments. It is no longer possible to staff each station according to the cycle length. The equipment in each station has to be manned by a given number of employees (usually five or six firemen per truck) and merging stations is normally impossible or inadvisable. In this case, it is necessary to allocate some firemen permanently to some stations while some others will have to work in two different stations. This may be perfectly acceptable if these stations are precisely those that are twinned when major fires break out.
References [ 1 ] K. Baker, Scheduling full-time and part-time staff to meet cyclic requirements, Operations Research Report 89, North Carolina State University, Raleigh, NC (1973). [2] K. Baker and R.N. Burns, Staff scheduling with day-off and workstretch constraints, Duke University, Durham, NC (1977). [3] B.T. Bennett and R.B. Ports, Rotating roster for a transit system, Transportation Sci. 2 (1968) 14-34. [4] N.B. Holler, Proportional rotating schedules, Thesis, University of Missouri, St-Louis, Me (1969). [5] A.H. Land and S. Powell, Fortran Codes for Mathematical Programming (WHey, New York, 1973). [6] H.E. Miller, Nurse scheduling using mathematical programming, Operations Res. 24 (1976) 857-870. [ 7 ] J. Odin, Quick optimal weekly scheduling with two consecutive days off, Technical Report 77-1, Department of Operations Research, Stanford University (1977). [8] D Smith, The application of an interactive algorithm ~o develop cyclical rotational schedules for nursing personnel, INFOR, 14 (1976) 53-70. [9] R. Tr~moli~res, Le probl~me des roulements de quarts pour ~es entreprises ~ feu continu, R.A.I.R.O. 10 (1976) 72-101. [Ioi R. Tr6moli~res and LA. Bartoli, Multivalence cyclique tours ~gaux, Institut d'Administration des Entreprises, France (1976). [11] D.M. Warner, Scheduling nursing personnel according to nursing preference: A mathematical approach, Operations Res. 24 (1976) 842-856.