Solving Employee Timetabling Problems by Generalized ... - CiteSeerX

12 downloads 38764 Views 100KB Size Report
store, or assignment of phone operators to stations in a service-oriented call-center. A task in the ... Instead of assigning employees to duties, each in a single ...
Solving Employee Timetabling Problems by Generalized Local Search Andrea Schaerf1 and Amnon Meisels2 1

Dipartimento di Ingegneria Elettrica, Gestionale e Meccanica, Universit`a di Udine, Via delle Scienze 208, 33100 Udine, Italy 2 Department of Mathematics and Computer Science Ben-Gurion University of the Negev, Beer-Sheva, 84-105, Israel

Abstract. Employee timetabling is the operation of assigning employees to tasks in a set of shifts during a fixed period of time, typically a week. We present a general definition of employee timetabling problems (ETPs) that captures many real world problem formulations and includes complex constraints. We investigate the use of several local search techniques for solving ETPs. In particular, we propose a generalization of local search that makes use of a novel search space that includes also partial assignments. We describe the distinguishing features of this generalized local search that allows it to navigate the search space effectively. We show that, on large and difficult instances of real world ETPs, where systematic search fails, local search methods perform well and solve the hardest instances. According to our experimental results on various local search techniques, generalized local search is the best method for solving large ETP instances.

1

Introduction

Employee timetabling problems (ETPs) form a very large family, arising in the diverse commercial world of today. ETPs involve an organization with a set of tasks that need to be fulfilled by a set of employees, each with her/his own qualifications, constraints and preferences. The organization usually enforces some regulations and attempts to achieve global objectives such as lowering the overall cost, or an equitable division of work among employees. Examples of employee timetabling problems include assignment of nurses to shifts in a hospital, assignment of workers to cash registers in a large store, or assignment of phone operators to stations in a service-oriented call-center. A task in the context of ETPs is performed during a predefined time period called a shift. Shifts are fixed in time and the term timetabling employees refers to a process of assigning employees to tasks in shifts. Instead of assigning employees to duties, each in a single weekday, the present model assigns employees to tasks in shifts, where shifts can reside anywhere on the time axis [7]. It is a common view that one major difference between ETPs and generic timetabling problemsis the presence of specific complex constraints due to labour regulations (see e.g., [6, 7]). We propose a generalization of local search that makes use of a novel search space composed by partial and full assignments. Generalized local search aims at reconciling local search with non-systematic constructive search, and it is inspired by various previous approaches to combine them, such as those in [5, 11]. Several aspects of local search have to be reconsidered in this generalized version in order to make it working

effectively. We describe its novel features and we prove experimentally their impact on the performance of search. We show that, on large and difficult instances of real world ETPs where systematic search fails, local search methods perform well and solve the hardest instances. According to our experimental results, generalized local search is the best method for solving large ETP instances. The paper is organized as follows. Section 2 introduces the definition of ETPs. Section 3 presents local search and shows how it is applied to ETPs. Section 4 illustrates our generalized local search proposal. Section 5 presents experimental results. Section 6 proposes some variants of our techniques and other ones that we implemented for comparison. Finally, Section 7 discusses related and future work.

2 Employee Timetabling The Employee Timetabling Problem consists of the (weekly) assignment of employees to tasks in shifts with fixed start and end times. We consider here a search problem formulation. Other variants of the ETP have been proposed in the literature, which also involve an objective function to minimize. There are m employees E1 ; : : : ; Em , n shifts S1 ; : : : ; Sn , and t tasks T1 ; : : : ; Tt . We search for an assignment, which can be defined as a 3-dimensional binary matrix Xmnt , such that xijk = 1 if employee Ei is assigned to task Tk in shift Sj . The constraints that X is subject to are the following. Requirements: Each shift Sj is composed of a number of tasks, some of them multiple times. An employee is needed to be assigned for each task belonging to Sj . It is given a non-negative integer matrix Rnt , called Requirements matrix, such that Rjk denotes the number of occurrences of task Tk in shift Sj , which corresponds to the exact number of employees that must be assigned to task Tk in shift Sj . Ability: Each employee has qualifications that enable her/him to fulfill certain types of tasks; that is, each employee Ei has a set of tasks fTi1 ; : : : ; Tir g that Ei can be assigned to. The qualification matrix is a binary matrix Qmt such that Qik = 1 if employee Ei qualifies for task Tk , Qik = 0 otherwise. Availability: There are personal preferences of employees, which restrict them to be assigned only to subsets of the shifts. These constraints are represented by a binary matrix of availabilities Amn , where Aik = 1 if employee Ei is available for shift Sk and Aik = 0 otherwise. Conflicts: Obviously, an employee cannot be assigned to more than one task in the same shift. In addition, employees cannot be assigned to two shift that are in conflict with each other. Sources of conflicts could be different: overlap in time, consecutive, or combinations that are forbidden by organizational rules. Conflicts may vary for different employees (because of different contracts) and are described by a 3dimensional binary Conflict matrix Cnnm , such that if ijk = 1, then employee Ek cannot be assigned to both shifts Si and Sj . Workload: There is an upper and lower limit on the number of tasks that each employee can be assigned to. There are actually a set of limits, because employees can be assigned to a limited total number of tasks per schedule and also to a limited (smaller) number of specific assignments. We therefore define a set of shift

sets G1 ; : : : ; Gs , each one grouping shifts of a specific kind. Then, we define two integer-valued matrices Vms and Wms such that employee Ei must be assigned to at least Vik and at most Wik shifts of group Gk . The problem is to find any assignment that satisfies all of the above constraints (for the sake of brevity, we omit the mathematical definition). Other definitions include also soft constraints that constitute the objective function (to be minimized). Soft constraints generally regard fair distribution of loads for employees. For example, when a nurse is assigned to two Night Shifts, it is considered much better to have them spread evenly over the week (e.g., at least two free nights in between).

3

Local Search

We now propose a local search solution to ETP. First, we introduce the general localsearch framework, then the search space and neighbourhood structure of ETP. Finally, we define the cost function and several move selection methods for searching the space. 3.1 The Local Search Framework Given an instance p of a search problem P , we associate a search space S to it. Each element s 2 S corresponds to a potential solution of p, and is called a state of p. An element s 2 S that corresponds to a solution that satisfies all constraints of p is called a feasible state of p. Local search relies on a function N which assigns to each s 2 S its neighbourhood N (s)  S . Each state s0 2 N (s) is called a neighbour of s. The neighbourhood depends on the structure of P and is generally composed of the states that are obtained by some local change, called move, from the current state. We denote by s  m the neighbour obtained from s by applying move m. A run of a local search algorithm starts from an initial state s0 , obtained with some other technique or generated at random, and enters a loop that navigates the search space, stepping from one state si to one of its neighbours si+1 . Local search techniques differ from one another according to the strategies they use to select the move in each state and to stop the search. In all techniques, the search is driven by a cost function f that estimates the quality of the state. For search problems, a common cost function counts the number of violated constraints, and the goal of the search is to minimize f to zero (for optimization problems f includes also the objective function of the problem). Among local search techniques, we focus on hill climbing (see Section 6 for a discussion on different techniques). Hill climbing is not a single local search technique, but rather a family of techniques based on the idea of performing only moves that improve or leave unchanged (i.e., sideways moves) the value of the cost function f . Hill climbing techniques can thus be described in the following way: At each iteration i, “draw” a move mi ; if f (si  mi )  f (s) then let si+1 = si  mi otherwise let si+1 = si . Different strategies draw their moves differently. Since hill climbing accepts sideways moves, the search does not stop when it reaches a local minimum. In order not to loop infinitely, we use a stopping criterion based on

the number of iterations elapsed from the last strict improvement. Specifically, given a fixed value n the algorithm stops after n iterations that do not improve the value of the cost function, i.e., it stops at iteration j such that f (sj ) = f (sj 1 ) =    = f (sj n ). To apply hill climbing to ETP we need to define the search space, the neighbourhood structure, the cost function, and the selection rule for their initial solution. 3.2 Search Space The three-dimensional binary matrix X is not suitable for local search processing. A better form, which corresponds to common manual representations in working places, is a rectangular integer-valued matrix Mmn with a row for each employee. Each column represents a shift and each cell Mij of the table is assigned a value in the interval [0::t℄. The value Mij = 0 denotes that the employee Ei is not working in shift Sj , and Mij = k (with k > 0) denotes that the employee Ei is assigned the task Tk in shift Sj . This representation automatically rules out the possibility that an employee is assigned to more than one task at the same shift. In addition, we consider only states (and moves) in which the requirements are always satisfied, therefore requirements also do not need to be checked. Conversely, all other constraint types can be violated, and are embedded in the cost function. 3.3 Neighbourhood Structure We consider here a type of move called Replace (others will be considered in Section 4). Replace: Given a shift Sh , and two employees Ei and Ej , such that Mih = k (with k 6= 0) and Mjh = 0 in S , the state obtained from S after applying the Replace move hh; i; j i is equal to S with the difference that Mih = 0 and Mjh = k . That is, an employee Ei doing a task Tk in a shift Sh is replaced by another employee Ej not working at shift Sh . A Replace is therefore identified by a triple hh; i; j i, representing in our search space the swapping of the values Mih and Mjh in column h. Notice that Replace moves do not change the number of assignments for shift-task pairs, therefore they preserve the satisfaction of requirement constraints. 3.4 Cost Function and Initial Solution The cost function is defined to be the total number of constraint violations of the current state. All constraint types (ability, availability, workload, and conflicts) are thus implicitly given the same weight w = 1 (see Section 4 for weights for violations). The initial solution is constructed by a greedy procedure, which will be explained in Section 4. Such construction is compatible with the requirement constraints, so that for each pair (Sh ; Tk ) it selects Rhk distinct employees Ei1 ; : : : ; EiRhk and assigns Mij h = k , for all i = 1; : : : ; Rhk .

3.5 Hill Climbing Techniques The techniques we consider belong to the hill climbing family as explained in Section 3.1. Given a state S , the selection rules that we apply are the following RHC: Select randomly a legal Replace hh; i; j i RRSHC: Select a random shift Sh and a random employee Ei , and find Ej so that f (S  hh; i; j i) is a minimum (breaking ties randomly) among all employees. RSSHC: Select a random shift Sh and find Ei ; Ej so that f (S  hh; i; j i) is minimum (breaking ties randomly) among all pairs of employees. SHC: Find m = hh; i; j i so that f (S m) is minimum (breaking ties randomly) among all legal Replace. Notice that the techniques differ from each other by the part of the neighbourhood that they explore at each iteration. They are ordered by the “steepness” of the search they perform. Larger parts of the neighbourhood explored imply a steeper search, in the sense that better moves are found at each iteration at the expense of a higher computational cost. The strategy RSSHC corresponds to the min-conflict hill-climbing (MCHC) procedure in [8], in which a move corresponds to changing the value of a variable, the variable is selected randomly and its new value is the one that minimizes the number of conflicts.

4

Generalized Local Search

To describe our generalized local search we first present its search space and its neighbourhood function, then we discuss its cost function, and finally we describe the related move selection strategies. 4.1 Extended Search Space and Neighbourhood The neighbourhood function includes, beside Replace, two new move types: Insert: Given a shift Sh , an employee Ei , and a task Tk such that Mih = 0 in S , the state obtained from the state S after applying the Insert move hh; i; k i is equal to S with the addition of Mih = k . Delete: Given a shift Sh , an employee Ei , such that Mih 6= 0 in S , the state obtained from the state S by applying the Delete move hh; ii is equal to S with Mih = 0. The full neighbourhood of each state is now constructed by applying all legal Replace, Insert, and Delete moves. The search space includes all possible assignments to the matrix M independently of the fact that the requirements are not satisfied. Most importantly, it contains all partial states, i.e., states with fewer assignments than the requirements. This means that the search space includes all the states of the search tree visited by a typical backtracking-based algorithm that uses this representation.

4.2 Cost Function Components In order to explore effectively the extended search space, several modifications have to be introduced into the cost function. First, constraints are split into two classes: Missings: Minimum requirements and minimum workloads. Strict Constraints: Maximum requirements, maximum workloads, conflicts, abilities and availabilities. Intuitively, given a partial state S , strict constraints are those that are present also in any complete state obtained from S , whereas missings are those that might be eliminated by adding assignments. Furthermore, we introduce a new component in the cost function that takes into account a measure of the possibility for a partial solution to be completed. We call this component, following [11], the look-ahead factor, and define it as follows. Look-Ahead: For all shift-task pairs (Sh ; Tk ) for which the number of assigned employees in the current (partial) state S is less than the requirements, we sum up the number of employees that have the ability to do Tk , are available in Sh , and are working in at least one shift which is conflicting with Sh for the same employee. Intuitively, we count the possible employee assignments that are made infeasible only by the presence of other assignments (and not by constraints on that single assignment). The higher the look-ahead factor, the more difficult it is to complete the timetable. For full states(i.e., all requirements satisfied), the look-ahead factor is zero, and it tends to decrease as the state fills up. The cost function is now composed of three components: missings, strict constraints, and look-ahead. The weights assigned to these three components are crucial for the effectiveness of the search. Our choice is to assign to look-ahead a low weight, which is negligible w.r.t. the others, thus creating a hierarchical cost function. The two weights for missings and strict constraints are adaptively modified using a shifting penalty scheme (see [4]) similar to the one proposed in [3]. Specifically, if there are 0 violations of one kind for K consecutive iterations, the corresponding weight is divided by a factor randomly chosen between 1.5 and 2. Conversely, if there are more than 0 violations of one kind for H consecutive iterations, the corresponding weight is multiplied by a random factor in the same range (where H and K are parameters of the algorithms). In addition, the weights have strict maximal and minimal limits. The maximal weight for missings is less than the maximum weight for strict constraints, so as to “encourage” the search to move toward partial solutions when, in the initial phase, both types of violations are simultaneously present. This adaptive scheme allows search to move “up” and “down” in the search space, “exchanging” missing assignments with strict constraint violations. During this vertical oscillation (whose period depends on H and K ), which takes into account also the look-ahead factor, all violations eventually tend to disappear. Similar shifting penalty mechanisms have been proposed in [10] and [13], which rely on relaxing some constraints when a local minimum is reached. Differently from their work, our adaptive relaxation scheme is not a method to deal exclusively with local minima (which are not necessarily perceived), but is a general search guide, which tends to make the overall search more effective.

4.3 Move Selection and Initial Solution Defining move selection rules for the extended neighbourhood, notice that Insert and Delete moves have three and two degrees of freedom, respectively. In analogy to Replace moves, the same four levels of search steepness can be defined (RSSHC and SHC stay exactly the same for Delete). Therefore, the same four selection strategies are defined, and the corresponding techniques are called GRHC, GRRSHC, GRSSHC, GSHC (where G stands for “generalized”). At each iteration the move type is randomly selected, and subsequently a move of the chosen type is selected based on the steepness currently used. A fifth level of steepness is introduced, called GVSHC (VS for “very steep”), in which the best neighbour of the entire extended neighbourhood is selected. For the other four strategies, the random selection for the move type is not based on an equal distribution, but is biased toward Replace moves, as shown in the experimental results. The initial solution for both local search and generalized local search is a complete state and it is built by a sequence of only Insert moves, selected by the SHC strategy.

5

Experimental Results

Two different types of instances are used in our experimental study. One type is the timetable of nurses in a department of a hospital. The other type was taken from the schedule of production lines in a factory. In the hospital department problem there are 43 shifts in each week’s timetable, 29 employees to be assigned to a total of 102 tasks over 7 days. The production line problem has 21 weekly shifts (three per day, 8 hours each), 50 employees and a total of 280 assignments. The hard constraints of both types of instances included many conflicts arising from regulations on minimal resting periods. The second type of instances has a larger number of assignment and constraints, which makes them harder. In this section we report the results for 5 instances of the second type, which proved too hard to solve with constructive methods (see Section 6). Similar results where obtained for the nurse cases. Table 1 presents a general view of the results obtained by the various techniques on the two case studies. We performed 100 runs for each technique for each instance, all starting from the same set of initial solutions. The parameter MaxIters is set to a different appropriate value for each technique, in such a way that the running times for all techniques are approximately the same (300 seconds per run on a SUN Ultra 2 workstation). The shifting penalty mechanism explained in Section 4.2 are used for all local search and generalized local search techniques. The columns Average and Solved give the average number of violations per run, and the percentage of runs that solved the instance (i.e. a 0 violations occurrence), respectively. The best results in Table 1 are obtained by the technique GRSSHC, and generalized hill climbing outperforms hill climbing for this problem. Notice that the best steepness of search is different for generalized local search and for standard local search. For standard local search, the best results are obtained by the RHC technique. This is intuitively explained by the fact that for generalized local search the cost function includes more

MaxIters Average Solved Standard Local Search RHC 20,000,000 0.9 38 RRSHC 400,000 1 25 RSSHC 150,000 1.4 18 SHC 30,000 3.4 0

MaxIters Average Solved Generalized Local Search GRHC 10,000,000 2.5 0 GRRSHC 300,000 1.2 11 GRSSHC 100,000 0.5 58 GSHC 20,000 2.8 0 GVSHC 5,000 3.5 0

Table 1. General Results

components, and therefore a more accurate move selection is necessary in order to find moves that do not penalize some component for improving the others. Tables 2, present results that highlights the role played by one single feature of our algorithm. For each set of experiments the parameters associated with one specific feature are varied while all the other parameters are kept at the value of the best overall result. All the results are obtained making a large number of trials of shorter runs with GRSSHC. Specifically, we made 1000 trials for each configuration with MaxIters equal to 1000. What we measure is the average number of violations for the final state. The top-left part of Table 2 regards the look-ahead mechanism. We consider three possibilities for the computation of the look-ahead factor. Either no look-ahead factor is added to the cost function, or the number of available employees for a pair shifttask in which the requirements are not completely fulfilled are counted two different ways. The non-biased look-ahead counts cost 1 for each employee which cannot do the task, whereas in the biased version, the value is multiplied by the number of missing employees. Intuitively, the biased version emphasizes cases of more than one employee missing per task. The results show a mild advantage for using the biased version.

Look-ahead factor no look-ahead non-biased look-ahead biased look-ahead Weighting regime high variations medium variations low variations no variation

Average cost 9.56 6.41 6.25

HK

1 3 2 10 5 30

11

Average cost 6.44 6.25 6.68 8.93

Type Distribution Average Cost R I D 33% 33% 33% 7.43 60% 20% 20% 6.25 20% 60% 20% 7.75 20% 20% 60% 8.1 0% 50% 50% 8.9 80% 10% 10% 6.8 90% 5% 5% 7.2 100% 0% 0% 7.4

Table 2. Results for different values for three features of the algorithm

The bottom-left part of the table shows the importance of the shifting penalty mech-

anism. The results are given for different values of H and K , which determine the variability of the weights, and the last row has fixed weights (both equal to 1). The results show that there is a trade-off associated with the choice of these values. The importance of biasing the random selection of different move types (R: Replace, I: Insert, D: Delete) is presented in the right-hand side of Table 2. The best results are obtained for a random selection biased toward Replace moves (see second row: 60% of Replace). The last three rows demonstrate that such biasing should be limited. The case (100% Replace) corresponds to standard local search, with no partial states. Selections biased toward Insert or Delete moves perform worse, and, in particular, not using Replace moves at all performs very poorly (fifth row).

6

Discussion

We have implemented some additional search techniques, beside those presented in Sections 3 and 4. First, we implemented an exhaustive forward-checking search using the language ECLi PSe [1]. This was able to solve a few instances of the nurse problem (102 assignments), but always failed to solve the larger problem. The ECLi PSe program was also used as a more informed strategy for finding the initial solution. In particular, a version of it with a time limit was used as the initial (partial) solution for generalized local search. The time limit is implemented in such a way that it makes the maximum number of feasible assignments (similarly to the RFLG algorithm in [12]). Tabu search [4] can be the basis for generalized local search and we experimented with it for solving our ETP instances. It turned out experimentally that tabu search gave results comparable with RSSHC when using Replace moves. In fact, the difference between our hill climbing procedure and tabu search stems mostly from the prohibition mechanism implemented by the use of the tabu list. For the generalized local search, the combined effect of the shifting penalty mechanism (which changes continuously the quality of moves) and the presence of different move types made the use of the prohibition mechanism not effective in our experiments. We also experimented with techniques that interleave local search with other constructive (and destructive) phases, similarly to what is proposed in [5]. These techniques, which need further investigation, did not provide good results.

7

Related and Future Work

The presence of many types of complex constraints for ETPs leads naturally to the use of knowledge-based techniques for representations of the constraints and for capturing of domain specific heuristics (cf. [2, 9]). Constraint processing and KB-rules have been combined in the past for solving real world ETPs in [7]. We experimented for comparison with the system in [7]. That system solved the hospital ETPs in a manner that achieves certain additional objectives (e.g. attempting to rotate night shifts among some groups of nurses). It solved the problems with very few backtracks (i.e. 110 assignment attempts for 102 needed) in a few seconds of CPU

time. The 280-assignment production line instances of ETPs instead were too difficult to solve by the KB-rules technique. Lacking domain specific knowledge, only 254 feasible assignments out of the needed 280 were found. An approach similar to ours is provided in [5] for the graph colouring problem. Their method starts from a complete state, which is found with a high-quality heuristics. Thereafter, it alternates local search with a two-phase process which is composed of a destructive phase and a constructive one. The generalized local search takes place when the local search is in a local minimum, and the number of destructive steps that it performs is related to an estimation of the depth of the current local minimum. In [11] it is proposed an algorithm that interleaves a constructive phase with a local search one. However, the search space only includes partial states of the same level, and no constructive or destructive move is allowed. Our approach generalized this idea, performing constructive and normal moves in a single phase. In this paper, only the hard constraints of the problems were taken into account. In the future, we plan to apply similar techniques to ETPs with soft constraints, which generally refer to fair load distribution.

References 1. A. Aggoun and et al. ECLi PSe User Manual (Version 4.0). IC-Parc, London (UK), 1998. 2. J. Collins and E. Sisley. Automated assignment and scheduling of service personnel. IEEE Expert, 5:33–38, 1994. 3. M. Gendreau, A. Hertz, and G. Laporte. Tabu search heuristic for the vehicle routing problem. Management Science, 40:1276 – 1290, 1994. 4. F. Glover and M. Laguna. Tabu search. Kluwer Academic Publishers, 1997. 5. F. Glover, M. Parker, and J. Ryan. Coloring by tabu branch and bound. In D. S. Johnson and M. A. Trick, editors, Cliques, Coloring, and Satisfiability. Second DIMACS Implementation Challenge, volume 26 of DIMACS Series in Discrete Mathematics and Theoretical Computer Science. American Mathematical Society, 1996. 6. L. Kragelund. Solving a timetabling problem using hybrid genetic algorithms. Soft. Pract. Exper., 27:1121–34, 1997. 7. A. Meisels, E. Gudes, and G. Solotorevsky. Combining rules and constraints for employee timetabling. Intern. Jou. Intell. Syst., 12:419–439, 1997. 8. S. Minton, M. D. Johnston, A. B. Philips, and P. Laird. Minimizing conflicts: a heuristic repair method for constraint satisfaction and scheduling problems. Artificial Intelligence, 58:161–205, 1992. 9. E. Morgado and J. Martins. An AI based approach to crew scheduling. In Proc. of CAIA-93, pages 71–77, 1993. 10. P. Morris. The breakout method for escaping from local minima. In Proc. of AAAI-93, pages 40–45, 1993. 11. A. Schaerf. Combining local search and look-ahead for scheduling and constraint satisfaction problems. In Proc. of IJCAI-97, pages 1254–1259, 1997. Morgan-Kaufmann. 12. M. Yoshikawa, K. Kaneko, T. Yamanouchi, and M. Watanabe. A constraint-based high school scheduling system. IEEE Expert, 11(1):63–72, 1996. 13. N. Yugami, Y. Ohta, and H. Hara. Improving repair-based constraint satisfaction methods by value propagation. In Proc. of AAAI-94, pages 344–349, 1994. This article was processed using the LATEX macro package with LLNCS style

Suggest Documents