nurse scheduling with tabu search and strategic oscillation

15
EUROPEAN JOURNAL OF OPERATIONAL RESEARCH European Journal of Operational Research 106 (1998) 393407 Nurse scheduling with tabu search and strategic oscillation Kathryn A. Dowsland European Business Management School, Unir~ersity C$ Wales Swanseu. Singleton Pork. Swnsra SA2 NPP. UK Received I April 1996; received in revised form 1 March 1997 Abstract The problem of producing rosters for nursing staff in a large general hospital is tackled using tabu search with stra- tegic oscillation. The objective is to ensure that enough nurses are on duty at all times while taking account of individual preferences and requests for days off in a way that is seen to treat all employees fairly. This is achieved using a variant of tabu search which repeatedly oscillates between finding a feasible cover, and improving it in terms of preference costs. Within each phase the search is controlled by a combination of different neighbourhoods and candidate lists designed to aggressively seek out local optima and then to react to the problems encountered on arrival. The result is a robust and effective method which is able to match the quality of solutions produced by a human expert. 0 1998 Elsevier Science B.V. All rights reserved. Keywords: Tabu search; Strategic oscillation; Heuristics; Health services; Employee scheduling 1. Introduction Every hospital is repeatedly faced with the ad- ministrative task of producing work rosters for its nursing staff. The precise requirements will dif- fer from ward to ward, but the primary objective is to find a schedule which ensures adequate cover at all times. Part-time contracts and requirements for different levels of cover at different grades mean that this is not a trivial task and in practice it is further complicated by days of annual leave, re- quests for specific days off, and the need to distrib- ute unpopular features, such as night shifts and Fax: +44-1792 295626; e-mail: k.a.dowsland@swan- sea.ac.uk. weekend working, evenly across the work-force. A popular approach is to use a cyclic schedule, so that each employee repeatedly cycles through the same set of weekly patterns. However, this as- sumes a constant number of personnel all of whom are available at all times. The work described in this paper was undertaken for a major UK hospi- tal which prefers a more flexible approach, so that it is able to respond directly to requests and to deal with the different numbers of nurses who may be available in any week. As it will not always be pos- sible to meet everyone’s requirements it is impor- tant from the point-of-view of staff morale that schedules are seen to be fair. Prior to our involve- ment the problem was solved by hand, by the senior nursing officer in charge of each ward, and for each ward this typically took several 0377-2217/98/$19.00 0 1998 Elsevier Science B.V. All rights reserved. PZZSO377-2217(97)00281-6

Upload: kathryn-a-dowsland

Post on 04-Jul-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Nurse scheduling with tabu search and strategic oscillation

EUROPEAN JOURNAL

OF OPERATIONAL RESEARCH

European Journal of Operational Research 106 (1998) 393407

Nurse scheduling with tabu search and strategic oscillation

Kathryn A. Dowsland ’

European Business Management School, Unir~ersity C$ Wales Swanseu. Singleton Pork. Swnsra SA2 NPP. UK

Received I April 1996; received in revised form 1 March 1997

Abstract

The problem of producing rosters for nursing staff in a large general hospital is tackled using tabu search with stra- tegic oscillation. The objective is to ensure that enough nurses are on duty at all times while taking account of individual preferences and requests for days off in a way that is seen to treat all employees fairly. This is achieved using a variant of tabu search which repeatedly oscillates between finding a feasible cover, and improving it in terms of preference costs. Within each phase the search is controlled by a combination of different neighbourhoods and candidate lists designed to aggressively seek out local optima and then to react to the problems encountered on arrival. The result is a robust and effective method which is able to match the quality of solutions produced by a human expert. 0 1998 Elsevier Science B.V. All rights reserved.

Keywords: Tabu search; Strategic oscillation; Heuristics; Health services; Employee scheduling

1. Introduction

Every hospital is repeatedly faced with the ad- ministrative task of producing work rosters for its nursing staff. The precise requirements will dif- fer from ward to ward, but the primary objective is to find a schedule which ensures adequate cover at all times. Part-time contracts and requirements for different levels of cover at different grades mean that this is not a trivial task and in practice it is further complicated by days of annual leave, re- quests for specific days off, and the need to distrib- ute unpopular features, such as night shifts and

’ Fax: +44-1792 295626; e-mail: k.a.dowsland@swan- sea.ac.uk.

weekend working, evenly across the work-force. A popular approach is to use a cyclic schedule, so that each employee repeatedly cycles through the same set of weekly patterns. However, this as- sumes a constant number of personnel all of whom are available at all times. The work described in this paper was undertaken for a major UK hospi- tal which prefers a more flexible approach, so that it is able to respond directly to requests and to deal with the different numbers of nurses who may be available in any week. As it will not always be pos- sible to meet everyone’s requirements it is impor- tant from the point-of-view of staff morale that schedules are seen to be fair. Prior to our involve- ment the problem was solved by hand, by the senior nursing officer in charge of each ward, and for each ward this typically took several

0377-2217/98/$19.00 0 1998 Elsevier Science B.V. All rights reserved. PZZSO377-2217(97)00281-6

Page 2: Nurse scheduling with tabu search and strategic oscillation

394 K.A. Do&and I European Journal qf Operational Research 106 (1998) 393-407

man-hours per month. Our remit was to produce a computer system which could match the quality of these manual schedules.

Variants of the employee scheduling problem have been of interest to operational researchers for many years. If the day is partitioned into dis- tinct shifts, and the objective is to meet a given de- mand for manpower for each shift, then cyclic schedules have proved popular. Examples of this approach include the work of Rosenbloom and Goertzen [l] and Balakrishnan and Wong [2]. Ear- ly approaches to problems with different charac- teristics focused mainly on simple heuristics or on integer programming formulations. However, both these approaches have their drawbacks and more recently more powerful heuristic techniques and knowledge-based approaches have been ap- plied. Examples include a hybrid of tabu search and AI for the general employee scheduling prob- lem by Glover and McMillan [3]: the use of simu- lated annealing for the same problem by Thompson [4], and for the cyclic scheduling prob- lem by Brusco and Jacobs [5,6]; and the knowledge based approaches for rostering airline ground crews and scheduling hospital doctors suggested by Chow and Hui [7] and Gierl et al. [8], respec- tively.

