COMPUTERS
AND
BIOMEDICAL
RESEARCH
25,
417-434 (1992)
An Approach to the Generalized Nurse Scheduling Problem-Generation of a Declarative Program to Represent Institution-Specific Knowledge MIHOKOOKADA Department of Medical Information Science, Faculty of Medical Engineering, Suzuku University of Medical Science and Technology, 1001-l Kishioka-rho, Suzuka City, Mie 510-02, Jupan
Received August 2. 1991
An approach to the nurse scheduling problem is presented. The critical problem in nurse scheduling in a hospital is how to determine the day-to-day shift assignments of each nurse for a specified period in a way that satisfies the given requirements as much as possible, where the requirements differ greatly depending on the hospital. We present a method for constructing an agency-independent core procedure which can be tailored to the peculiar requirements of an individual hospital. As a basis, a formal analysis of the problem was performed. and a general scheduling procedure was established. Based on the method, a software system which produces a scheduling program for a given institution was developed. A declarative program that represents institution-specific information is generated through an interview with the user and incorporated into the general procedure. Some of the programming technicalities and an application of the system are also presented. Q 1992 Academic Pray.
Inc.
1. INTRODUCTION Great effort has been expended in the past in an attempt to computerize nursing personnel scheduling (I-IS). In scheduling nurses, a variety of factors, including the following, must be satisfied simultaneously: night shifts must be assigned to each nurse equally, individual preferences should be taken into account as much as possible, and a proportionate number of skilled and unskilled nurses must be attendant at any given shift. Many other staffing rules of individual hospitals must also be satisfied. Cyclical scheduling (1-4) has its own merits, but its applicability is very limited. Miller et al. and Warner et al. have applied mathematical programming models (.5-7), and Arthur and Ravindran and Musa and Saxena have proposed a goal programming model (8,9). Ozkarahan developed a methodology to obtain flexible work schedules through alternative mathematical models (10). Smith et al. adopted an heuristic approach to the problem (II, 12). Since there are many permissible solutions and it is very difficult to 417 OOlO-4809/92 $5.00 Copyright 0 1992 by Academic Press. Inc. All rights of reproduction in any form reserved.
WC also constder ihc hCuG\tlc define “the optimal solution” quantitatively. methods to be more appropriate for this problem than mathematical methods. and we developed a system which performs scheduling in a manual-like mannet (Ii). The common feature of the existing systems including ours is that the yyatem is designed for a particular institution. and the program is coded to meet the requirements peculiar to that institution. Although the manual scheduling procedure is rather similar among various hospitals, it is very difficult to transfer such a system to other institutions. since the details of the requirements differ greatly depending on the institution. One hospital, for example. allows ;I nut-se to work the night shift for 2 consecutive days, whereas another requires at least a i-day interval between two night shifts. It is also common to enforce certain shift sequences such as “night-evening” or “evening-night-day.” and so on. As for the team member composition, the requirement may be expressed as undesirable combinations by some institutions and as prefcrabie combinations by others. The requirements to satisfy individual preferences further complicate the problem. Since every major hospital has a problem scheduling it\ nurses. it is desirable to make a program institution-independent. but it is hardly possible to write a general scheduling program by building every possible requirement into the program codes since there are too many requirements for each individual hospital. As an alternative solution to the generalized nurse scheduling problem. we propose a method to construct an institution-independent core which can be tailored to the particular requirements of an individual hospital. With this approach, there is a single general procedure which has been established by applying the language theory, and the scheduling program for a given institution is constructed by incorporating institution-dependent knowledge into the general procedure. Based on this method, a software system has been developed using Prolog. The system generates a declarative program that expresses the institution-specific requirements through an interview with the user and synthesizes a scheduling program that is tailored to the user. In this paper. we present the method together with some of the programming technicalities of the deveioped system. An application of the system is also shown to demonstrate the practicality of the approach. 2. BACKGROUND
Nursing services are primarily provided on three shifts, i.e., nights, days, and evenings. Some institutions operate on more than three shifts, with the addition of mornings and late days being an example. The required shifts may also differ depending on the days of the week. Nursing personnel are generally classified as head nurses, nurses, associate nurses, and nurses’ aides, but an institution often uses its own skill categories for the scheduling purpose, such as “experience of less than 1 year, more than I year, and members who can execute leadership.” We call each shift a “task,” and if services are provided on n shifts on a given day, we say there are n tasks to which staff members must be
PROGRAMGENERATIONFORNURSESCHEDULING
419
assigned. Besides the tasks, nurses may take their days off or may be out on an official trip. We use the term “role” to represent any possible states in which a nurse may appear, and we say nurses are assuming roles even when they are taking their days off. Therefore, we consider each nurse to assume exactly one of the possible roles every day. Nurse schedules in a hospital are conventionally prepared by the head nurses of each nursing unit every month (or every 4 to 5 weeks). The types of constraints involved may be summarized as follows: (a) Constraints on the day-to-day sequencing of the roles a nurse may assume: Examples include the following: shifts must be assumed in the order of night, evening, and so on; a night shift should not be followed by certain specified roles; and a night shift may be assumed for as long as n consecutive days. These are called “constraints on role patterns.” (b) Requirements to satisfy individual preferences for days off or for particular tasks: Institutional requirements for assigning particular nurses to particular roles on specified dates are also called “individual preferences.” (c) Requirements concerning equality of workload, e.g., night shifts and Sunday/holiday services: These should be distributed equally among nurses monthly and annually. (d) Constraints on the team member composition: These are expressed in terms of the skill categories conventionally used. Typical examples include at least two experienced nurses must be in each team, at least one nurse from each category must be included, and a team should not always be composed of the same or almost the same members. It is assumed that nurses in different skill categories are not completely interchangeable. In the method presented, we consider only the scheduling within each nursing unit (adjustment of staffing across several units is not considered) so that one complete scheduling system should be prepared for each unit within a hospital. 3. ASET
OFROLE
SEQUENCESASA
LANGUAGE
We give two examples of constraints on role patterns. The first example is taken from (13) and the second from (14). EXAMPLE 1. Tasks consist of night, evening, and day shifts. (a) A night shift must be followed by an evening shift. (b) An evening shift should not be followed by a day off. (c) There must be at least a 3-day interval between two night shifts. EXAMPLE 2. Tasks consist of night, evening, day, late-day, and morning shifts. (a) An evening shift should not be followed by either a night, a day, or a morning shift the next day, nor should it be followed by a day off. (b) A day, late-day, and morning shift should not be followed by a night shift the next day. (c) Neither a night nor an evening shift may be assumed for more than 3 consecutive days.
420
MIHOKO
Otii\l),\
For simplicity. we assume that, besides the tasks. the poaxible roIc\ ~nciude only a day off and an official trip.
Let 2 denote the set of symbols which stand for the poss~blr roles. P’or example, let the roles ‘-night shift, evening shift. day shift. day off, and official trip” in Example I be denoted II, e, pi, o. !, respectively. Then we have \‘ = {II. C. d, o. t}. Day-to-day role sequences may then be represented as strings consisting of the symbols in 2:. In the formalism of the language theory t/h. 17). the set of all the possible sequences forms a language L. and L is specified by the grammar G corresponding to the constraints on role patterns. The language L specified by G is denoted L(G). The grammar is formally a 4-tuple G = {h:, 1, P, S,}. where N is the set of nonterminal symbols, P is the set of production rules, and S,, is a symbol in N called the starting symbol. \’ is the set of terminal symbols, and here it represents the possible roles. The grammar for Example 1 may be defined as G, = {N. C, P, S,}, where N = {S,, . S’, , S, . .S;). 1 = [ II. 6~. d, o, t}, and the set P consists of the production rules S,, -+ dS0 1OS,, 1tS,, 1t!Sl i E S, -
es,
& -
dSj / ts,
s, -+ dS” 1ts,, jos,, .
where 8 represents the null string (a string of length 0). Let 2:” denote the set containing all strings over 2: including E, and let 3 denote the relation such that 11,s;3 ~vuS~for 1%’E C’” and (I E 2 if and only if Sj - aSi is in P. A possible derivation sequence for G, is then represented as
3.2. Spec$c.atiorz oj’a Languclye
by Automatrr
We represent the constraints on role patterns as the specification of a language. A language L(G) is said to be right linear if each production in P of G is of the form S - \vS’ or S + H’, where S and S’ are the symbols in N and 11’is in C*, and the class of languages we consider here is right linear. To be incorporated into the scheduling procedure, the finite deterministic automata (16, 17) provide a convenient method for specification of a right linear language. A finite deterministic automaton (which we call “a finite automaton” henceforward) is a 5-tuple M = (Q, Z, 6. q,, F) where Q is the set of states, X is a set of permissible input symbols, 6 is the state transition function, y. is an element of Q and is the initial state of the finite state control, and F is the set of final states. Since the theory of the finite deterministic automata has been applied in a variety of application areas, precise definition of automata is omitted herein. As an
PROGRAM
GENERATION
FOR
NURSE
SCHEDULING
421
a
FIG.
1. Transition graph for (a) Example 1 and (b) Example 2.
example, the language L(G,) of Example 1 is specified by the automaton M, = (Q, ZZ, 6, qo, F), where Q = {qo, ql, q?, q3}, Z is the same as in G,, and the function 6 is defined as stq,, d) = qrJ, %q,,e)
%qo, 0) = 90,
= 427 @?2,d)
S(q,, d) = 40,
%q,, f) = 40,
= 937 %q,,O
= q3,
aq,,, n) = q, , Wq390) = 40,
6(q,, t) = 90.
The value of 6(q, a) for q E Q and a E IX is the state that M in state q enters into upon receiving an input symbol a. Since we consider only the finite deterministic automata, we write S(q, a) = q’ instead of a((], a) = (4’). We let q. be the only final state; that is, F = {qo}. The language L defined by M is denoted L(M), and for the example above, we have L(G,) = L(M,). L being a right linear language and L being a finite automaton language are equivalent, and the set of role sequences can always be specified by a finite automaton. An automaton is pictorially represented by a transition graph. Figure 1 shows the transition graphs for Example 1 and Example 2, where the nodes are labeled by the names of the states, and the final state is circled. There is an edge from the node qi to qj if there is an element a in C such that 6(q,, a) = qi, and the edge (q;, qj) is labeled by the list of such elements of C as u. 4. TRANSITION
4.1. Procedural
Interpretation
GRAPH FOR SCHEDULING
CONTROL
of State Transition
We use finite automata as a means to control and generate possible role sequences. The general scheduling procedure can be described in terms of a transition graph as follows. Assignments proceed on a day-to-day basis. At the beginning of a day, each staff member stays in one of the nodes. Let s denote a staff member in the node qi. The roles that s may assume today are listed on the labels of the outgoing edges of 4;. If the role r is assigned to s, s traverses
322
MIHOKO
Oti.4D.A
an edge whohe label contains Y. When the role i> tinishcd, .) U-I-ICC\ at the ncx[ node and waits for the next day’s assignment. If the node c,, hax (ml), one outgoing edge with a single role on it, members in (1, are enforced to tahe that role. Otherwise, some decision has to be made ;I\ to w/hich role the). should take. Thus if we consider the set of possible role sequence< ;I\ a Ianguagc 1.. the transition graph is used to control generation of the element\ of‘ 1..
We represent individual preferences as constraints on strings that represent role sequences to be generated. Let M = CQ, X:, 6, yo, {q,]) be an automaton representing given constraints on role patterns. The grammar G that specifies the language L(M) can be constructed from M in the following way (16 ). Let G = (Q. X:, P, q,J, where P is defined a$ follows: (i) if 6 (y, ~1) = y’. then P contains y --j cry’. (ii) q. ---f E is in P. Assume that a role I’ is assigned to a staff members today, and s prefers a role 1.’ k days later for k 2 0. If s prefers 1.’ today (h = 0). the preference of s is satisfied if I’ = 1.‘. For /C2 1, let =$/, denote the k-fold product of the relation 3. Let q be the state that s enters into by assuming Y. Then today’s assignment is consistent with s’s preference if q +r ~~r’q’ holds for some string M’ of length (I; ~ 1) in X:” and some state 4’ in Q. Let 6,\ be the relation defined as (/6,1.’ if and only if q 3,: MY’CJ’, and let M, be a matrix representing 6,; i.e., the rows and columns of ML are the states and input symbols. respectively, and the entry CL/(,‘;) is I if yi6nr, holds and 0 otherwise. We may state then, ifs enters into y, by today’s assignment, s may assume role Y,k days later if (qi, Y;) of M,! is I. and may not if it is 0. We show how ML (k = I, 2, . .) can be computed using Example I. Let A be the adjacency matrix of the transition graph and let A”’ be the rnth power of A, where each nonzero element is replaced by a I. Table I shows AI-A’. The (i,j)th entry of A”’ is I if qi is reachable from yi in tn moves. M, represents the function 6, and for k = 2, 3, , we have M, = A”~ “M,. Table 2 shows M,-M5, where each nonzero element is replaced by a I. In this example, ML contains no zeros for /i GZ5. We may state therefore that we need to check the preferences only within 4 days hence. Table 3 shows Al-A’ and Table 4 shows M, , Mz for Example 2. Here. M, contains no zeros for X 2 2: therefore, only the preferences of tomorrow need to be verified. We now consider how far ahead in general we need to look today to satisfy individual preferences. Let N be the number of states in a given automaton M. We may assume that the transition graph of M is strongly connected. If some state qi has a self-loop (an outgoing edge which comes into yi) and m other outgoing edges, entries of the ith row of A” becomes all ones for some II 5 (N - m) and zeros will never appear in the ith row of A to the power greater than II. Since for every other state qj there is a path from qj to q, of length less than or equal to CN - I ). entries of A become all ones for some II’ 5 N - ~11+
PROGRAM
GENERATION
TABLE POWERS OF A’
40
YI
42
0
Yo
1
1
q,
0
0
q: q3
0 1
0 0
THE
ADJACENCY A’
Y3
0
YO
40
423
FOR NURSE SCHEDULING 1 MATRIX 41
1
1
FOR EXAMPLE
I
41
4,
A’
%
YI
42
43
1
0 1 0 0
Yo q, 42 q,
1 1 I I
1 0 1 1
1 0 0 I
1 0 0 0
1
0
q,
0
0
0
0 0
1 0
42 q3
I 1
0 1
0 0
(N - 1) and zeros will never appear in A to the power greater than n’. For PZ’ 2 2, ML must be computed for k = 1, . . . , H’ - 1, and preferences should be checked for as long as (n’ - 1) days hence. If the graph contains no selfloop, which occurs if no role may be assumed repeatedly without restriction, preferences must be checked over the entire period concerned. We are not sure, however, whether such constraints are realistic, and even if so, the constraints are incompatible with the requirement to satisfy individual preferences. We assume, therefore, if individual preferences should be considered, the transition graph contains at least one self-loop.
TABLE M,
MATRICES
M,
,I
Yo
1 0 I 0 1000 0 0 1 00111
41 q? 43
r
d
2
TO MT FOR EXAMPLE
1
o
t
Mz
,I
e
d
o
t
M,
n
e
d
o
t
1
I
I 0
I I
I
I
I
I I 00111 I 0 1 1
1
1
q” ql Y? Y?
I
1
1 1 0 0 00111 I 0
1 1
0
q,, ql qz q3
1 1
I 1
I I
M4
II
c
d
o
t
q,, q, q2
I I I 1
1 0 1 I
I I I I
1 I I 1
1 1 1 1
q’
M,
n
E
d
o
I 1 1 1
I 1 1 1 1 1 1 1
40
I
I
q,
I
I
qz q’
1 1
1 1
I
(II
1
4!
I 1 I I
Y1 c/j yj
I I I I I
I I I I I
I 1 I I I
1 I I I I
I I I I I
5. BEST TEAM MEMBER SELECTION WITH MULTIPLE CRITERIA
Each day, appropriate members must be assigned to each task. We determine the members by taking one task after another in such a manner that a task with severe constraints comes first. If the task t requires n members and there are more than n candidates (those who are in the nodes with an outgoing edge whose label contains t), we select the best one, then the next best. and so on, until all n members are selected. At each selection step, the best one is determined in connection with those who have already been selected. Besides role patterns, requirements involved in the selection fall mainly into the folIowing categories: individual preferences, equality of workload, and team member composition. Generally, there are multiple requirements in each category, and
TABLE4 MATRICES M, Yu
41 yz yJ ;t
M, TO b4? FOR EXAMPU
2
n
c
d
tn
I
o
t
M2
II
c
d
,,I
I
o
I
1 I 0 0 0 0
I I I I 0 0
I I 0 I I 0
I I 0 I I 0
I I I I 1 I
I I 0 I I 0
1 I I I I I
Yn Yi yz yq y4 Yc
I I I I I I
I I I I I I
I I I I I I
I I I I I I
I I I I I I
I I I I I I
I I I I I I
PROGRAM
GENERATION
FOR
NURSE
SCHEDULING
425
they must be counted separately. For example, a preference for an official trip and a preference for a day off must be considered as separate requirements. Given the multiple requirements, we define “the best member(s)” among the candidates. For a given task C, preference for one member over another is determined by certain properties of individuals, and if k requirements req,, . . . , req, are involved, we have corresponding k properties prop,, . . . , prop,. For each req, (i = 1, . ..) k), we define the relations “is preferred to (denoted >J” and “is equivalent to (denoted = i)” among the members. For a member s, let prop,(s) denote the value of prop, of s. If prop, is numerically measurable, the relations >i and = i are defined by numerical comparison. For example, suppose reqi says that a task t should be assigned equally to each nurse. Let prop,(s) denote the number of times that s worked t in the past. Then for two given members s and s’, >i and = ; may be defined as S >iS’
if prop,(s) < prop@‘),
s =;s’
if prop,(s) = prop,(s’),
where < and = denote the numerical comparators “less than” and “equal to,” respectively. There is a special kind of requirement for some tasks; i.e., “a team working the task should not always be composed of the same or almost the same members.” For this requirement, we use a numerical measure which represents the closeness of a candidate to a group of members selected thus far (this measure was defined in (I.?)), and the requirement can be treated in the same way as described above. There also are properties which hold true or false for a given individual. In this case, the value of propi is either true or false. For example, if reqi says that an individual who prefers the task t should be assigned to it preferentially, then prop,(s) is true if s prefers t today and false otherwise, and the relations >, and =; may be defined as S >;S’
if prop,(s) is true and prop,(s’) is false,
S =iS’
if prop;(s) and prop,(s’) are the same.
Assume that the requirements req, , . . . , req, are given in the order of relative significance among each other (from more to less significant). We determine the best member(s) among the candidates using the preferability relation >. which is defined as s > s’
if s >i s’, or if s = i s’ for i = 1, . . . , 1 - 1 and s >, s’ for some 1 between 2 and k.
We may assume naturally that the relation >i for i = 1. . . . , k is transitive; i.e.. ifs >; s’ and s’ >i s” for members s, s’, and s”, then s >; s” holds. Then we can show that the relation > is also transitive; i.e., for any members s, s’, and s”, s > s’ and s’ > s” imply s > s”. (The proof is omitted.) From the transitivity
326
MIHOKO
OKAl)A
of >, the best member(s) can be determined unique, the choice is arbitrary). 6.
DI~C’~L.OP~~EN~T
ol=
con\tstently
A SOF-rWI\Kt>
susi-t
crt’ the l-test one IX not
M
We developed a software system in Prolog (18) which produces a scheduling system tailored to the requirements specified by a user. The operation of the system is performed interactively either in the interview mode or in the scheduling mode. In the interview mode. the user specifies the objects involved (nurse categories. types of shifts, types of days off. etc.). the required shifts for each day of the week, the required staff composition for each shift, the constraints on role patterns, types of individual preferences to be taken into account. shifts that should be distributed equally. and so on. The user also specifies the significance rating for each of the requirements. From the given information, the system composes a declarative program and registers it with its identification. In the scheduling mode. the user specifies the identification of the declarative program and then he or she may perform enrollment or deletion of the staff members. generation of a schedule, manual modification of the generated schedule, display of the statistics (the number of times each member worked the shifts), and so on. The available operations in the scheduling mode are almost the same as those in our previous system (13). 6.2. Declaration
of Constraints
on Role Patterm
In the interview mode, the user specifies the constraints on role patterns using the following notation, where the symbol r with a subscript or a superscript denotes a role: (format I)
r,or’..orrl;.
(format 2) 1.’ z=> . . . ==> 1.“’ ==> j’, or . . orrk, A statement in format 1 declares that “the roles r, . . ‘;( may appear regardless of the preceding roles and would not impose any restrictions on the subsequent roles.” In format 2, the rightmost symbol ” ==>” is read as “if the roles on the left-hand side r’ . . . r’” appear in this sequence consecutively, then only one of the roles r, , , y/Lmay follow immediately.” An element of the left-hand sequence ri (I 5 i 5 ml may be a list of roles rit or . . . or ru when the roles gl . . . rij are equivalent in terms of the restrictions imposed. For Example 1 and Example 2, the constraints may be specified as shown in Fig. 2. From the given constraints, the system generates a transition graph (transition function) and the matrices ML’s (defined in Section 4) and stores them in the declarative program. The generation of a transition graph from the declared constraints is performed in the following steps. We assume each element on the
PROGRAM
GENERATION
FOR NURSE SCHEDULING
427
a day or off or trip. night==>evening. night==>evening==>day night==>evening==>day
or or
trip. trip==>day
or
Off
or
trip.
b off day
or trip. or morning or late ==>evening or day or morning or late or off or trip. evening==>evening or late or trip. night==>night or evening or day or morning or late or off or trip. evening==>evening==>late or trip. night==>night==>day or morning or late or off or trip. night==>evening==>late or trip. FIG. 2. Declaration of the constraints on the role patterns for (a) Example 1 and (b) Example 2.
left of ==> is a single role. (The process is the same if a list of roles is specified instead.) (1) The initial state qOwith a self-loop is created, and the list of roles given in the statement in format 1 is placed on the loop as a label. (2) For each statement of length 2, “Y ==> rl or . . . or rL,” a new state q is created and an edge with label Y is set from q. to q. For each rj (j = 1, . . . , k), a new state qj is created and an edge with label yi is set from q to qj. Then the statements of length 3, 4, and so on, are similarly processed. In general, when the statement of length (RI + l), “Y’ ==> . . . ==> Y”’ ==> r, or . . . or rk,” is processed, there must be a directed edge sequence of length m from q. to some state 4 where the ith edge contains ri on its label for i = 1, _. . , m. Then for eachofrj(j = I, . . . . k), a new state qj is created and an edge with label rj is set from q to qj. (3) All the states with no outgoing edges are identified. They are merged into q. or into those states to which there is an edge directed from qo. (4) The minimization is performed on the automaton thus far generated. Given a finite automaton M, it is always possible to find the smallest finite automaton equivalent to M. The proof and the algorithm are found in the literature (e.g., (16)). Since no inaccessible states are created by the above procedure, we only need to merge all redundant states. The merging proceeds as follows. The set of all the states is partitioned into equivalence classes such that each class contains indistinguishable states and is as large as possible. Then, one representative is chosen from each equivalence class as a state for the reduced automaton. (5) Finally, the obtained states are renamed q. , q1, q2, . . . (for readability only). The transition functions representing the graphs in Fig. I were generated by this procedure from the declared statements in Fig. 2.
428
MIHOKO OKADA
The selection of the best team member(s) for a given task (defined in Section 5) is performed in Prolog in the following way. For the ith requirement. a pair of relations >, and =, is expressed as a rule (a clause) with the conclusion part “precede (X. Y),” meaning X is preferred to Y. For example, if a nurse with less value of prop, is preferred for the ith requirement, then :>i and = / may be defined in Prolog as precede(X, Y):propi(X, N), propi(Y, M), (N < M, !; N > M, !. fail; fail). where “propi(X, N)” retrieves the value N of the propi for a nurse X. If there are k requirements involved in the selection, the relation > is defined by k such rules which bear the same conclusion part “precede (X. Y 1” and the conditions representing the respective requirements. The set of rules which define the relation > is determined during the interview session. The system composes each rule using some templates and stores it in the declarative program as a statement which might appear as Task on Day: #8: precede(X, Y):propi(X, NJ, propi(Y, M), (N < M, !; N > M, !, fail; fail). where “on,” “:.” and “#” are Prolog operators defined in the system. “#8” represents the significance rating given by the user (the rating is specified as a number between 1 and 10, where a larger number denotes greater significance). “Task on Day,” where “Task” and “Day” are Prolog variables, indicates that this rule is applicable to any task on any day of the week. If this rule is applicable only to the night shift on Sunday, for example, “night on sunday” appears instead of “Task on Day.” When the scheduling is performed in the scheduling mode, the relation > for a given task on a given day of the week is defined by asserting the applicable rules in the order of significance rating. Since the requirements may differ depending on the tasks and the days of the week, the relation > is redefined on each day for each task. 7. SYSTEM PERFORMANCE 7. I. Environment
The system is being tested at present in collaboration with some hospitals. the system performance, we show the results obtained by performing the scheduling for a 5-month period for one unit of Toyama Medical and Pharmaceutical University Hospital. The system used here is written in IFProlog (Interface Computer Japan, Ltd.) and runs on Macintosh II. The staff members at this unit consist of the head nurse, two nurses who can To demonstrate
PROGRAM
GENERATION
FOR
NURSE
SCHEDULING
429
execute leadership (called the leaders), eight skilled nurses, six unskilled nurses, and one nurses’ aid. (The head nurse and nurses’ aid are not included in the scheduling.) The unit runs basically on three shifts, i.e., night, evening, and day. There is also a late-day shift on weekdays. The required staff members for each shift are as follows: (a) Every day, two nurses (at least one must be a leader or a skilled nurse) must be assigned to the night shift and evening shift, respectively. (b) As for the day shift, at feast seven nurses must work on Monday through Friday, at least five nurses must work on Saturday, and exactly five nurses must work on Sundays and holidays. At least three must be leaders or skilled nurses on Monday through Friday, and at least two must be leaders or skilled nurses on Saturdays, Sundays, and holidays. (c) One nurse must be assigned to the late-day shift on Monday through Friday. Besides the assignments to the shifts, one day off must be given to each member every week. The requirements involved in scheduling are as follows: (a) An evening shift should not be followed by either a night shift or a day off. (b) A night shift should not be followed by a night shift. (c) A night shift should not follow a day off. (d) The day-to-day shift sequences of “evening, day, night” and “day, night, day, night” are prohibited. (e) The night shifts, evening shifts, late-day shifts, and shifts on Sundays and holidays should be assigned to each nurse as equally as possible, every month, every year. (f) Night shift assignments should preferably, though not necessarily, be evenly distributed over each day of the week for every nurse. (g) Individual preferences for annual days off, particular shifts, official trips, etc.. should be satisfied as much as possible. (h) Each staff member should obtain the experience of working with as many different members as possible for the shifts where a team consists of a few members. There are more factors that were taken into account, but they are omitted here. 7.2. Result The declarative program was composed for the unit and the scheduling was performed on an experimental basis. When the produced schedule was not satisfactory, the problems were analyzed and the declarative program was modified; e.g., the declaration of constraints on role patterns was corrected and new rules were added. The system programs (the procedural parts) were also slightly modified to eliminate some inconveniences to the users which occurred during system operation. With the declarative program thus obtained, the sys-
Suruki. Ikarashi. Yagami.
A. M. Y.
IIO. K. raniguchi. Sate. R. Kameda. Takeda.
M. Y. N.
Saito. M. Takahashi.
E.
Yamada, T. Oota. N. I~Amura. A. Shimizu, K. Aoki, M. Taniyama. M.
D>lS;
Off
Evening
Ihi\
Day Day Off
Night Night Late
Day Day Day
Vff Off IL)
Off Day Evening
Evening Day Day
Day Night
I):ty Day Da)
Night Off
Evening Day
Evening Off
Day Day
Off Night Off
Day Day Day
Off Day
Day Day
Day Late Dal) Day Evening Night
Lctrvc Day Day Day
Iki> Evening Night Da! Evening Late Day Day Night
tern was applied to the unit. Individual preferences were entered and the schedules were generated month by month. The following are the results of a 5-month period, from December 1990 to May 1991. One week of the schedule generated for January is shown in Table 5 as an example, where the first two nurses are the leaders, the next eight are skilled nurses, and the rest are unskilled nurses (the names are fictitious). in the table, “off” stands for an assigned day off and “leave” for an individual preference of an annual day off. The entries corresponding to the individual preferences are italicized. During the 5-month period, 34 individual preferences in all were entered. (All the individual preferences were either for day shifts or for days off and no other types of preferences occurred.) There were no violations of individual preferences and constraints on role patterns in the scheduled period. Table 6 shows the statistics of night shift assignments after a 5-month run. It is shown that the total number of night shift assignments is distributed evenly among members. The differences in the numbers of these assignments between two nurses never occurred more than twice a month. It is also shown that the night shift assignments are evenly distributed from Sunday through Saturday for each member. 8. Drscuss~o~
AND CONCLUSION
The preceding has been a presentation of an approach to the nurse scheduling problem. Various types of constraints are involved in the scheduling problem. and among them, constraints on role patterns and individual preferences are two of the most important factors which often conflict with one another. We made a formal analysis of the problem, and by applying the language theory.
PROGRAM
GENERATION
FOR TABLE
THE
Suzuki, A. lkardshi, M. Yagami, Y. Ito, K. Taniguchi, M. Sato. R. Kameda, Y. Takeda, N. Saito. M. Takahashi, E. Yamada. T. Oota. N. Tamura, A. Shimizu, K. Aoki. M. Taniyama. M.
NUMBER
OF NIGHT
SHIFTS
NURSE
431
SCHEDULING
6 ASSIGNED
TO EACH MEMBER
SUIl
Mon
Tues
Wed
Thu
Fri
Sat
Total
2 I 3 3 2 2 2 2 3 3 2 3 3 2 3 4
3 3 4 2 2 2 2 3 2 0 2 2 1 3 1 2
3 2 1 3 2 2 3 2 I 4 3 2 2 2 3 1
1
2 2 1 3 3 3 2 3 2 3 2 3 3 2 2 2
3
3 2 3 3 3 2 3 3 2 3 2 2 3 2 3
3 3 3 I 2 3 3 2 3 2 2 3 3 2 3 2
17 17 17 17 17 17 16 17 17 17 16 17 16 16 16 16
3
3 2 3 ?i -I 2 3 3 2 2 2 2 2 2
we established a general procedure which controls the generation of the role sequences under given constraints on role patterns where individual preferences are reflected as constraints on the role sequences. With such a formal treatment of the problem, we were able to show how the two conflicting factors could be treated simultaneously. A software system which allows the user to declare the institution-specific requirements involved in scheduling was developed. In the interview mode, the user specifies the constraints on role patterns using the notation provided. To specify the scheduling convention appropriately is not a task for the untrained user, since the conventional constraints are not well organized, and the convention cannot be expressed directly in the system notation. We assume, therefore, that potential users of the interview mode are computer professionals trained to extract the appropriate information from the scheduling managers and express this in system notation. We consider our assumption reasonable since in order to computerize scheduling the requirements must be analyzed with the aid of a computer specialist. Furthermore, the use of the interview mode is very infrequent (generally, once per nursing unit). The scheduling mode, on the other hand, is designed for medical personnel who may not be familiar with computers. In connection with the constraints on role patterns, we should take note of the problem of circadian rhythms and shift work. A large number of studies have been made on the effects of shift work on people’s well-being and health (f9-28), and there is now convincing evidence that biological clocks reset with difficulty (21, 22) and long-term exposure to variable work schedules results in an increased risk of various disorders, including sleep disorders, gastrointestinal
illness, cal-diovascuiwrdisease. and reproductlvc dysl’unctron in ~omcn (.?.i--3: i It has been shown that work schedules which take into xxount the propcrl~c‘~ of the human circadian rhythms improve the performance and well-being r)t rotating shift workers. According to circadian principle<. work schedules tha! rotate should do co by successive phase delay\. that iy. they hhouid be in the direction of lengthening the worker’s day (c.g., ;I day worker vbouid move to evenings, a night worker to days), and the interval between phase shifts should be as great as i5 practical (27). In the system we presented. there ih no built-in mechanism or principle for avoiding the generation of shift sequences which are against human circadian rhythms. It is entirely up to the users (the clinical institutions) to determine the shift sequences that the system generates. It is suggested then that the users analyze implications of circadian rhythms for their scheduling convention carefully and design the constraints on role patterns to incorporate circadian principles. when possible. Given multiple requirements, a method for determining the bexr team member(s) for a given task was presented. Each requirement is represented as a binary relation (a rule in Prolog) which determines. for two given nurses. whether one is preferred over the other. This representational scheme makes it possible to control the requirements with significance ratings relative to each other which may differ from day to day and from task to task. We assumed that the values of the properties concerned with each requirement are either numerical or true-false. There may also be properties such that comparison\ of nurses can be made only subjectively. In this case. we assume that consistent ranking of nurses is obtainable, and under this assumption. a subjective rank can be treated as a numerical value. In the current system, only one rule of this type can be defined. To demonstrate the system’s performance. we presented the scheduling resuits for a S-month period in one unit of a hospital with which we collaborated. During the period, all the requirements, including individual preferences. constraints on role patterns, composition of staff members, and equality of workload, were satisfied. There was, however, only a moderate number of individual preferences (of only two types) during the scheduled period. To validate the method, the system should be run at a sufficient number of clinical institutions with different types of constraints for a sufficient period of time. since the significance of the method is in its generality. We are currently testing the system in collaboration with some hospitals. We will investigate the problems that may occur in a true clinical environment (including organizational and human factor implications) and present the results in a future version of our work. We conclude that the proposed approach provides a strong basis for a solution to the generalized nurse scheduling problem. ACKNOWLEDGMENTS ‘The author i\ grateful to Dr. Masahiko and Ms. Chizuko Yamaguchi. the director Medical and Pharmaceutical University.
Okada for his helpful discussion and Ms. Mitsue Horii and the vice director of the Nursing Division of Toyama for their collaboration in the system application.
PROGRAM
GENERATION
FOR
NURSE
433
SCHEDULING
REFERENCES
1. HOWELL, J. P. Cyclical
scheduling of nursing personnel.
J. Am.
Hosp.
Assoc.
40, 77
(1966).
8.
MAIER-ROTHE, C., AND WOLFE, H. B. Cyclical scheduling and allocation of nursing staff. Socio-Econ. Phn. Sci. 7. 471 (1973). AHUJA, H., AND SHEPPARD, R. Computerized nurse scheduling. Znd. Eng. 7, 24 (1975). SMITH, L. D. The application of an interactive algorithm to develop cyclical rotational schedules for nursing personnel. INFOR 14, 53 (1976). WARNER, D. M., AND PRAWDA, J. A mathematical programming model for scheduling nursing personnel in a hospital. Munuge. Sci. 19, 411 (1972). MILLER, H. E., PIERSKALLA, W. P., AND RATH, G. J. Nurse scheduling using mathematical programming. Oper. Res. 24, 8.57 (1976). WARNER. 0. M. Scheduling nursing personnel according to nursing preference: A mathematical programming approach. Oper. Res. 24, 842 (1976). ARTHUR, J. L., AND RAVINDRAN, A. A multiple objective nurse scheduling model. AIIE Trans.
9.
MUSA, A. A.. AND SAXENA, U. Scheduling nurses using goal-programming
2.
3. 4. 5. 6. 7.
13, 55 (1981). Truns.
techniques. IIE
16, 216 (1984).
IO. OZKARAHAN, I. A disaggregation model of a flexible nurse scheduling support system. SocioEc,on. Plan. II.
Rev.
Sci. 25, 9 (1991).
L. D., AND WIGGINS. A. A computer-based nurse scheduling system. Comput.
SMITH,
Ops.
4, 195 (1977).
12. SMITH, L. D., WIGGINS, A.. AND BIRD, D. Post implementation experience with computerassisted nurse scheduling in a large hospital. INFOR 17, 309 (1979). 13. OKADA. M.. AND OKADA, M. Prolog-based system for nursing staff scheduling implemented on a personal computer. Cornput. Biomed. Res. 21, 53 (1988). 14. SIGEMURA. Y., BABAZONO, M., SAKAI. J., et al. A study of designed nursing subsystem by computer under THINK. In “Proceedings, 5th Joint Conference on Medical Informatics (JCMI). Tokyo, Japan 1985,” pp. 83-86. 15. ANZAI. M.. AND MIURA, Y. Computer program for quick work scheduling of nursing staff. Med.
If.
12, 43 (1987).
16. AHO, A. V.. AND ULLMAN, J. D. “The Theory of Parsing, Translation, and Compiling. Vol. 1. Parsing.” Prentice-Hall. Englewood Cliffs, NJ, 1972. 17. HOPCROFT, J. E., AND ULLMAN, J. D. “Formal Languages and Their Relation to Automata.” Addison-Wesley, Reading, MA, 1969. 18. BRATKO. I. “Prolog Programming for Artificial Intelligence.” Addison-Wesley. Reading, MA, 1986. 19.
DAHLGREN, K. Temporal patterns in psychophysiological activation in rotating shift workers-A follow-up field study one year after an increase in nighttime work. Stand. J. Work Environ.
Healrh
7, 131 (1981).
20. MINORS, D. S.. AND WATERHOUSE, J. M. Circadian rhythms in deep body temperature. urinary excretion and alertness in nurses on night work. Ergonomics 28, 1523 (1985). 21. MOORE-EDE, M. G.. CZEISLER, C. A., AND RICHARDSON, G. S. Circadian timekeeping in health and disease. Part 1. Basic properties of circadian pacemakers. N. Engl. J. Med. 309,469 (1983). 22.
MOORE-EDE, M. G., CZEISLER, C. A., AND RICHARDSON,G. S. Circadian timekeeping in health and disease. Part 2. Clinical implications of circadian rhythmicity. N. EngI. J. Med. 309, 530
23.
BAKER, D. The use and health consequences of shift work. Inf. J. Health
(1983). Sew.
10, 405
(1980).
GUILLEMINAULT, C., CZEISLER, C., COLEMAN, R., AND MILES, L. Circadian rhythm disturbances and sleep disorders in shift workers. Kyoto Symp., EEG Suppl. 36, 709 (1982). 25. LADOU. J. Health effects of shift work. West. J. Med. 137, 525 (1982). 24.
334
MIHOKO
Ok;.\II.\