Sequence-Dependent Setup Problems Contents 1. An algorithm which gives an optimal schedule with the minimum makespan with sequence-dependent setup times 1 | Sjk | Cmax Literature: • Scheduling, Theory, Algorithms, and Systems, Michael Pinedo, Prentice Hall, 1995, or new: Second Addition, 2002, Chapter 3. • “Sequencing a One State-Variable Machine: A Solvable Case of the Travelling Salesman Problem” Gilmore, Gomory, Operations Research 12, 1964, pages 655-679 1 Single machine: rj=0, no sequence dependent setup times Cmax p j j 1 | Sjk | Cmax NP hard • a single real variable which describes each job job j: to start the job the machine must be in state aj , at the completion of the job the machine state is bj sjk = | ak - bj | job k follows job j • Travelling Salesman Problem with n+1 cities j0, j1, …,jn, j0 k = (j) travelling salesman leaving city j for city k 2 0 2 3 1 bk bj b2 b1 0 2 {0, 1, 2, 3} {2, 3, 1, 0} (0) = 2 3 1 (1) = 3 (2) = 1 {0, 1, 2, 3} {2, 1, 3, 0} (3) = 0 a(j) a(k) a(2) a(1) cost of going from 1 to (1) is | a(1) - b1 | 3 Swap I(j,k) applied to a permutation produces another permutation ’: ’(k) = (j) ’(j) = (k) ’(l) = (l), l j , k 5 5 1 4 4 2 3 6 11 1 7 2 3 6 11 7 8 8 10 9 10 9 4 a(k) bk change in cost due to swap I(j, k) a(j) bj 2(b a) || [a, b] || 2(a b) if if ba ba Lemma. If the swap causes two arrows that did nor cross earlier to cross, then the cost of the tour C I(j,k) increases and vice versa. C I(j, k) = || [bj, bk] [a (j), a (k)] || Lemma. Let * be a permutation that ranks a, that is 5 j > k implies a (j) > a (k), then * is optimal with respect to cost. G undirected graph where arcs link the jth and (j)th nodes, j=1,…,n. Spanning tree - a minimal set of additional arcs that connect an unconnected graph. 2 3 1 4 4 6 7 9 10 12 15 9 16 11 4 6 7 13 12 5 8 14 6 7 13 10 3 1 5 8 14 2 3 1 5 8 11 2 15 9 16 11 14 13 10 16 15 12 6 Theorem. Assume that G has p components. Let I(j1, k1), …, I(jp-1, kp-1), be the swaps corresponding to the arcs of a spanning tree G . The arcs may be taken in any order. Then the permutation ’ given by ’= I(j1, k1), …, I(jp-1, kp-1) is a tour. Lemma. There is a minimal cost spanning tree for G that contains only arcs Rj, j+1. 7 b3=10 a(3)=11 b2=6 a(2 )=4 b1=1 b3=10 a(1) =2 a(3)=11 b2=6 b1=1 C I(1, 2) = || [1,6] [2,4] || = 2 (4-2) = 4 C I(2, 3) = || [6,10] [4,11] || = 2 (10-6) = 8 b3=10 a(3)=11 b2=6 a(2 )=4 a(2 )=4 a(1) =2 a(1) =2 I(1, 2) then I(2, 3) C I(2, 3) = || [6,10] [2,11] || = 2 (10-6) = 8 b1=1 I(2, 3) then I(1, 2) C I(1, 2) = || [1,6] [2,11] || 8 = 2 (6-2) = 8 CHANGED! A node is of Type 1 A node is of Type 2 if bj a(j) if bj > a(j) A swap is of Type 1 A swap is of Type 2 if lower node is of Type 1 if lower node is of Type 2 (arrow points up) (arrow points down) If swaps I(j, j+1) of Type 1 are performed in decreasing order of the node indices, followed by swaps of Type 2 in increasing order of the node indices then a single tour is obtained without changing any C* I(j, j+1) involved in the swaps 9 Algorithm + Example 7 jobs bj aj 1 7 15 16 26 22 40 18 3 4 19 45 31 34 Step 1. Arrange the bj in order of size and renumber the jobs so that b1 b2 ... bn Arrange the aj in order of size. The permutation mapping * is defined by * (j) = k, k being such that ak is the jth smallest of the a. 10 a4=45 b7=40 a6=34 b6=31 b5=26 a5=22 a7=18 a3=16 b4=19 b3=15 a1=7 b2=3 b1=1 jobs bj aj a*(j) *(j) 1 1 7 4 2 2 3 4 7 1 a2=4 3 15 16 16 3 4 19 45 18 7 5 26 22 22 5 6 31 34 34 6 7 40 18 45 4 11 Step 2. Form an undirected graph with n nodes and undirected arcs connecting the jth and *(j) nodes, j=1,…n . If the current graph has only one component then STOP ; otherwise go to Step 3. 2 1 3 7 4 6 5 12 Step 3. Compute the swap costs C *I(j, j+1) for j=1,…,n C* I(j, j+1) = 2 max ( min (bj+1, a*(j+1)) - max (bj, a*(j)) ), 0 ) C* I(1, 2) = 2 max ( (3-4), 0 ) = 0 C* I(2, 3) = 2 max ( (15-7), 0 ) = 16 C* I(3, 4) = 2 max ( (18-16), 0 ) = 4 C* I(4, 5) = 2 max ( (22-19), 0 ) = 6 C* I(5, 6) = 2 max ( (31-26), 0 ) = 10 C* I(6, 7) = 2 max ( (40-34), 0 ) = 12 13 Step 4. Select the smallest value C* I(j, j+1) such that j is in one component and j+1 in another. In case of a tie for smallest, choose any. Insert the undirected arc Rj, j+1 into the graph. Repeat this step until all the components in the undirected graph are connected. 2 1 2 1 3 4 7 2 1 3 4 6 5 4 7 4 6 5 4 6 6 10 16 3 4 7 4 6 1 3 4 7 2 5 6 6 5 10 14 Step 5. Divide the arcs added in Step 4 into two groups. Those Rj, j+1 for which bj a(j) go in group 1, those for which bj > a(j) go in group 2. arcs R2, 3 R3, 4 R4, 5 R5, 6 bj b2=3 b3=15 b4=19 b5=26 a*(j) a1=7 a3=16 a7=18 a5=22 group 1 1 2 2 Step 6. Find the largest index j1 such that Rj1, j1+1 is in group 1. Find the second largest index, and so on, up to jl assuming there are l elements in the group. Find the smallest index k1 such that Rk1, k1+1 is in group 2. Find the second smallest index, and so on, up to km assuming there are m elements in the group. j1 = 3, j2 = 2, k1 = 4, k2 = 5 15 Step 7. The optimal tour ** is constructed by applying the following sequence of swaps on the permutation *: ** = * I(j1, j1+1) I(j2, j2+1) … I(jl, jl+1) I(k1, k1+1) I(k2, k2+1) … I(km, km+1) ** = * I(3,4) I(2,3) I(4,5) I(5,6) Type 1 Type 2 16 a4=45 a4=45 b7=40 b7=40 a6=34 a6=34 b6=31 b6=31 b5=26 b5=26 a5=22 a7=18 a3=16 b4=19 b3=15 b4=19 b3=15 a1=7 a1=7 b2=3 b1=1 a2=4 * I(3,4) a5=22 a7=18 a3=16 b2=3 b1=1 a2=4 * I(3,4) I(2,3) 17 a4=45 a4=45 b7=40 b7=40 a6=34 a6=34 b6=31 b6=31 b5=26 b5=26 b4=19 b3=15 a5=22 a7=18 a3=16 b4=19 b3=15 a1=7 a1=7 b2=3 b1=1 a2=4 * I(3,4) I(2,3) I(4,5) a5=22 a7=18 a3=16 b2=3 b1=1 a2=4 ** = * I(3,4) I(2,3) I(4,5) I(5,6) 18 a4=45 b7=40 a6=34 b6=31 b5=26 a5=22 a7=18 a3=16 b4=19 b3=15 a1=7 b2=3 b1=1 a2=4 ** = * I(3,4) I(2,3) I(4,5) I(5,6) The optimal tour is: 12745631 The cost of the tour is: 3 + 15 + 5 + 3 + 8 + 15 + 8 =19 57 Summary 1 | Sjk | Cmax , sjk = | ak - bj | a polynomial time algorithm is given 1 | Sjk | Cmax is NP hard 20