In our case the objectives are to produce weekly schedules which meet strict constraints on the numbers of nurses of different grades on duty at different times (known as covering constraints), while attempting to match the preferences of the nursing staff and ensuring that the resulting rosters are perceived as being fair over the medium term. This means that the desirability of a given work pattern will differ for each employee, making our problem somewhat different from those in which the objectives are to minimise actual monetary costs. The project involved many interesting issues from an operational research point-of-view, but here we focus purely on the algorithmic issues of the central scheduling program.

In its most basic form tabu search can be de- scribed as a local search procedure that allows up- hill moves by selecting the best move in the current neighbourhood even if it is non-improving. The use of a tabu list prevents the search returning too soon to previously visited solutions. However,

it is now widely accepted that gains in solution quality and algorithm efficiency can be made by in- corporating a variety of additional features. In particular it is important that the search be en- couraged to home in on good areas, a process known as intensification, but also be given ade- quate opportunity to diversify or move away from its current region into promising new areas. Many recent developments have focused on mechanisms for doing this intelligently rather than randomly. These include the use of specially selected subsets of the neighbourhood, known as candidate list strategies; the recognition of features which play a large part in guiding the search towards good so- lutions, known as influential attributes; and allow- ing the search to move to and fro between different regions of the solution space, known as strategic oscillation. See [9] for a discussion of these and other features.

The algorithm developed for the nurse schedul- ing problem incorporates the following features. 1. Strategic oscillations to move around the

boundaries of the feasible region as defined by the covering constraints.

2. Replacement of many random uphill moves by chains of moves, known as ejection chains, so that the net effect of a chain is an improvement in the evaluation function.

3. Recognition of attributes which are causing sub-optimality in many of the local optima, and adjusting the neighbourhoods and/or can- didate lists to ensure that these attributes are corrected.

4. Strategic use of different neighbourhoods and candidate lists.

5. Short tabu lists to control situations which may still lead to cycling.

6. Use of influential attributes to guide diversifica- tion.

7. Bounds to avoid wasting time concentrating on areas of the solution space which cannot im- prove on the best solution to date.

Section 2 concentrates on the problem details and justifies the use of a local search heuristic as an ap- propriate solution method. This is followed by a discussion of the problem specific decisions, in- cluding the basic neighbourhood structure and the best way to handle the conflicting objectives

Page 3: Nurse scheduling with tabu search and strategic oscillation

K. A. Dowslnnci I Europrun Journal of Opcwxtioncrl Reseurch IO6 ( 1998 ) 393407 395

of meeting the minimal covering requirements and allocating preferred shift patterns. Sections 4-6 deal with the algorithmic details and Section 7 with the results of experiments on real and artifi- cial data. These indicate that the method is well able to match the manual solutions in terms of overall quality, but that there is still room for im- provement. The paper concludes with some sug- gestions for future research.

2. The problem

Working practices mean that each nurse works an entire week on days or nights and belongs to one of three grade bands. The minimum number of nurses from each band who must be on duty each day or night of the week is defined cumula- tively. For example typical night requirements are for at least one nurse from band 1, at least two from bands 1 and 2 and at least three in total. Many nurses have part time contracts which means that they work a smaller number of full shifts than their full-time counterparts. As the night shift is longer than the day shift a nurse on nights typically works less shifts than if he or she were on days, but for a given nurse in a given week the number of shifts he or she will work if on days or nights is known. Thus we can enumerate all the feasible patterns of work for a given nurse in a giv- en week and allocate each nurse-pattern pair a penalty cost depending on the overall quality of the pattern, the nurse’s requests for days off and the recent history of shifts worked. Assuming that these penalty values are an accurate reflection of the relative attractiveness of the patterns the prob- lem of meeting the covering requirements in such a way as to maximise the overall quality of the schedule can then be defined as follows:

( I if nurse i works pattern j, Xl, = 1 0 otherwise,

p;i is the penalty associated with nurse i work- ing pattern ,j; F(i) is the set of patterns feasible for nurse i; N~A- = 1 if pattern j covers shift k. G,. is the set of nurses of grade-band Y or above; R(k,r) is the minimum acceptable number of nurses of grade r or above for shift k.

min

y, x aikxIi >, R(k. r) VI-. k. tic, /U(I)

Xi, = 0 or 1.

(1)

(2)

(3)

The subjective nature of the rules for allocating penalties point to a heuristic solution approach and local search is an attractive option for a num- ber of reasons.

First there are some rules and penalties associ- ated with the mix of early and late shifts for those nurses allocated to days. Not all schedules result in the same quality of solution with respect to this fi- nal phase. There are also situations in which schedules with the same penalty cost may not be seen as equal by the user. It is therefore useful to be able to produce several good solutions for post-processing and final subjective judgement. The degree of randomness inherent in many local search algorithms, and the fact that many of them visit several good solutions during a single run make them ideal in this respect.

Second. problem details vary from ward to ward, and even from week to week. It is therefore vital that the approach is flexible enough to deal with this. Approaches such as tabu search and simulated annealing are well known for their robustness and the ease with which they can be adapted to embrace minor changes in problem def- inition.

Finally, these methods are well-tried and tested on a number of similar problems. As well as the examples of their use for employee scheduling they have proved successful in other areas where hu- man factors result in a mixture of hard and soft constraints [lo-121.

3. The local search framework

3.1. Neighhourhood

Before deciding on the search mechanism it is useful to consider the space over which the search

Page 4: Nurse scheduling with tabu search and strategic oscillation

396 K. A. Do~tdmrl I Europeun Journul of Oprrutionui Resrurch 106 (IYW) 393-407

will be conducted. The problem has two natural neighbourhoods. The first, and simplest, involves moving from schedule to schedule by changing the shift pattern of a single nurse by a single shift. However, this neighbourhood would not enable the search to move directly from one type of pat- tern to the other. To overcome this, either the so- lution space would need to be extended to include patterns of mixed type, or the neighbourhood would have to be augmented by a set of extra moves. An alternative, which automatically over- comes these problems, is to use a neighbourhood based on shift patterns, and to define a feasible move as any change of pattern for a single nurse. This neighbourhood includes all moves from the simpler neighbourhood and should have the added advantage of allowing a broader and more adapt- able search. This second neighbourhood was therefore selected as the basis for all moves and will be referred to throughout as the standard neighbourhood.

3.2. Handling the covering constraint

In a situation where all nurses work full-time and each nurse is available for all full-time shift patterns, feasible solutions satisfying constraints (2) and (3) are easily identified using local search on the set of allocations satisfying Eq. (2) and using the shortfall in Eq. (3) given by:

14 3

CC = max 0, XF: R(k, r) -C C a;kX;j

t ( ,

!i=I r=I SC,- j@(i) 11

(4) as the evaluation function. This will be referred to as the covering cost. Although it can be shown that not all local optima correspond to global op- tima, and some non-improving moves may there- fore be required, a small number of restarts from a greedy starting solution usually suffice to reduce covering cost to zero.

Once part-timers and infeasible patterns are in- corporated, simply finding a feasible solution be- comes more difficult, and finding such a solution which also has a low penalty cost as given in

Eq. (1) is an extremely difficult task. It was there- fore decided to incorporate the search for feasible solutions into the main search process. Three alter- natives were considered.

First the solution space can be relaxed by re- moving constraint (3) and incorporating the cov- ering and penalty costs in a single weighted evaluation function. The disadvantage of this ap- proach is that it can be difficult to balance the weights, especially as one of the subcosts must be reduced to zero. An additional problem in this case is the fact that the p;j values are themselves the result of combining several other penalty costs. These, and consequently their magnitudes relative to the covering cost, are likely to change from ward to ward, and it is likely that the weights in the evaluation function would need to be re-tuned for each user.

A second possibility is to use a phased ap- proach, in which the objectives relating to binding constraints are solved first, and then the solution space is reduced to remove any solutions which do not meet these objectives. The search continues in the reduced space with respect to the secondary objectives, possibly using a different neighbour- hood structure to deal with a potentially more sparsely connected solution space. This approach has been used successfully on a number of other scheduling problems [ IO,1 I]. However, in this case there may be little or no slack in the coverage con- straints. This would render the standard neigh- bourhood completely ineffective in phase 2. In Section 5 this problem is partly addressed by the introduction of two new neighbourhoods. How- ever, the efficiency of these neighbourhoods is ad- versely affected by the need to cover at three different grades, and it was felt that a search of this type would not have sufficient freedom to do well in phase 2.

The third option, which can be regarded as an extension of a two-phase procedure is to use strate- gic oscillations to allow the search to cross the boundary of feasibility as defined by the covering constraints and then to re-enter in a different part of the feasible region. This approach was suggested by Glover [9] and has been successfully incorporat- ed into tabu search algorithms for number of prob- lems (e.g. [13]). Our algorithm utilises oscillating

Page 5: Nurse scheduling with tabu search and strategic oscillation

K. A. Dowdund I Europran Journtrl of Operurionul Rrsrurcl~ 106 (1998) 393 -407 397

phases in the following way. It starts by aggressive- ly trying to find a moderately good feasible solu- tion, concentrating on moves which improve the covering cost and allow no increase in the penalty cost. The neighbourhood structure is then extend- ed in an attempt to further improve the penalty cost while remaining feasible with respect to the covering constraints. When a local optimum with respect to penalty cost is reached, a single move which increases the covering cost takes the search back into the infeasible region. Covering cost is again reduced aggressively and the whole process cycles through these three phases until no improve- ment to the best feasible solution has occurred for a predefined number of moves. Currently this is set at 1000. The search is controlled by the use of a number of different neighbourhoods. candidate lists and evaluation functions. which are outlined in the following sections.

4. Obtaining a feasible solution with phase I

4.1. The stundurd neighhourhood

Phase 1 starts with a randomly generated solu- tion and randomly selects moves using the stan- dard neighbourhood described in Section 3. The candidate list is restricted to moves which decrease the covering cost and do not increase the penalty cost. and the first feasible candidate sampled is ac- cepted. This rarely leads immediately to a feasible (i.e.. zero covering cost) local optimum. In some cases the reason for this is easily recognised and corrected. Any solution partitions the nurses into two sets: those working days and those working nights. Once a local optimum has been reached, moving a single nurse from one type to another usually involves a significant increase in covering cost. At some local optima the number of shifts worked by nurses of a particular type fall short of those required i.e.,

where Tt is the set of shift patterns of type t, N,(i) the number of shifts in a pattern of type t worked

by nurse i, and Qtr is the total number of shifts of type t required for grade-band r. Such solutions will be referred to as unbalanced. They can be cor- rected by a standard neighbourhood move, which moves a nurse who is not working a type t pattern to a type t pattern. The candidate list is restricted to moves which do this and the best move accord- ing to the covering cost is chosen.

Local optima which are not unbalanced also occur frequently. The initial intention was to es- cape these using a standard tabu list. However, ex- amination of these solutions indicated that they were surrounded by many zero-cost and small up- hill moves. As a result simple variants of tabu search frequently wasted much time wandering aimlessly around these ‘flat-bottomed valleys’. Analysis of the differences between local and glob- al optima also showed that moves involving signi- ficant increases in covering cost were sometimes necessary to move from one to the other, and the numerous low-cost moves meant that such moves were very rarely accepted. Although some of these difficulties may have been overcome by a more careful balancing of tabu lists and diversification strategies. a more intelligent approach of actively generating improving chains of moves was chosen. Although the chains are made up of standard moves they can also be regarded as widened neigh- bourhoods.

Two types of chain neighbourhoods were uti- lised. For the sake of clarity these neighbourhoods will be introduced in terms of a single grade-band. The arguments used can then easily be modified to cope with different grades.

4.2. I. The .sh$ chrrin nei~hhourhooci At any balanced local optimum there will be

non-empty sets of both under-covered and over- covered shifts. An improved solution will be ob- tained from a chain of moves whose net result is to increase the covering of any under-covered shift, decrease the covering of an over-covered shift, and leave the remaining coverage unchanged. The shift chain neighbourhood comprises chains

Page 6: Nurse scheduling with tabu search and strategic oscillation

398 K. A. Dowslund I European Journal of Operational Ruearch 106 (1998) 393407

of moves, each changing the pattern of one nurse by a single shift, so that no nurse is involved more than once in the same chain and, so that the first move increases the covering of an under-covered shift, and the remaining moves cover the gap left by the previous move. For example, consider a problem with three nurses working days with the requirement for two nurses on each day shift. Sup- pose the current solution allocates them to the pat- terns below, in which the first seven elements of the string represent the day shifts and the last seven the night shifts.

Nurse A (1111100 0000000) penalty cost = 0 Nurse B (0110101 0000000) penalty cost = 2 Nurse C (1011101 0000000) penalty cost = 8

Shifts 3 and 5 are over-covered by one nurse and shift 6 is under-covered by two nurses. This situation could be improved by changing the pat- tern of any nurse to cover shift 6 instead of shift 3 or shift 5, but if each of these six potential moves results in an increase in penalty cost they will not be considered. Instead we can change the patterns of all three nurses as follows

Nurse A (0111110 0000000) penalty cost = 0 Nurse B (1010101 0000000) penalty cost = 3 Nurse C (1101101 0000000) penalty cost = 5

If we consider the moves in sequence, after moving nurse A we have reduced the under-covering on shift 6 by one unit, at the expense of shift 1 which is now one nurse short. Nurse B’s move rights the problem on shift 1 at the expense of under-cover- ing shift 2. Finally nurse C’s move rights the prob- lem on shift 2 by moving from the over-covered shift 3. The overall cost of the chain in terms of penalty costs is -2, i.e., an improvement, although penalty cost does increase at the intermediate phase after nurse B’s move.

Chains of non-positive penalty cost are generat- ed by considering them as paths in a graph with multiple edges. The vertex set is given by the 14 shifts, and a directed edge from vertex i to vertex ,j is defined for each nurse currently able to move to shift i from shift j without affecting the rest of his or her pattern. The edge weight is defined as the increase in penalty cost given by such a move.

Thus in our example nurse A would define 10 edg- es, five from shift 6 to shifts l-5, and five from shift 7. Nurse B would define 12 edges, from each of shifts 1,4 and 6 to each of 2, 3, 5 and 7 etc. Un- der-covered shifts are defined as sources and over- covered shifts as sinks. Any zero or negative cost paths from a source to a sink that use at most one edge defined by each nurse will improve cover- ing cost without increasing penalty cost. In the above example node 6 is the single source, nodes 3 and 5 are sinks, and the remaining nodes can act as intermediate nodes. The chosen path was (6, l), (1,2), (2,3) defined by nurses A, B and C, res- pectively, and costing 0 + 1 - 3 = -2.

The presence of negative weights and the con- straint on the number of times each nurse can be represented in a chain mean that a simple shortest path algorithm such as that due to [14] is not ap- propriate. Instead the graph is searched using a depth first search with the nodes ordered randomly to avoid built in bias until either a suitable path has been found or the search tree is exhausted. As paths are restricted to moves within shift pat- tern type, the fourteen vertex graph can be regard- ed as two disjoint graphs of seven vertices. For a particular set of sources and sinks the tree there- fore has a maximum depth of five intermediate search nodes. As the objective is to find suitable chains quickly and easily only the cheapest edge relating to an unused nurse is considered at each branch.

The presence of grades is a complicating factor as the nurses moved must be of a sufficiently high grade to meet the under-covering in the shift they move to. To allow for this the search is conducted three times, once for each grade-band, with nurses from higher bands being allowed to contribute to the path only if the shift from which they are being moved is over-covered at their own, and all inter- mediate, grade-bands.

4.2.2. The nurse chuin neighhourhood The nurse chain neighbourhood consists of

chains of moves which move the first nurse in the chain to cover an under-covered shift, and then move the subsequent nurses to the exact patterns vacated by their predecessors on the chain. For ex- ample, suppose nurses A and C work as before,

Page 7: Nurse scheduling with tabu search and strategic oscillation

K. A. Dowlund / Europeun Journul of’ Oprrutionnl Resrurclt IO6 (1998) 393407 399

and nurse D works (0000000 0011110). If nurse A can work nurse C’s pattern, nurse C can work (0000000 0011110) and nurse D can work (1101110 0000000) the chain formed by moving nurse D onto the new pattern, nurse C to nurse D’s old pattern and nurse A to nurse C’s old pat- tern will have the net effect of moving the over- cover on shift 3 to reduce the under-cover on shift 6. If the total increase in penalty cost is non-posi- tive then these moves will form a suitable chain. Once again the problem can be represented as a graph, with the nodes on this occasion represent- ing the nurses. An edge exists between nodes i and j if nurse i can work the pattern currently worked by nurse j. The cost is the increase in pen- alty cost in moving nurse i to the shift currently worked by j. Each nurse working a pattern with at least one under-covered and at least one over- covered shift is considered as a source node. The sinks relating to source i are given by those nurses who can work a pattern k such that substituting k for the pattern worked by i would improve the covering cost. In our example source A defines three cover improving patterns - (1101110 0000000), (1111010 0000000) and (1101011 0000000). Each nurse who can work any of these patterns defines a suitable sink. Each sink is allo- cated a weight given by the cost of moving the nurse to the cheapest of these options and this weight is added to the cost of any chain ending at that sink. Here we have chosen sink D and the first of the three patterns and reached our goal using path ACD. Once again suitable paths are found using a depth first search after randomly or- dering the vertices. Although the graphs are some- what larger than the shift-chain graphs they tend to be disconnected due to nurses working different

Table 1 Phase I moves

numbers of days, thus decreasing the size of the search trees.

In this case it is far more difficult to mix grades and so these are dealt with separately, thus reduc- ing the size of the underlying graphs, but at the ex- pense of missing some potentially improving chains.

4.3. The full phasr I strategy

Both chain neighbourhoods are used aggres- sively to decrease covering cost without increasing penalty cost. If the search reaches a local optimum with respect to all of the above neighbourhoods then the standard neighbourhood is utilised again. This time the candidate list is restricted to ensure that at least one fault of the current solution is eliminated. It restricts the available moves to those which remove a unit of cover from an over-cov- ered shift and add it to an under-covered shift. The coverage of other shifts is allowed to change arbitrarily. Empirical evidence suggests that such moves are frequently very successful in getting into a situation where one of the aggressive moves is then able to arrive at an improved solution. These moves, together with a random move to prevent the search becoming trapped, comprise phase 1. Their use is summarised in Table 1.

The moves are attempted in order. If the move is accepted the pointer returns to the top of the list, otherwise the next move is attempted. Move type 2 is only attempted if the local optimum from type 1 is unbalanced. The final random move is rarely needed, but in situations where a large number of patterns are infeasible for one or more nurses it is possible that none of the earlier moves will

Neighbourhood Candidate list Evaluation function Selection

I. Standard No PC increase 2. Standard Balance restoring 3 j:

Shift-chain All Nurse-chain All

5 h:

Standard Over to under Standard All

(PC is the penalty cost and CC the covering cost).

cc cc PC PC cc

First decrease Best First non-increasing First non-increasing Best First

Page 8: Nurse scheduling with tabu search and strategic oscillation

be feasible. Move type 6 gives the system a random kick and avoids it getting stuck in this situation. (For a full overview of phase 1 see Appendix A.)

5. Reducing penalty cost - phases 2 and 3

Once phase 1 has found a feasible solution with zero covering cost, phase 2 is invoked in an at- tempt to improve the penalty cost without violat- ing the covering constraints. This is achieved using moves similar to those in phase 1, but limit- ing the candidate lists to maintain feasibility. If the covering constraints are tight then it is possible that a solution will not have any neighbours under the standard neighbourhood, and feasible moves will be made up of chains which have the net effect of leaving the total coverage of every shift un- changed. Such moves can be generated by modify- ing the shift-chain and nurse-chain neighbourhoods. In phase 1 these neighbourhoods are defined as paths from under-covered to over- covered shifts. In phase 2 there is no under-cover- ing and feasible chains will be formed by cycles i.e., paths with the same start and end point. The rou- tines outlined in phase 1 are easily adapted to achieve this. The phase 2 moves are given in Ta- ble 2 and are attempted from the top of the list un- til a move is accepted, as for phase 1.

When none of the three move types result in an improvement, the search oscillates back across the feasible boundary with a single move in phase 3. This uses the standard neighbourhood with a full candidate list and takes penalty cost as the evalu- ation function. The move is chosen according to the best criterion and will always increase the cov- ering cost. The search then reverts to phase 1.

The emphasis on aggressive downhill moves means that the role of the tabu list is somewhat re- duced as cycling is automatically avoided through

Table 2 Phase 2 moves

much of the search. However, as uphill moves are allowed it is still a vital ingredient. In order to avoid small cycles around local optima in phase 1 it proved sufficient to apply a tabu list of size 1, preventing the same nurse being moved twice in consecutive standard neighbourhood moves. However, in Section 6 we introduce a further tabu list, designed to avoid the search cycling through a small subset of regions.

6. An influential attribute

Computational tests using the data described in Section 7 suggested that the above algorithm per- formed well most of the time, but there appeared to be certain data characteristics which lead to very variable results. These characteristics were:

(i) When there were just enough nurses to meet overall covering requirements and the work force contained small numbers of nurses con- tracted to work four days or three nights and three days or three nights. In this situation the algorithm frequently found relatively poor solu- tions, and sometimes had difficulty in obtaining a feasible solution. (ii) When the covering constraints were slack. Further investigation of the difficult problems,

utilising computer graphics to monitor the pro- gress of the search, highlighted the following rea- sons. When covering requirements are tight the partitions into night and day workers become crit- ical in finding feasible covers. The search would sometimes cycle through just two partitions, but as several moves were made between each parti- tion change this problem would not be picked up, even with a longer tabu list. Where the search was failing to find covering solutions the day-night partitions were again identified as the cause. In these cases the mix of workers was leading to situ-

I. 2. 3.

Neighbourhood Candidate list Evaluation function Selection

Standard No CC increase PC First decrease Shift-chain All PC First decrease Nurse-chain All PC First decrease

Page 9: Nurse scheduling with tabu search and strategic oscillation

ations where both shift types were under-covered according to condition (5). Moves of type 2 fre- quently fail to correct this problem.

Both these problems are partly caused by the use of a best criterion in selecting a move, and may be overcome by employing some form of probabilistic best. However, it can also be argued that it is the overall influence of the day-night par- titions on solution quality which is the root of both problems, and that the solution should address this issue directly. This view was enforced by the analysis of situation 2. Here, because covering constraints are slack there is more freedom of movement in phase 2. This can lead to a situation where, although not strictly cycling, the search never makes a move which changes the day-night partition, and therefore concentrates all its effort over one small area of the solution space.

The above problems were overcome by specifi- cally tracking the day-night partitions. A diversity of partitions was ensured by a tabu list and a timed diversification strategy. A new entry in the list is the set of nurses working days in the current solu- tion. The list is checked and updated whenever a move swaps the shift type, and as there are typical- ly less than 30 nurses on a ward, it can be imple- mented efficiently using a binary representation for each entry. Experiments suggested that a short list gave the best results and a length of six has been implemented. The tabu list will not help if no partition changing moves are accepted. Obser- vation of successjttl runs suggested at most 40 moves were made without partition changes. Therefore, if 50 moves elapse without changing the partition the candidate list for the next type 1 move is restricted to those which change pattern type, and the first feasible move is selected.

The problem of doubly unbalanced solutions is overcome by introducing a new, swap neighbour- hood, which is used in place of a type 2 move whenever types day and night satisfy Eq. (5) simul- taneously. The candidate list is restricted to the set of all pairs of moves which move a nurse from days to nights and vice versa, and the move is se- lected using covering cost as the evaluation func- tion with a best selection criterion.

Observation of the length of time typically spent within a single partition lead to one further

improvement. If a nurse is working a shift type which is heavily penalised (e.g., nights for the sec- ond consecutive week) then time spent in the cor- responding partitions may be wasted. A simple bound can help to avoid this. For each nurse the minimum penalty cost for each type of shift pat- tern is calculated, and a lower bound for the cur- rent partition is given as the sum of these values for the current shift pattern types:

(6)

If this exceeds the best feasible solution so far then the current partition is bounded. Rather than bar the search from such regions, and thus prevent it passing through to potentially better areas, the bound was used to limit the amount of time spent in bounded partitions to 5 moves, after which the candidate list was restricted to enforce a new type partition.

The full algorithm incorporating all of the above features is summarised in the Appendix A.

7. Computational experience

The above algorithm was tested on data of three types. In the initial stages of the project only limited data was available. This comprised infor- mation from a single ward concerning the grades and weekly hours of the nurses and the coverage requirements, together with an incomplete list of constraints concerning frequency of nights, week- ends off, consecutive days worked etc. This infor- mation did not include any request data or details of how preferences should be ranked. Nev- ertheless it was used to build 10 data sets using ar- tificial request and history data and varying the number of nurses available and the covering re- quirements. The plj values ranged from 0 to 10. with 10 indicating that shift patternj is not feasible for nurse i.

The second data set consists of ‘live’ data cover- ing a total of six weeks from three wards, and in- cludes full details of recent history and requests. The manually produced schedules from this data were also available. The density of requests was

Page 10: Nurse scheduling with tabu search and strategic oscillation

402 K. A. Dowdunri / Europun Journul of Operurionul Reseurch 106 (1998) 393407

far higher than had been assumed for the artificial data and it was apparent that the range of penalty values were not sufficient to reflect the differences in schedule quality. Therefore this aspect of the system was revised to allow a range of l-100, with almost all values lying between 0 and 50 and a strong bias to the lower end of the range. This changes the features of the solution landscape con- siderably. Finally the real data was used to gener- ate a further set of artificial data by extending the request data over additional three weeks, keeping a similar density, and then running the system, using the updated history details from the previous week in each case.

The initial data was used in conjunction with a full graphical interface to aid algorithm develop- ment. These runs indicated that the algorithm was performing well. Most requests were met, and where this was not so, examination of the data showed that this was not possible. It is also gener- ally not possible to meet all the covering con- straints using perfect, zero-cost, shift patterns. Once again, examination of the data suggested that the costs incurred for less than perfect pat- terns were unavoidable and the solutions were therefore optimal.

In order to see to what extent our reasons for rejecting the use of a two-part weighted evaluation function were justified, all 10 initial data sets and the live data sets were run through the above algo- rithm (SO) and through a straightforward random descent algorithm (RD), simulated annealing (SA) and tabu search (TS) using a simple weighted cost function using five different seeds. On the initial data SO consistently reached optimal solutions within less than 1000 moves. The other methods required the weights for the penalty and covering costs to be tuned correctly, but once weights of ra- tio approximately 3 : 2 were applied both SA and TS were able to produce optimal solutions around 50% of the time and were within 1 or 2 units of op- timal for the remainder. RD was less successful, frequently getting stuck in infeasible local optima. A second experiment was therefore conducted al- lowing RD ten starts per run from solutions gener- ated by a randomised greedy strategy. Under these conditions the performance of RD matched that of SA and TS.

However, on the live data none of these meth- ods were able to produce solutions of the required quality. Weight ratios ranging from 3 : 2 to 15 : 2 were tried, but it was clear that if weights were high enough to find feasible solutions in terms of cover, they were too high to guide the search to good solutions in terms of penalty cost. Both RD and SA were typically giving results with pen- alty costs almost twice those produced by SO. SO, on the other hand, proved very robust and contin- ued to perform well. Although it is possible that with considerable extra effort in fine-tuning the pa- rameters any of these methods might have been improved none of the basic implementations was able to solve the problem satisfactorily.

Fig. 1 illustrates typical cost function behav- iour for the SO algorithm over a single run of 500 moves. Fig. l(a) shows the complete run (the optimal solution is found at iteration 497) and Fig. l(b) concentrates on the final 100 iterations. Each move is plotted so that moves under the chain neighbourhoods will appear as several moves with undulating costs. The different phases and neighbourhoods can be seen clearly, and are marked in Fig. l(b). The gaps between the dou- ble-dashed lines indicate a single move in phase 3. Note how phase 1 quickly finds an initial feasi- ble solution, which is then improved during phase 2. The ‘comb’ shape areas on the covering cost rep- resent the individual moves used during the chain neighbourhoods, with the nurse-chains tending to cause the higher peaks. It is noticeable that the lengths of the chains, represented by the distance between successive zeros for covering cost, tend to be short. At the end of phase 2 the random up- hill jump in cost function accompanied by a down- hill move in penalty cost (sometimes below the optimal feasible value) can be observed. This prob- lem instance is one in which both types of shift pattern may be under-covered at the same time and the longer periods spent in phase 1 represented by the wider peaks tend to correspond with local optima which experience this problem. It is also in- teresting to note how both the covering cost and penalty cost have suffered considerable increase just before the final descent to a new best solution.

Table 3 shows the mean proportions of accept- ed moves of each type for problems with some

Page 11: Nurse scheduling with tabu search and strategic oscillation

403

300

240

180

120

60

0

30

20

10

0

120

90

60

opt value 30

a. Costs over 500 iterations.

Covering cost.

b. Costs over 100 iterations.

Fig. 1. Behaviour of the cost functions.

Table 3 Percentage of accepted move types

Move type Phase 1 Phase 2 Phase 3

1 2 3 4 5 6 1 2 3 I

Tight problems 21.5 9.1 4.0 0.5 6.4 0 0 45.2 10.1 3.4 Slack problems 22.6 1.1 3.2 0.4 10.2 0 19.3 23.4 9.7 10.3

slack and those without. The results indicate that type 2 moves tend to be used more frequently, all the different moves have a part to play, but and the standard neighbourhood descent move their frequency does depend on data characteris- (type 1) is never used in phase 2. The number of tics. For tight problems the balance correcting phase 3 moves suggest that slack problems go

Page 12: Nurse scheduling with tabu search and strategic oscillation

404 K.A. Dow.dund I Europeun Journul cf. Oprrationul Rmwrc11 106 (1998) 393-407

through more oscillations than tight ones This is likely to be a factor of the relative ease with which the slacker problem finds feasible solutions, thus requiring less moves to complete phase 1 on each visit.

Because of the density of the request data and the more complex penalty structure it is no longer possible to ascertain the optimality of solutions by inspection. However, the quality of solutions was judged to be equal to that of the manual solutions produced by the sister in charge of the wards, and as a result the system has been accepted by the hospital.

ficulty of the problem. A full run, stopping after 1000 moves without overall improvement, typical- ly takes between 1 and 2.5 min on a 60 MHz pent- ium pc. It is obviously worth trying several random starts in order to obtain the best possible result and as no user interaction is required during the calculation phase, this will not create any prac- tical difficulties.

8. Further work

Each data set has also been run through the SO algorithm using 10 random number seeds and the frequencies of finding the best solution and solu- tions within 10% of best recorded. These results are given in the first row of Table 4.

On data sets l-5 the algorithm consistently seeks out optimal solutions. Data set 6 proves more difficult, and closer examination revealed that there are relatively few feasible solutions, all of which are clustered in the same region of the so- lution space.

Finally the same process was repeated on the third set of data. These results are given in the re- maining rows of the table, representing extending the runs to the second, third and fourth weeks res- pectively. Here the results are more variable. This may be due to the difficulty in generating artificial data which deals adequately with the interaction among the various sources of penalty cost. In some cases the data displayed conflicts which would nor- mally have been resolved at the data input stage. Thus the results may not be indicative of those ex- pected from real data. The mean number of moves before finding the optimal solution varied from around 250 to around 1000 depending on the dif-

Although the algorithm works well and has been able to produce robustly good solutions for a variety of real data, there is room for further im- provement in terms of consistency and speed. As a first step a more comprehensive evaluation of per- formance is necessary. However, our experiences with artificial data suggest that the interaction be- twccn the different sources of penalty cost make it very difficult to produce test data which is chal- lenging and yet not over-constrained. For this rea- son we have decided to wait until we have been able to gather sufficient real data to form a com- prehensive test data set. Once this has been achieved, further experiments will be conducted to measure solution quality. These results will then be examined closely to highlight the differences be- tween local and global optima, with a view to de- veloping more efficient ways of getting from one to the other. Possibilities include improving phase 2 so that it is no longer limited to aggressive down- hill moves, a re-evaluation of the various parame- ters such as tabu list lengths, and the replacement of the best selection criterion by a ‘probabilistic best’ at appropriate points. It would also be inter- esting to examine the effect of the different move types by running the algorithm with and without

Table 4 Results cover 10 random number seeds for real and extended data

Data set Number of best solutions Number within 10% of best

1 2 3 4 5 6 I 2 3 4 5 6

Real 10 9 8 10 IO 5 10 10 10 10 10 8 Ext 2 3 4 10 10 3 6 10 I 10 10 10 10 Ext 3 9 6 1 5 6 7 4 10 10 10 10 9 Ext 4 4 2 1 4 2 3 10 10 IO 9 9 10

Page 13: Nurse scheduling with tabu search and strategic oscillation

each in turn. As the ultimate goal is a robust meth- od which performs well even on difficult problems, test data must be sufficiently comprehensive to cover such awkward cases. Finally, from a more academic view-point it would also be interesting to develop solution approaches based on other meta-heuristic techniques, such as evolutionary strategies, and to compare their behaviour with se- quential search strategies such as that described here.

9. Conclusions

The use of a local search strategy which sepa- rates the two parts of the cost function and uses oscillations to balance the search effort between them has been to shown to provide a good basis for tackling a difficult real-life optimisation prob- lem. The success in obtaining good feasible solu- tions was aided by the use of aggressive chain moves to ensure that the search visits many local optima with respect to both costs. As a result the role of the tabu list is considerably reduced over that common in more traditional tabu search im- plementations. Nevertheless, the short nurse tabu list was vital in stopping small cycles, and the day-night tabu list illustrates that if based on the right attributes, this type of memory can also be very effective at preventing cycling through regions of the solution space. This, together with the diver- sification strategy were important factors in ensur- ing the robustness of the algorithm over a variety of different data characteristics.

Given that the algorithm performs well for this particular problem it is interesting to consider how the approach might be used in the solution of oth- er similar problems. The problem tackled here is essentially a multiple-choice covering problem, with a single objective, the multiple choice con- straints given by Eq. (3) and the covering con- straints which are partitioned by grade. It is likely that an oscillation based approach would be beneficial for any similar problems in which the covering constraints are reasonably tight. However. the two types of chain moves used here do depend on the problem characteristics. The shift chain moves rely on each nurse having several

feasible patterns that differ from one another by a single shift, and the nurse chain moves rely on dif- ferent nurses having several patterns in common. However, in this case the freedom of both types of move is curtailed by the presence of different grades. Covering constraints involving more such subgroups are likely to render these moves less ef- fective and vice-versa. In terms of a successful search the chain moves in phase 1 are not vital. and merely serve to guide the search more quickly towards good solutions. However, if the covering constraints are tight some form of cyclic moves will be necessary in phase 2 order to make any moves within the feasible region.

A difficult feature of our problem is the division between days and nights. This was tackled using the balance correcting moves, the day-night tabu list and the day-night diversification strategy. Without this division these features would not have been necessary, and conversely if the patterns had been partitioned into more groups, similar, but slightly more complex strategies could be em- ployed.

Thus it is possible that some or all of the strat- egies employed here could be used successfully in the solution of a variety of covering problems. However, the precise mix of tabu search ingredi- ents used here is likely to be problem specific. One of the aims of this paper was to show how and why each of these ingredients was selected to gradually build an algorithm able to match the quality of solutions produced by a human expert.

Appendix A. Summary of the SO algorithm

The standard neighbourhood involves changing the shift pattern of a single nurse.

There are three tabu criteria: 1. A move involves the tabu nurse (i.e. the nurse

moved last time). 2. A move results in a tabu configuration on the

day-night tabu list. 3. The day-night counter exceeds tnusits and the

move does not change the day night split. Each time a move is made the nurse tabu list is

updated. If the move changes the day night split

Page 14: Nurse scheduling with tabu search and strategic oscillation

406 K. A. Dowsland 1 European Journal 01’ Operaiional Reseurch 106 (19%‘) 393-407

the day-night tabu list is updated the day-night counter is reset at 0 the lowerbound is calculated according to Eq. (6) maxits is set at 50 if bound <Z, 5 otherwise.

else the day-night counter is increased by 1

Step 0 (Initialise) Set Z= oo Find an initial solution by randomly allocating each nurse to a feasible shift pattern (i.e., one with the right number of shifts). Calculate the penalty cost from Eq. (1) and the covering cost from Eq. (4). Set both tabu-lists to be empty. Set day-night counter = 0. Calculate lower bound on day-night split. Do the following until limit moves have been ac- cepted without an improvement.

A.I. Phase 1

Step 1.1 (Random descent). If CC = 0 goto phase 2. Carry out random descent by accepting the first neighbourhood move that satisfies non- tabu conditions l-3 and improves CC and does not increase PC. Repeat until no satisfactory move exists.

Step 1.2 (Balance days and nights) Check for balance by Eq. (5). If neither days or

nights satisfy Eq. (5) goto 1.3. Attempt to correct the balance by selecting the best move satisfying non-tabu conditions 1 and 2 using a candidate list given by: 1. moves that reduce the shortfall on nights with-

out increasing that on days if nights are short; 2. moves that reduce the shortfall on days without

increasing that on nights if days are short. If no such move exists extend neighbourhood to

allow a night and day nurse to swap types subject to improving the shortfall in one type without in- creasing the other. If still not successful relax tabu status and repeat. Goto step 1.1.

Step 1.3 (Shift-chain moves). For each grade at- tempt to find a chain of moves from s,, to sanal using the shift-chain neighbourhood as described in Section 4.2 so that CC is reduced and PC does

not increase. If no chain exists go to step 1.4. Oth- erwise carry out moves on the chain updating the tabu lists each time. Goto step 1.1.

Step 2.4 (Nurse-chain moves). For each grade attempt to find a chain of moves from snow to ssnai using the nurse-chain neighbourhood as de- scribed in Section 4.2 so that CC is reduced and PC does not increase.If no chain exists go to step 1.5. Otherwise carry out moves on the chain up- dating the tabu lists each time. Goto step 1.1.

Step 1.5 (Move under-covering). Select the best move according to CC satisfying non-tabu condi- tions 1 and 2 from a candidate list given by moves that improve the cover for at least one shift (al- though making others worse). If no such move ex- ists goto 1.6 otherwise goto step 1.1.

Step 2.6. (Random kick). Randomly select a move satisfying non-tabu conditions l-3. Goto step 1.1.

A.2. Phase 2. Feasible solution jkmd. Search jbr improvement

Step 2.0. (Store details if best so far) If PC < Z then Z= PC. Store details of current solution.

Step 2.1. (Random descent). If there is no slack in the covering goto step 2.2. Carry out random descent with candidate list restricted to solutions with CC = 0 by accepting the first neighbourhood move that satisfies non-tabu conditions l-3 and improves PC. Repeat until no satisfactory move exists.

Step 2.2. (Shift-chain cycles). For each grade at- tempt to find a negative cost cycle of moves from snow to ssnai using the shift-chain neighbourhood as described in Section 4.2 If no such cycle exists go to step 2.3. Otherwise carry out moves on the cycle updating the nurses tabu lists each time (note the day-night tabu list will not change during this step) Goto step 2.1.

Step 2.3. (Nurse-chain cycles). For each grade attempt to find a negative cost cycle of moves from s,,~~ to sanai using the nurse-chain neighbourhood as described in Section 4.2. If no such cycle exists go to phase 3. Otherwise carry out moves on the cycle updating the tabu lists each time. Goto step 2.1.

Page 15: Nurse scheduling with tabu search and strategic oscillation

XA. Dowsland I Eurnpmn Journul of Oprrationul Research 106 (199X) 393 407 401

A.3. Phase 3 171

Step 3.1. (Search stuck - oscillate back into in- feasible region). Select the best non-tabu move ac- cording to PC. Goto Phase 1.

PI

References

[91

[lOI

[111

LIZI

[131

u41

[II

(21

[31

[41

[51

I61

E.S. Rosenbloom, N.F. Goertzen, Cyclic nurse scheduling, European Journal of Operational Research 31 (1987) 19- 23. N. Balakrishnan, R.T. Wong, A network model for the rotating workforce scheduling problem, Networks 20 ( 1990) 2542. F. Glover. C. McMillan. The general employee scheduling problem: An integration of MS and Al. Computers and Operations Research 13 (1986) 5633573. G.M. Thompson, A simulated annealing heuristic for shift-scheduling using non-continuously available employ- ees. Computers and Operations Research 23 (1996) 2755 288. M.J. Brusco, L.W. Jacobs. A simulated annealing ap- proach to the cyclic staff-scheduling problem, Naval Research Logistics 40 (1993) 69984. M.J. Brusco. L.W. Jacobs, A simulated annealing ap- proach to the solution of flexible labour scheduling problems. Journal of the Operational Research Society 44 (1993) 1191~1200.

K.P. Chow, C.K. Hui, Knowledge-based system for rostering. Expert Systems with Applications 6 (1993) 361 375. L. Gierl. B. Pollwein, G. Heyde, H. Kurt, Knowledge- based scheduling of duty rosters for physicians, Medical lnformatics 18 (1993) 3555366. F. Glover. M. Laguna, Tabu Search, in: C. Reeves (Ed.), Modern Heuristic Techniques for Combinatorial Prob- lems. Blackwell Scientific Publications. Oxford. 1993. pp. 70-150. J.M. Thompson. K.A. Dowsland, Variants of simulated annealing for the examination timetabling problem, An- nals of Operations Research 63 (1996) 105 128. K.A. Dow&and, Simulated annealing solutions for multi- objective scheduling and timetabling. in: V.J. Rayward Smith, 1.H. Osman. C.R. Reeves G.D. Smith (Eds.). Modem Heuristic Search Methods. Wiley. New York. 1996, pp. 155m 166. M.B. Wright, A fair allocation of county cricket oppo- nents. Journal of the Operational Research Society 43 (1992) 195-202. F. Glover, G.A. Kochenberger. Critical event tabu search for multi-dimensional knapsack problems, in: I.H. Osman J.P. Kelly (Eds.), Proceedings of the Metaheuristics International Conference. Kluwer Academic Publishers. Dordrecht (to appear). E.W. Dijkstra. A note on two problems in connection with graphs, Numerische Mathematik I (1959) 269- 271.