Algorithms Analysis: Minimum and Maximum Alg
Algorithms Analysis: Minimum and Maximum Alg
lecture 8
• Simple subproblems
– We should be able to break the original problem to smaller
subproblems that have the same structure
• Overlapping sub-problems
– there exist some places where we solve the same subproblem more
than once.
Steps to Designing a
Dynamic Programming Algorithm
1. Characterize optimal substructure
• As you go farther and farther to the right in this sequence, the ratio of a
term to the one before it will get closer and closer to the Golden Ratio.
• Our recursion tree has only 0s and 1s as leaves, thus we have 1.6 n
summations
The jth station on line 1 (S1,j) performs the same function as the jth
station on line 2 (S2,j ).
There is also an entry time (ei) for the chassis( )هيكلto enter
assembly line i and an exit time (xi) for the completed auto to exit
assembly line i.
Ex1:Assembly-line scheduling
•(Time between adjacent stations are nearly 0).
Problem Definition
• Problem: Given all these costs, what stations
should be chosen from line 1 and from line 2 for
minimizing the total time for car assembly.
Optimal Substructure.
Example
Step 2: Recursive Solution
• Define the value of an optimal solution recursively in
terms of the optimal solution to sub-problems
• Sub-problem here
– finding the fastest way through station j on both lines (i=1,2)
– Let fi [j] be the fastest possible time to go from starting point
through Si,j
• We also define
– l*: the line whose station n is used in a fastest way
through the entire factory
Step 2: Recursive Solution
• Using the values of l* and li[j] shown in Figure (b) in next
slide, we would trace a fastest way through the factory shown
in part (a) as follows