Solving Employee Timetabling Problems with Flexible ... - CiteSeerX

15 downloads 0 Views 156KB Size Report
Employee timetabling is the problem of assigning employees to tasks and loca- tions in a set of shifts, during a fixed period of time, typically a week (see, e.g.,.
Solving Employee Timetabling Problems with Flexible Workload using Tabu Search Marco Chiarandini1 , Andrea Schaerf1 , Fabio Tiozzo2 1

1

Dipartimento di Ingegneria Elettrica, Gestionale e Meccanica Universit` a di Udine via delle Science 208, I-33100, Udine, Italy email: [email protected] 2 Cybertec Via Udine 11, I-34132, Trieste, Italy email: [email protected]

Introduction

Employee timetabling is the problem of assigning employees to tasks and locations in a set of shifts, during a fixed period of time, typically a week (see, e.g., [2, 4, 5]). We consider a version of employee timetabling that extends the one in [6], and involves flexible workloads for employees and long-term fair distribution for undesired working shifts (night shifts, weekends, ...). We propose a tabu search [3] algorithm for employee timetabling, and we provide its implementation. In addition, we present an experimental analysis that demonstrates the performance of our approach w.r.t. other local search techniques, namely hill-climbing (HC) and simulated annealing (SA). Finally, we provide a set of experiments that highlight the relative importance of the various features of the algorithm and the parameters setting.

2

Employee Timetabling Problem

The problem is based on four main entities: employee, shift, task type (or simply task ), and location. We assume there are m employees E1 , . . . , Em , n shifts S1 , . . . , Sn , t tasks T1 , . . . , Tt , and q locations L1 , . . . , Lq . Locations correspond to working places, such as production lines in an industrial plant (production scheduling), or departments in a hospital (nurse scheduling). Tasks correspond to specific activities to be fulfilled in the system during one shift, such as carpenter, head nurse, controller. An employee can make different tasks in different shifts. Regarding the shifts, we assume a temporal horizon of one week and a fixed structure based on three 8-hours shifts per day for 7 working days (m = 21). Shifts are numbered consecutively starting from Monday morning. Certain shifts are particularly inconvenient, and they are therefore involved in specific constraints and objectives. We call them special shifts. Night shifts (Ti for i mod 3 = 0) and weekend shifts (16 ≤ i ≤ 21) are predefined special shifts.

Other special shifts can be added by the user. Shifts can also be defined special only for a limited subset of the tasks, and being regular for the other tasks. Employees are usually able to fulfill different tasks, with different ability (polyfunctionality). Employees can be either full-time or part-time workers. All employees have flexible workload, so that they are available for working either more or less than their regular workload, in the single week (flexibility). Positive and negative variations are taken into account and need to be removed on a yearly basis. The problem consists in assigning employees to tasks in locations in shifts satisfying the following (hard) constraints and minimizing the objective function defined below. Requirements: In each shift Sj there is a required number of employees for each pair location/task. Ability: Each employee has qualifications that enable her/him to fulfill certain types of tasks. Availability: There are personal availabilities of employees, which restrict them to be assigned only to subsets of the shifts. Conflicts: An employee cannot be assigned to more than one task in the same shift. In addition, employees cannot be assigned to two shifts that are in conflict with each other. In the fixed shift structure considered, shifts Si and Sj are in conflict if and only if |i − j| ≤ 2. This means that an employee has to rest at least 16 hours between two working shifts. Workload: An employee has a contractual number of working shifts per week Ri (typically Ri = 5 for full time workers). The actual workload of the week is flexible, but it has an upper and lower limit on the difference to Ri in number of shifts that each employee can be assigned to in the week. The objective function of the problem is the weighted sum of the following components (soft constraints). Preferential ability and availability: Among the tasks that an employee is able to do, there are different degrees of skill. Similarly, among available shifts, there are personal preferences that the system should take into account. For this reasons, ability and availability data are not binary values, but integers that serve for both hard and soft constraints. Workload flexibility: For each employee Ei , we store separate historical data about the positive flexibility (weeks in which she/he worked more than Ri ) and negative flexibility (weeks in which she/he worked less than Ri ). Two components of the objective function are devoted to the cumulated flexibility (in order of importance): – The balance between positive and negative flexibility should tend to 0. The importance of this objective increases when approaching the end of the year. – Positive and negative flexibility values should be kept as uniform as possible for all employees.

Fairness for special shifts: Special shifts should be assigned preferably to employees that worked less in those shifts in the past weeks, and to employees that do not work more than their regular workload in the week. Shift and location stability: It is preferable that an employee work on the same shift (morning, afternoon, or night) and on the same location during the week. Notice that the computation of the objectives requires complex aggregations of historical data on the current year. Such data needs to be updated at the end of each scheduled week. Notice also that the shift stability is often considered as a hard constraint in the literature. However, if the workers regulations allow it, the flexible assignment increases significantly the possibilities to satisfy all the constraints.

3

Tabu Search for Employee Timetabling

We represent an assignment as a rectangular matrix Mm×n , such that rows represents employees and columns represent shifts. Each cell Mij of the table is assigned a pair (h, k), with h ∈ {0, . . . , q} and k ∈ {0, . . . , t}, which represents a location/task combination. Specifically, the value Mij = (0, 0) denotes that the employee Ei is not working in shift Sj , and Mij = (h, k) (with h, k > 0) denotes that the employee Ei is assigned the location Lh and task Tk in shift Sj 1 (see Figure 1). The neighborhood relation is defined by the following move operator called Replace: Given a shift Sj , and two employees Ei1 and Ei2 , such that Mi1 j = (h, k) (with h, k 6= 0) and Mi2 j = (0, 0), the state obtained after applying the Replace move hj, i1 , i2 i is equal to the current state except that Mi1 j = 0 and Mi2 j = (h, k). That is, an employee Ei1 doing a task Tk in a location Lh in a shift Sj is replaced by another employee Ei2 not working at shift Sj . Further neighborhood relations are currently under investigation. Regarding the neighborhood exploration, we experimented with both exhaustive and non-exhaustive traversal. The latter one is based on a random sampling of a fixed share of the neighborhood. Up to now, the exhaustive version has given better results. We employ a tabu list of variable size. When a move m is performed and it enters the list, it is assigned a random number, between two fixed values kmin and kmax , that represents the number of iterations m should be kept in the tabu list. When its tabu period is expired, a move is removed from the list. This way the size on the list is not fixed, but varies dynamically between kmin and kmax . According to tabu search, inverses of the moves in the tabu list are forbidden. We investigate six definitions of the inverse relation. The one that gave best results is the following. Given a move m = hSi , Eh , Ek i in the tabu list, all 1

For efficiency reasons, in the implementation, the single value h · q + k is stored, from which h and k are uniquely reconstructed

| MON | TUE | WED | THU | FRY | SAT | AM PM Ni | AM PM Ni | AM PM Ni | AM PM Ni | AM PM Ni | AM ... ---------------------------------------------------------------------Rossi | | b/3 | a/3 | a/3 | b/1 | ... Verdi | b/3 | |b/3 |a/3 |a/3 | ... Gialli | a/1 | a/1 | | a/2 | a/2 | ... Neri | b/3 | b/3 | a/3 | |a/3 |b/3 ... Viola | b/1 | b/1 | b/1 | a/1 | |a/2 ... Bianchi |b/2 |a/2 |b/2 |a/2 |a/2 | ... Blu |a/3 |b/3 |a/3 |a/3 | b/3 | ... Azzurri | a/2 |b/3 |a/1 |a/1 |a/1 | ... Marroni |a/3 | a/2 | b/2 | b/3 | b/3 | ... Grigi |a/1 |b/1 | a/1 | a/1 | b/1 | ... -----------------------------------------------------------------------

Fig. 1. An assignment table for 10 employees, 2 locations (a and b) and 3 tasks (1, 2, and 3)

moves of the form h , Ek , i are tabu. This means that an employee inserted in the timetable cannot be removed in the short term (for all shifts). The cost function C = α·V +f is a weighted sum of hard and soft constraints, with α >> 1. Because of the large number of different types, the soft constraints are split into three groups (f = f1 + f2 + f3 ): f1 : Preferential ability and availability, location stability f2 : Workload flexibility f3 : Fairness for special shifts and shift stability. In order to gain insight on the problem structure, we experimented also using three partial cost functions, which are composed by the hard constraints and one single soft constraint group fi (for i = 1, 2, 3), neglecting the other two. The search stops when it has performed a fixed number of iterations without an improvement in the cost function.

4

Experimental Results

Our system is written in C++ using the library EasyLocal++ [1]. It is composed by 7000 lines of code, and is compiled using Visual C++ 5.0. To test the program and set the parameters we have used a first instance of 50 employees and total 260 requirements (neighborhood size 9290). We also verified results with a second instance of 100 employees and 449 requirements (neighborhood size 33929). Computing time for each run is in average 200 CPU secs. for the first instance and 800 CPU secs. for the second one. Table 1 shows the best results for TS, HC, and SA for the first instance. For each technique we present the results for the complete cost function and for the three partial cost functions. For the sake of clarity, the values of the components

included in the cost function are shown in bold font, and all the others are in normal font. The third column (shows the number of runs that terminates with a feasible solution out of 5 total runs. It is quite surprising to observe that the optimization of the sole function f1 may lead to results for f better than those obtained optimizing the complete function f . This phenomenon needs further investigation. Technique Cost Function TS TS TS TS HC HC HC HC SA SA SA SA Table

α · V + f1 + f2 + f3 α · V + f1 α · V + f2 α · V + f3 α · V + f1 + f2 + f3 α · V + f1 α · V + f2 α · V + f3 α · V + f1 + f2 + f3 α · V + f1 α · V + f2 α · V + f3 1. Best and average

Feas. f1 + f2 + f3 f1 f2 f3 sol. best avg. best avg. best avg. best avg. 5 3911 4161 1817 2009 720 782 1374 1370 5 3958 4114 1278 1394 1225 1261 1455 1459 5 7988 8309 5919 6220 595 640 1474 1449 5 7987 8427 5814 6146 960 1066 1213 1215 5 5473 5627 3371 3544 725 710 1377 1373 5 4410 4759 1914 2161 1110 1157 1386 1441 4 8185 8243 6114 6058 605 708 1466 1477 5 8246 8415 5993 6077 1035 1109 1218 1229 0 6397 6684 4251 4470 770 801 1376 1413 0 7313 8478 4579 5731 1240 1267 1484 1479 0 8249 8349 6161 6185 660 702 1428 1462 4 8753 8544 6407 6203 1120 1095 1226 1246 values for the cost function for the first instance.

It is evident for the table that the best results are obtained with TS. The length of the tabu list that gave best results is 20-40 for the first instance and 30-50 for the second one.

References 1. Luca Di Gaspero and Andrea Schaerf. EasyLocal++: An object-oriented framework for flexible design of local search algorithms. Technical Report UDMI/13/2000/RR, Dipartimento di Matematica e Informatica, Universit` a di Udine, 2000. Available at http://www.diegm.uniud.it/~aschaerf/projects/ local++. 2. K. A. Dowsland. Nurse scheduling with tabu search and strategic oscillation. European Journal of Operational Research, 106:393–407, 1998. 3. Fred Glover and Manuel Laguna. Tabu search. Kluwer Academic Publishers, 1997. 4. L. Kragelund. Solving a timetabling problem using hybrid genetic algorithms. Software—Practice and Experience, 27:1121–34, 1997. 5. A. Meisels, E. Gudes, and G. Solotorevsky. Combining rules and constraints for employee timetabling. International Journal of Intelligent Systems, 12:419–439, 1997. 6. Andrea Schaerf and Amnon Meisels. Solving employee timetabling problems by generalized local search. In Proc. of the 6th Italian Conf. on Artificial Intelligence (AIIA-99), pages 493–502, 1999.