COMP 6651 Fall 2013 B Jaumard 18 Dynamic Prog Assembly Line Scheduling Knapsack

Comp 6651 fall 2013 b jaumard 18 dynamic prog

This preview shows page 24 - 36 out of 90 pages.

COMP 6651 / Fall 2013 - B. Jaumard 18
Image of page 24
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 3 (2/3) . FastestWay ( a , t , e , x , n ) . . . . . f [ 1 , 1 ] = e [ 1 ] + a [ 1 , 1 ] ; f [ 2 , 1 ] = e [ 2 ] + a [ 2 , 1 ] ; for ( j = 2 ; j n , j + + ) if ( f [ 1 , j - 1 ] + a [ 1 , j ] f [ 2 , j - 1 ] + t [ 2 , j - 1 ] + a [ 1 , j ] ) { f [ 1 , j ] f [ 1 , j - 1 ] + a [ 1 , j ]; l [ 1 , j ] 1 ; } else { f [ 1 , j ] f [ 2 , j - 1 ] + t [ 2 , j - 1 ] + a [ 1 , j ]; l [ 1 , j ] 2 ; } ( end elseIf ) if ( f [ 2 , j - 1 ] + a [ 2 , j ] f [ 1 , j - 1 ] + t [ 1 , j - 1 ] + a [ 2 , j ] ) { f [ 2 , j ] f [ 2 , j - 1 ] + a [ 2 , j ]; l [ 2 , j ] 2 ; } else { f [ 2 , j ] f [ 1 , j - 1 ] + t [ 1 , j - 1 ] + a [ 2 , j ] ; l [ 2 , j ] 1 ; } ( end elseIf ) end for if ( f [ 1 , n ] + x [ 1 ] f [ 2 , n ] + x [ 2 ] ) { f * f [ 1 , n ] + x [ 1 ]; l * 1 ; } else { f * f [ 2 , n ] + x [ 2 ]; l * 2 ; } end elseIf COMP 6651 / Fall 2013 - B. Jaumard 19
Image of page 25
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (3/3) j 1 2 3 4 5 6 f 1 [ j ] 9 18 20 24 32 35 f 2 [ j ] 12 16 22 25 30 37 f * = 38 j 2 3 4 5 6 l 1 [ j ] 1 2 1 1 2 l 2 [ j ] 1 2 1 2 2 l * = 1 COMP 6651 / Fall 2013 - B. Jaumard 20
Image of page 26
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 4 (1/2) Step 4 : Construct an optimal solution from computer solution , i.e., Constructing the fastest way through the factory. It is done from computed values f i [ j ] , f * , l i [ j ] , l * . . PRINT-STATIONS(l, l * , n ) . . . . . 1 i l * 2 print "line " i ", station " n 3 for j n downto 2 4 do i l i [ j ] 5 print "line " i ", station " j - 1 j 2 3 4 5 6 l 1 [ j ] 1 2 1 1 2 l 2 [ j ] 1 2 1 2 2 l * = 1 line 1, station 6 line 2, station 5 line 2, station 4 line 1, station 3 line 2, station 2 line 1, station 1 COMP 6651 / Fall 2013 - B. Jaumard 21
Image of page 27
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l * = 1 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 28
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l 1 [ 6 ] = 2 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 29
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l 2 [ 5 ] = 2 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 30
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l 2 [ 4 ] = 1 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 31
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l 1 [ 3 ] = 2 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 32
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming: Step 2 (2/2) l 2 [ 2 ] = 1 COMP 6651 / Fall 2013 - B. Jaumard 22
Image of page 33
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Knapsack Problem COMP 6651 / Fall 2013 - B. Jaumard 23
Image of page 34
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions The 0/1 Knapsack Problem (1/2) Given : A set S of n items, with each item i having w i a positive weight b i a positive benefit Goal : Choose items with maximum total benefit but with weight at most W .
Image of page 35
Image of page 36

You've reached the end of your free preview.

Want to read all 90 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes