You are on page 1of 4

Dynamic Programming (Ch. III.15) Example 1: Assembly Line Sche !ling (Ch. 15.

1) "i#en:
two assembly lines, line 1 and line 2, with line index i $ 1%& each assembly line has n stations, with station index '$1%(% n; Example n=6, with j=1,2,,6; station j, on either line, er!orms the same tas" j time !or er!ormin# tas" j on line i is ai%'; $xam le% s2,& is the time !or er!ormin# tas" & on line 2. '! co(rse the times !or er!ormin# tas" j on di!!erent lines may be di!!erent, i.e. in #eneral s1,j )s2,j time !or enterin# assembly line i is ei; time !or enterin# assembly line i is xi; a!ter the com letion o! any tas" j on a #i*en line, it is ossible to contin(e the assembly on the other line; o! co(rse the art needs to #et to the other line, th(s it will re+(ire some trans!er time; let,s denote with )i%' the time !or trans!errin# a art a!ter com letion o! tas" j on line i to the other line. $xam le% t2,& is the trans!er time !rom line 2 a!ter er!ormin# tas" &.

*in : -he se+(ence o! stations !rom lines 1 and 2 !or which the assembly line time is minimal
Brute Force: $n(merate all ossible s(bstation sets. .n!ort(nately there are 2n s(bsets o! a set o! n elements. -h(s the roblem has a oisono(s +(&n) time. Main Idea for Solution: /or each line trac" the !astest time !or er!ormin# all tas"s ( to and incl(din# tas" j, with tas" j com leted on this line; 0lon# the way record the stations assed on the !astest assembly ro(te. 1hen this is done !or all tas"s, incl(din# tas" n and the corres ondin# exit time, the smallest time !or !inishin# tas" n on a #i*en line is the o timal sol(tion;

2ac"trac" to !ind the station se+(ence (sed in the o timal sol(tion. Illustration on the Example in Figure 1 and Generalization with the help of Figure 2 Figures 1!"2 and 1!"1 in #$%S&: 3et, !ind the !astest way !or com letin# tas"s 1, 2,, j on line 1, and line 2. 3et,s denote with ,1-'. the !astest time !or com letin# tas" j on line 1, and similarly with ,&-'. the !astest time !or com letin# tas" j on line 2 -here is little choice at the be#innin#% !1415 = e1 6 a1,1 = 267 = 8 !2415 = e2 6 a2,1 = 96: = 12 2(t !or com letin# the second tas" we can either ta"e the rod(ct !rom line 1, or !rom line 2 and trans!er it to line 1. -he !astest time is the smaller o! the two ossibilities% !astest way o! com letin# tas" 1 on line 1 6 a1,1 !1425 = min !astest way o! com letin# tas" 1 on line 2 6 trans!er time 6 a1,1 = !2415 6 t2,1 6 a1,1 = 126268=21 i.e. the !astest time to com lete tas" 1 on line 1 is !1425 = 1: and to achie*e this the re*io(s tas", here tas" 1, was com leted on line 1. 1e need to remember where the re*io(s tas" was com leted in order to trace bac" the station se+(ence on the !astest way. 3et,s l1-'. denote the line n(mber on the !astest way !14j5 at which the re*io(s tas", i.e. tas" j;1, was er!ormed. <n #eneral !astest way o! com letin# re*io(s tas", i.e. tas" j;1, on line 1 !14j5 = min !astest way o! com letin# re*io(s tas", i.e. tas" j;1, on line 2 6 trans!er time 6 a1,j 6 a1,j = !1415 6 a1,1 = 868 = 1/ = 1:

or ,1-'01. 1 a1%' ,1-'. $ min ,&-'01. 1 )&%' 1 a1%' and !or the minim(m, we sa*e the line n(mber where the re*io(s tas" was achie*ed in l1-'.. =imilarly ,&-'01. 1 a&%' ,&-'. $ min ,1-'01. 1 )1%' 1 a&%' and !or the minim(m, we sa*e the line n(mber where the re*io(s tas" was achie*ed in l&-'.. *ig!re 1: Assembly line 2i)h 3 s)a)ions 7 2 2 8 & & 1 9 & : 9 9 &

9 :

2 5

1 6

2 9

2 5

1 7

*ig!re &: Assembly line 2i)h n s)a)ions a1,1 e1 t1,1 a1,2 t1,2 a1,j;1 a1,1 t1,j;1 a1,j t1,j a1,n;1 t1,n;1 a1,n x1

e2 a2,1

t2,1 a2,2

t2,2 a2,j;1

t2,j;1 a2,j

t2,j a2,n;1

t2,n;1 a2,n

x2

-he !i4j5 and li4j5 tables below ill(strates the times !or the exam le in /i#(re 1 0t each ste in the !i4j5 the minim(m *al(e and the li4j5 are bold and (nderlined. -he !astest way !or com letin# all tas"s and exitin# the assembly is denoted by ,4 and the exit line with l4 i > j ,1-'. ,&-'. 1 1% 267 = 5 2% 96: = 1& i > j l1-'. l&-'. 2 1: 8 68 = 1/ 2% 126268 = 21 2% 126 5 = 17 1: 86265 = 13 2 1 1 & 1% 1: 6& = 21 &: 16616& = &6 &: 16 66 = && 1% 1:6&66 = 27 & 2 2 9 1: 2? 69 = &7 2% 226269 = 2: 2% 22 69 = 26 1: 2?6169 = &5 9 1 1 i j 1 = lA (i = li4j5) 6 2 5 2 9 1 & 2 2 2 5 1% 29 6: = 8& 2% 25626: = &5 &% 25 65 = 86 1% 296&65 = &2 5 1 & o(t (t line 1, station 6 line 2, station 5 line 2, station 9 line 1, station & line 2, station 2 line 2, station 1 6 1% &2 69 = &6 &% &?6169 = 85 &% &? 67 = 89 1% &26967 = 9& 6 & 2 exit &56& = 8/ ,4% l4$1 &762 == &8

l4$1

@rint=tations(1,n) i = lA rint(Bline iB, BstationB n) !or j = n downto 2 i = li4j5 rint(Bline iB, BstationB j;1)

You might also like