Job Shop Scheduling 1. Modelling Job Shop Problems 2. Shifting Bottleneck Heuristic 3. Branch & Bound Operational Research & Management Operations Scheduling Topic 1 Job Shop Scheduling Problems Operational Research & Management Operations Scheduling Job Shops Have m machines and n jobs Jm || Cmax Each job visits some or all of the machines – Only once (or sometimes multiple times if recirculation is allowed) Customer order of small batches – Wafer fabrication in semiconductor industry – Hospital Very difficult to solve Operational Research & Management Operations Scheduling 3 Job Shop Example Constraints – Job follows a specified route of operations (Conjunctive constraints) – One job at a time on each machine (Disjunctive constraints) Machine 1 Machine 2 (1,1) (2,3) Machine 3 Machine 4 Operational Research & Management (1,2) (1,3) (2,1) (2,2) (3,1) (4,3) (3,3) (4,2) Operations Scheduling 4 Definitions A schedule is non-delay if no machine is kept idle (or free resource is kept unused) when there is an operation available A schedule is called active if -without delaying other operationsno operation can be completed earlier For “regular” objectives: at least one optimal schedule is active (but not necessarily non-delay) Operational Research & Management Operations Scheduling 5 Non-active Schedule Machine 1 (1,1) Machine 2 (2,3) Machine 3 (2,1) (2,2) (2,1) (3,2) 0 Operational Research & Management 2 4 6 Operations Scheduling 8 6 Active Schedule, not Non-delay Machine 1 (1,1) Machine 2 (2,3) Machine 3 (2,2) (2,1) (3,2) 0 Operational Research & Management 2 4 6 Operations Scheduling 8 7 Non-delay schedule Machine 1 (1,1) Machine 2 (2,3) Machine 3 (2,1) (2,2) (3,2) 0 Operational Research & Management 2 4 6 Operations Scheduling 8 8 Graph Representation (J-on-N) Each job follows a given route through the job shop – Picturing each job as a row of nodes: (i,j)=operation on machine i of job j (Conjunctive arcs A) Source (1,1) (2,1) (1,2) (2,2) (2,3) (1,3) Operational Research & Management (3,1) (4,2) (4,3) Sink (3,3) Operations Scheduling 9 Graph Representation To model the machine constraints, introduce the arc set B (...), giving ‘a clique’ of bidirected arc-pairs on each machine (Disjunctive arc-pairs B) Source (1,1) (2,1) (1,2) (2,2) (2,3) (1,3) (3,1) (4,2) (4,3) Sink (3,3) Full Graph G(N, AB) Operational Research & Management Operations Scheduling 10 Solving the Problem Select one arc from each pair of disjunctive arcs: D out of B Source (1,1) (2,1) (1,2) (2,2) (2,3) (1,3) (3,1) (4,2) (4,3) Sink (3,3) Longest path in G(D)=G(N, A D) determines the makespan Operational Research & Management Operations Scheduling 11 Feasibility of the Schedule Are all selections feasible? Source (1,1) (2,1) (1,2) (2,2) (2,3) (1,3) (3,1) (4,2) (4,3) Sink (3,3) Resulting graph G(D) should be acyclic Operational Research & Management Operations Scheduling 12 Disjunctive Programming Minimize Cmax s.t. Cmax yij pij for all operat's (i, j ) ykj yij pij for all (i, j ) (k , j ) // arcs in A yij yil pil or yil yij pij for all (i, j ) and (i, l ) // arcs in B yij 0 Operational Research & Management for all (i, j ) Operations Scheduling 13 Solution Methods Exact solution – Branch & Bound – 20 machines and 20 jobs Dispatching rules (16+) – Shifting Bottleneck Search heuristics – Tabu, SA, GA, etc. Operational Research & Management Operations Scheduling 14 Topic 2 Shifting Bottleneck Heuristic for Job Shop Scheduling Problems Operational Research & Management Operations Scheduling Shifting Bottleneck Minimize makespan in a job shop Let M denote the set of machines Let M0 M be machines for which disjunctive arcs have been selected Basic idea: – Select a machine in M - M0 to be included in M0 – Sequence the operations on this machine Operational Research & Management Operations Scheduling 16 Example Three jobs on four machines Job j 1 2 3 Sequence 1, 2, 3 2, 1, 4, 3 1, 2, 4 Processing Times on Machine i 1 2 3 10 8 4 3 8 6 4 7 - 4 5 3 total 22 22 14 Processing job 1 (or 2) without delay requires 22 Operational Research & Management Operations Scheduling 17 Iteration 1 M0 (1,1) 10 (2,1) 8 (3,1) 4 0 Source 0 (2,2) 8 (1,2) 3 (4,2) 5 (3,2) 0 (1,3) 4 (2,3) 7 6 Sink 3 (4,3) Cmax ( M 0 ) 22 Operational Research & Management Operations Scheduling 18 Selecting a Machine Set up a non-preemptive single machine maximum lateness (1||Lmax) problem for Machine 1: Job j p(1, j) r(1, j) d(1, j) 1 10 0 10 2 3 8 11 3 4 0 12 Optimum sequence is 1, 2, 3 with Lmax(1) = 5 Consider rj as earliest starting time and dj as latest finish time Operational Research & Management Operations Scheduling 19 Selecting a Machine Set up a non-preemptive single machine maximum lateness (1||Lmax) problem for Machine 2: Job j p(2, j) r(2, j) d(2, j) 1 8 10 18 2 8 0 8 3 7 4 19 Optimum sequence is 2, 3, 1 with Lmax(2) = 5 Operational Research & Management Operations Scheduling 20 Selecting a Machine Similarly, Lmax (3) 4 Lmax (4) 0 Either Machine 1 or Machine 2 is the bottleneck Operational Research & Management Operations Scheduling 21 Iteration 2 M 0 {1} (1,1) 0 Source 0 10 (2,1) 8 (3,1) 4 10 (2,2) 0 8 (1,2) 3 4 (1,3) 3 (2,3) (4,2) 7 5 (3,2) 6 Sink 3 (4,3) Cmax ({1}) Cmax () Lmax (1) 22 5 27 Operational Research & Management Operations Scheduling 22 Selecting a Machine Set up a non-preemptive single machine maximum lateness (1||Lmax) problem for Machine 2: Old: Job j p(2, j) r(2, j) d(2, j) 1 8 10 18 2 8 0 8 3 7 4 19 New: Job j p(2, j) r(2, j) d(2, j) 1 8 10 23 2 8 0 10 3 7 17 24 Optimum sequence is 2, 1, 3 with Lmax(2) = 1 Operational Research & Management Operations Scheduling 23 Selecting a Machine Set up a non-preemptive single machine maximum lateness (1||Lmax) problem for Machine 3: Job j p(3, j) r(3, j) d(3, j) 1 4 18 27 2 6 18 27 Optimum sequence is 1, 2 with Lmax(3) = 1 Operational Research & Management Operations Scheduling 24 Selecting a Machine Similarly, Lmax (3) 1 Lmax (4) 0 Either Machine 2 or Machine 3 is the bottleneck Operational Research & Management Operations Scheduling 25 Iteration 3 M 0 {1, 2} (1,1) 0 (2,1) 10 0 Source 10 8 0 (1,2) 3 (1,3) 4 (3,1) 4 8 8 (2,2) 8 3 (2,3) (4,2) 7 5 (3,2) 6 Sink 3 (4,3) Cmax ({1, 2}) Cmax ({1}) Lmax (2) 27 1 28 Operational Research & Management Operations Scheduling 26 Shifting Bottleneck Heuristic 1. M0:=; G=(N, u, v, A); Cmax := longest path-length in G between u and v 2. iM-M0 do // solving a single machine problem a. for all operations o=(i,j) on machine i do - find longest paths u-o and o-v of lengths lu,o and lo,v, say, - define release time rij = lu,o, due date dij = Cmax - (lo,v -pij) b. for this single machine problem on i: determine L*max(i) with choices D*(i) 3. 4. k := arg max iM0 L*max(i) ; // decide for bottleneck machine k Insert arcs D(k)=D*(k) in G and update Cmax // Cmax may increase iM0-{k} do // Re-sequencing ‘decided’ machines a. remove D(i) from G and recompute Cmax b. recompute D*(i) as in step 2 above c. insert D(i)= D*(i) in G and update Cmax // Cmax may decrease 5. M0:= M0 {k}; if M0<M then (add delayed precedence and) return to step 2. Operational Research & Management Operations Scheduling 27 Discussion Procedure continues until all disjunctive arcs have been added Watch out for cycles, because of other (scheduled) machines – delayed precedence constraints may be required, see example in book Very effective – Relatively fast – Good solutions – More general Job Shop problems can be solved as well ‘Just a heuristic’ – No guarantee of optimum – The subproblem Max. Lateness, 1 | rj , prec | Lmax , is NP-hard Operational Research & Management Operations Scheduling 28 Discussion Shifting bottleneck can be applied generally Basic idea – Solve problem “one variable at a time” – Determine the “most important” variable – Find the best value of that variable – Move on to the “second most important” …. – Here we treat each machine as a variable Operational Research & Management Operations Scheduling 30 Topic 3 Branch & Bound for Job Shop Scheduling Problems Operational Research & Management Operations Scheduling Branch and Bound Minimize makespan Notation – operation (i,j) has duration pij – Let W denote operations whose predecessors have all been scheduled – Let rij be the earliest possible starting time of (i,j) in W. FIRST SUBJECT: How to branch to active schedules Operational Research & Management Operations Scheduling 32 Branching In the optimal schedule each machine has some order for its operations: let machine i has first (i, j1), then (i, j2) etc. In partial schedules, B&B subproblems at level k, it is decided for [some] machines i, in ancestor B&B nodes, which operations are (i,j1), (i,j2),..., (i, jk(i) ) [possibly k(i)=0 –if i has no decisions yet] Ancestor choices New choices: for some machine i* decide on a next operation (i*, jk(i)+1)=(i*, j') (i*, jk(i)+1)=(i*, j''') (i*, jk(i)+1)=(i*, j'') !Avoid partial schedules that are not active! Operational Research & Management Operations Scheduling 33 Which operations can be next in active schedule? { first of unscheduled operations for each job} t ( ) min rij pij ri* j 0 pi* j 0 // first finish (i, j ) '(i*) {(i*, j ) : operations on i * with release ri* j t ()} Machine i* If active, a schedule can have (i*, j) ' as the next i*-operation, but not (i*,k) ' (i*, j) (i*, j0) 0 t Operational Research & Management (i(i*,k) *, k ) ' (i*, j0) ri* j t() ri* k Operations Scheduling 34 ' is a subset of , why? Suppose (i*, j) in ' is not part of : i.e., some other operation, say (i1, j) is first for job j. (i1, j) is by definition in and to be scheduled before (i*, j) Gant-Chart of operations of j: and of j0: Then: ri* j0 + pi* j0 = t() <= ri1 j + pi1 j <= ri* j, (i*, j) (i1, j) (i*, j0) t() showing that (i*,j) is cannot be part of ' {(i*, j) on i*| ri* j t ()} Operational Research & Management Operations Scheduling 35 Generating Active Schedules Step 1. (Initialize) – Let contain the first operations of each job; rij = 0 for all (i,j) ; Step 2. (Machine selection) – Compute of current partial schedule: time t () – i* = associated machine min rij pij (i, j ) Step 3. (Branching) // extends current schedule in all active ways ri* j t () – Let ’ consist of operations (i*, j) on machine i* with – For each (i*, j) in ’ extend current partial schedule with (i*, j) next on i* – For each thus generated, extended partial schedule: a. delete (i*, j) from , insert immediate follower (k, j) in , b. return with this schedule, as current, to step 2. Operational Research & Management Operations Scheduling 36 Branching Tree ancestor choices Some machine i* decides on next operation (i*, jk(i)+1)=(i*, j') (i*, jk(i)+1)=(i*, j''') (i*, jk(i)+1)=(i*, j'') Generating active schedules, that is not all choices, only operations (i*, j' ) of ' Operational Research & Management Operations Scheduling 37 On Example 0 Source (1,1) 0 (2,2) 8 0 10 (1,2) 4 (1,3) (2,1) 3 (2,3) 8 (4,2) 7 (3,1) 4 5 6 (3,2) 3 (4,3) Level 1 root {(1,1), (2, 2), (1,3)} t () min{0 10, 0 8, 0 4} 4 i* 1 ' {(1,1), (1,3)} Operational Research & Management Sink (1,1) 22 (1,3) Branch at level 1 for possibilities ’ of (1, j1) at i* =1 Operations Scheduling 38 Level 1: when (1,1) is first on machine 1 (1,1) 0 Source 0 10 (2,2) 8 10 (2,1) (3,1) 4 10 (1,2) 3 0 (1,3) 8 4 (2,3) (4,2) 7 5 (3,2) 6 Sink 3 (4,3) Cmax >= 24 Disjunctive Arcs Operational Research & Management Operations Scheduling 39 Level 1: when (1,3) is first on machine 1 (1,1) 10 (2,1) 8 (3,1) 4 0 Source 0 (2,2) 0 8 (1,2) 3 (4,2) 5 (3,2) 4 4 4 (1,3) (2,3) 7 6 Sink 3 (4,3) Cmax >= 26 Disjunctive Arcs Operational Research & Management Operations Scheduling 40 Branching Tree Start, no disjunctive arcs LB=22 (1,1) scheduled first on machine 1 (1,3) scheduled first on machine 1 LB = 24 LB = 26 Operational Research & Management Operations Scheduling 41 Next branching: at subproblem (1,1) (1,1) 10 (2,1) 8 (3,1) 4 0 10 8 10 6 3 5 0 Source (2,2) (1,2) (4,2) (3,2) 0 3 7 4 (1,3) (2,3) (4,3) Level 2 {(2,2), (2,1), (1,3)} t () min{0 8, 10 8, 10 4} 8 Sink root 22 (1,1) (1,3) i* 2 ' {(2,2)} Operational Research & Management (2,2) Operations Scheduling 42 Level 2: Extending to (2,2) as first on machine 2 As yet no new disjunctive Arcs (1,1) 0 Source 0 8 8 (2,2) 0 10 10 (1,2) (2,1) 3 8 (4,2) (3,1) 5 4 (3,2) 6 Sink 8 (1,3) 4 (2,3) 7 3 (4,3) Still LB=24 Operational Research & Management Operations Scheduling 43 Branching Tree LB=22, no disjunctive arcs (1,1) scheduled first on machine 1 LB = 24 (1,3) scheduled first on machine 1 (1,1) first on M1 and (2,2) first on M2 LB = 26 LB = 24 Operational Research & Management Operations Scheduling 44 Lower Bounds Lower bounds – Length of critical path in G(D’). – Linear programming relaxation. – Very quick but not very tight Less quick but tighter Maximum Lmax over all machines Like in Shifting-Bottleneck Heuristic slowest (m NP-hard problems), but tightest ! Operational Research & Management Operations Scheduling 45