Topic 41 Workforce Scheduling Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Workforce Scheduling Overview: Days-Off Scheduling Shift Scheduling Cyclic Staff Problem Crew Scheduling Simultaneous Worker and Job Scheduling June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 2 Days-Off Scheduling Number of workers assigned to each day Fixed size of workforce Problem: find minimum number of employees to cover a weeks operation June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 3 Constraints Demand per day nj, j=1,2,…,7 k1 out of every k2 weekends (day 1&7) off Work 5 out of 7 days Work no more than 6 consecutive days June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 4 Optimal Schedule Algorithm for one week Repeat for next week Cyclic schedule when repeat June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 5 Lower Bounds on Minimum Workforce W Weekend constraint k2 max n1 , n7 W B1 k2 k1 Total demand constraint 1 7 W n j B2 5 j 1 Maximum daily demand constraint W max n1 , n2 ,..., n7 B3 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 6 Optimal Schedule Define W max B1 , B2 , B3 n max n1 , n7 W n j uj n nj Have 7 u j 1 June 28, 2016 j j 2,...,6 j 1,7 2n Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 7 Algorithm Schedule weekends off Determine additional off days Categorize employees Assign off-day pairs June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 8 Optimality Can be shown that schedule is feasible Schedule is optimal Why? A cyclic optimal schedule exists June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 9 Topic 42 Shift Scheduling Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Shift Scheduling Fixed cycle of length m periods Have bi people assigned to ith period Have n shift patterns: (a1 j , a2 j ,..., amj ) Cost cj of assigning a person to shift j Decision variable: xj = people assigned to j June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 11 Integer Program Minimize Subject to c1 x1 c2 x2 ... cn xn a11 x1 a12 x2 ... a1n xn b1 a21 x1 a22 x2 ... a2 n xn b2 am1 x1 am 2 x2 ... amn xn bm xj 0 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 12 Solution NP-hard in general Special structure in shift pattern matrix Solve LP relaxation Solution always integer when each column contains a contiguous set of ones June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 13 Topic 43 Cyclic Staffing Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Cyclic Staffing Problem An m-period cyclic schedule Minimize cost Constraint bi for ith period Each worker works for k consecutive periods and is free for the next m-k Example: (5,7)-cyclic staffing problem June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 15 Integer Program Formulation Shift patterns: 1 1 1 A 1 1 0 0 June 28, 2016 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 16 Solution Solution to LP relaxation ‘almost right’ ' ' ' STEP 1: Solve LP relaxation to get x1 , x 2 ,..., xn if integer STOP; otherwise continue STEP 2: Formulate two new LPs with x1 x2 ... xn x1 x 2 ... x ' n x1 x2 ... xn x1 x 2 ... x ' n ' ' ' ' The best integer solution is optimal June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 17 Example (3,5)-cyclic staffing problem 1 1 A 1 0 0 June 28, 2016 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 3 4 b 6 4 7 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 18 Solution Solve the LP relaxation min cx x s.t. Ax b x0 Non-integer x (1.5,0,4.5,0,2.5) ' June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 19 Solution Add together: 1.5 0 4.5 0 2.5 8.5 Add constraint x1 x2 x3 x4 x5 8 No feasible solution Add constraint Solution: x (2,0,4,1,2) x1 x2 x3 x4 x5 8 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Optimal 20 Days-Off Scheduling We can represent our days-off scheduling problem as a cyclic staffing problem as long as we can determine all the shift patterns Difficulty: unknown cycle length Difficulty: many patterns larger problem June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 21 Example Two days off in week + no more than 6 consecutive workdays June 28, 2016 0 a 0 1 1 1 1 1 A 1 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 22 Cyclic Staffing with Overtime 24-hour operation 8-hour shifts with up to 8 hour overtime 0 1 1 1 0 0 1 1 0 0 0 1 1 0 U 0 0 0 0 U A U 1 0 0 0 0 0 0 U 1 0 0 0 0 0 0 0 0 0 0 0 0 Lecture Notes for Planning and Scheduling June 28, 2016 Prepared by Siggi Olafsson 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 0 0 1 23 Penalties for Under/Overstaffing Demand not fixed ' i '' i Linear penalty c for understaffing Linear penalty c for overstaffing ' Let xi denote the level of understaffing IP min c x c ' x ' c '' b Ax x ' Ax Ix b ' x, x 0 ' June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 24 Topic 44 Crew Scheduling Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Crew Scheduling Have m jobs, say flight legs Have n feasible combination of jobs a crew is permitted to do 2 1 m6 5 3 4 6 June 28, 2016 Set partitioning problem Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 26 Notation Cost cj of round trip j Define 1 if leg i is part of round trip j aij otherwise 0 1 if round trip j is selected xj otherwise 0 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 27 Integer Program Minimize Subject to c1 x1 c2 x2 ... cn xn a11 x1 a12 x2 ... a1n xn 1 a21 x1 a22 x2 ... a2 n xn 1 am1 x1 am 2 x2 ... amn xn 1 x j 0,1 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 28 Set Partitioning Constraints called partitioning equations The positive variables in a feasible solution called a partition l l l J { j : x j 1} NP-Hard Well studied like TSP, graph-coloring, bin-packing, etc. June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 29 Row Prices Say that ( , ,..., ) l l 1 l 2 l m is a set of feasible row prices if for j J m a i 1 l i ij cj Cost of covering a job June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 30 l Change Partition Let Z1 (Z2) denote the objective value of partition 1 (2) Then m Z Z a c j 2 1 jJ 2 i 1 1 i ij Potential savings of including column j is 1 If all negative theni optimal j i1aij c j m June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 31 Heuristic Start with some partition Construct a new partition as follows: Find the column with highest potential savings Include this column in new partition If all jobs covered stop; otherwise repeat June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 32 Connections Here Timetabling with resource constraints Production requirements per shift fixed Optimize number of people per shift Number of people fixed Optimize job schedule Determines production requirements per shift Optimize simultaneously June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 33