Topic 36 Reservation Systems without Slack Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Overview of Service Industry Models Reservation systems Timetabling Workforce scheduling June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 2 Reservation without Slack Reservation system with m machines, n jobs Release date rj, due date dj, weight wj No slack p j d j rr If processed job must start at time rj Should we process the job? Maximize number of jobs processed June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 3 Example: A Car Rental Four types of cars: subcompact, midsize, full size, and sport utility Fixed number of each Machine = type of car Job = customer requesting a car May request certain machine(s) Job can be processed on a subset of machines June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 4 Problem Formulation Integer Programming Problems Fixed time periods Assume H periods Let xij be 1 if job j assigned to ith machine (and zero otherwize) m Job requiring processing in period l June 28, 2016 x i 1 ij x jJ l ij 1, j 1,..., n 1 i 1,..., m, Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson l 1,..., H 5 Feasibility Problem Can we process every job? Can we assign jobs to machines such that job j is assigned to a set Mj of machines Relatively easy to solve June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 6 Optimization Problem Maximize the total profit m n w x i 1 j 1 ij ij In general NP-hard Special solvable cases All processing times = 1 Decomposition into separate time units June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 7 Identical Weights and Machines Assume wj = 1 and Mj = {1,2,…,m} Do not have a time decomposition Simple algorithm maximizes number of jobs that are processed Order jobs in increasing release date order r1 r2 ... rn June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 8 Algorithm Step 1 Set J= and j=1 Step 2 If a machine available at time rj assign job j to the machine, include it in J and go to Step 4 Step 3 Select j* such that C j * max Ck max rk pk kJ kJ C j rj p j C j* do not include j in J and go to Step 4 If Else delete job j* from J, assign j to freed machine & include in J Step 4 If j=N STOP; otherwise set j=j+1 and go back to Step 2 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 9 Unlimited Machines No slack, arbitrary processing times, equal weights, identical machines Infinitely many machines in parallel Minimize the number of machines used Easily solved Order jobs as before June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 10 Algorithm Assign job 1 to machine 1 Suppose first j-1 jobs have been processed Try to assign jth job to a machine in use If not possible assign to a new machine Graph theory: node coloring problem June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 11 Node Coloring Problem Consider a graph with n nodes If an arc (j,k) connects nodes j and k they cannot be colored with the same color How many colors do we need to color the graph? Number of colors needed = Number of machines needed June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 12 Topic 37 Reservation Systems with Slack Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Reservation with Slack Now allow slack p j d j rr Trivial case all processing times = 1, identical weights, identical machines decomposition in time June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 14 General Equal Processing Times Now assume processing times are equal to some p 2 Interaction between time units Barriers algorithm wait for critical jobs to be released start the job with the earliest deadline Slot number l = lth job to start S(l) starting time of lth slot June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 15 Barrier Algorithm Barrier ordered pair (l,r) constraint Release time Slot number A k-partial schedule Starting with a k-partial schedule construct a (k+1)-partial schedule add a new barrier to the barrier list Lb and start over from scratch June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 16 Earliest Deadline with Barriers Selects machine h for job in (k+1)st slot m k 1 multiple of m h otherwise (k 1) mod m Compute the starting time max t1 , t2 , t3 , t4 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 17 Computing the Starting Time Let be the earliest time the job can max t1 , t2 , t3 , t4 start Minimum release date of jobs left t1 max S (1),..., S (k ) 0 k 1 m t3 S (k 1 m) p otherwise t4 max r : (k 1, r ) Lb June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 18 Selecting a Job Select for (k+1)th slot job j’ with the earliest deadline d j ' If d j ' p creation of (k+1) partial schedule was successful Otherwise a ‘crisis’ occurred and job j’ is a ‘crisis job’ Crisis routine June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 19 Crisis Routine Backtracks to find job with the latest starting time such that the deadline is greater than the crisis job If no such job, optimal schedule does not include crisis job Otherwise this job is a pull job Add new barrier with the minimum release time r* of all the jobs Jr after the pull job Start over with the barrier list June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 20 Example: 2 machines, 4 jobs Jobs 1 2 3 4 rj 0 2 5 5 dj 20 30 19 30 Processing time p = 10 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 21 Barriers Algorithm Machine 1 1 Machine 2 3 2 0 June 28, 2016 10 20 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 30 22 Barriers Algorithm Crisis job Machine 1 1 3 Pull job Machine 2 2 0 10 20 30 d 3 19 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 23 Barriers Algorithm Found a crisis job and a pull job exists: Setup a barrier Lb={(2,5)} Setup restricted set Jr={3} Start from scratch June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 24 Barriers Algorithm Second iteration: Machine 1 1 Machine 2 0 2 3 4 10 20 30 Optimal Schedule June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 25 Generalizations Non-identical processing times NP-hard No efficient algorithm exists Need heuristics Composite dispatching rule Preprocessing: flexibility of jobs and machines Dispatch least flexible job first on the least flexible machine, etc June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 26 Preprocessing Let yjk be the number of jobs that can be processed on machine j in the slot [k-1,k] Let Mj be the number of machines job j can be processed on June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 27 Priority Indices Low values = high priority Priority index for jobs I j f ( w j / p j , | M j |) Priority index for machines pj y i ,k l l 1 g (y i ,k 1 ,y i ,k 2 ,...,y i ,k p j ) pj max y i ,k 1 ,y i ,k 2 ,...,y i ,k p j June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 28 Algorithm Step 0 Calculate both priority indices Order jobs according to job priority index (Ij) Step 1 Set j=1 Step 2 For job j select the machine and time slot with lowest rank Discard job j if it cannot be processed at all Step 3 If j=n STOP; otherwise set j=j+1 and go back to Step 2 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 29 Topic 38 Timetabling Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Timetabling Infinite identical machines in parallel All of n jobs must be processed Tooling constraints Many tools Need one or more tools for each job Resource constraints Single resource of quantity R Need certain amount for each job June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 31 Tooling Constraints One of each tool Objective: minimize makespan Special case of resource-constrained project scheduling problem with one of each resource, that is, Ri = 1 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 32 Problem Complexity NP-hard Assume all processing times = 1 Decomposition? Equivalent to node coloring problem June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 33 Node Coloring Problem Job = node Jobs need same tool = arc between nodes Feasibility problem: Can the graph be colored with H colors? Optimization problem: What is the lowest number of colors needed? Chromatic number of the graph June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 34 Relation to Reservation Models Closely related to reservation problem with zero slack and arbitrary processing times Special case of timetabling problem tools in common = overlapping time slots tools in common nodes connected colors = machines minimizing colors = minimizing machines adjacent time slots vs tools need not be adjacent June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 35 Heuristics Many heuristics exist for graph coloring degree of node = number of arcs connected to node saturation level = number of colors connected to node Intuition: Color high degree nodes first Color high saturation level nodes first June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 36 Algorithm Step 1 Order nodes in decreasing order of degree Step 2 Use color 1 for first node Step 3 Choose uncolored node with maximum saturation level, breaking ties according to degree Step 4 Color using the lowest possible number color Step 5 If all nodes colored, STOP; otherwise go back to Step 3 Lecture Notes for Planning and Scheduling June 28, 2016 Prepared by Siggi Olafsson 37 Topic 39 Example: Scheduling Meetings Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Example Schedule 5 meetings with 4 people meetings = jobs and people = tools all meetings take one hour June 28, 2016 1 2 3 4 5 Joe 1 1 0 1 1 Lisa 1 1 1 0 0 Jane 1 0 1 0 0 Larry 0 1 0 1 1 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 39 Corresponding Graph Degree =4 2 Degree =4 1 3 5 4 Degree =2 Degree =3 Degree =3 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 40 Select First Job Can select either job 1 or 2 first Say, select 1 and color with the first color 2 1 3 5 June 28, 2016 4 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Saturation level = 1 for every node Select 2 because highest degree 41 Color Second Job Color Job 2 with the next color Saturation level = 2 for every node 2 1 3 Select 4 because highest degree 5 June 28, 2016 4 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 42 Color Third Job Color Job 4 with the next color 2 1 3 Saturation level = 2 for node 3 3 for node 5 Select 5 next 5 June 28, 2016 4 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 43 Color Fourth Job Color Job 5 with the next color 2 1 3 5 4 Select 3 next June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 44 Color Final Job Color Job 3 with same color as Job 4 2 1 3 5 4 Had to use 4 colors Makespan = 4 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 45 Example Suppose now we have a reservation system: June 28, 2016 Job 1 2 3 pj 2 3 1 rj 0 2 3 dj 2 5 4 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 46 Equivalent Timetabling Problem Job 1 must be processed in time [0,2] Job 2 must be processed in time [2,5] Job 1 2 3 Tool 1 1 0 0 Tool 2 1 0 0 Tool 3 0 1 0 Tool 4 0 1 1 Tool 5 0 1 0 Toool 5 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 47 Topic 40 Timetabling with Resource Constraints Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson Resource Constraints One type of tool but R units of it (resource) Job j needs Rj units of this resource Clearly, if Rj + Rk > R then job j and k cannot be processed at the same time, etc Applications scheduling a construction project (R=crew size) exam scheduling (R=number of seats) June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 49 Bin-Packing Assume all processing times = 1 Unlimited number of machines Minimize makespan Equivalent to bin-packing problem each bin has capacity R item of size Rj Pack into the minimum number of bins June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 50 Solving the Bin-Packing Problem Known to be NP-hard Many heuristics developed First fit (FF) heuristic Always but an item in the first bin it fits into Know that 17 Cmax (FF) Cmax (OPT) 2 10 June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 51 Example Assume 18 items and R=2100 FF heuristic: Jobs 1-6 require 301 resources Jobs 7-12 require 701 resources Jobs 13-18 require 1051 resources We assign the first 6 jobs to one interval (3016=1806) We then assign jobs two at a time to next 3 intervals (7012=1402) We then assign just one of the remaining jobs to each interval Very poor performance due to order of jobs June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 52 First Fit Decreasing (FFD) An improvement of FF: Order jobs in decreasing order first Know that 11 Cmax (FFD) Cmax (OPT) 4 9 FF and FFD can be extended to different release dates June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 53 Discussion Only considered very simple models In practice: Dynamic reservation systems Price considerations (yield management) June 28, 2016 Lecture Notes for Planning and Scheduling Prepared by Siggi Olafsson 54