Unit 4: Dynamic Programming

Size: px
Start display at page:

Download "Unit 4: Dynamic Programming"

Transcription

1 Unit 4: Dynamic Programming Course contents: Assembly-line scheduling Matrix-chain multiplication Longest common subsequence Optimal binary search trees Applications: Rod cutting, optimal polygon triangulation, flipchip routing, technology mapping for logic synthesis Reading: Chapter 15 1 Dynamic Programming (DP) vs. Divide-and-Conquer Both solve problems by combining the solutions to subproblems. Divide-and-conquer algorithms Partition a problem into independent subproblems, solve the subproblems recursively, and then combine their solutions to solve the original problem. Inefficient if they solve the same subproblem more than once. Dynamic programming (DP) Applicable when the subproblems are not independent. DP solves each subproblem just once. 1

2 Assembly-line Scheduling station S 1,1 S 1, S 1,3 S 1,n-1 S 1,n line 1 a 1,1 a 1, a 1,3 a 1,n-1 a 1,n chassis enters e 1 e t 1,1 t,1 t 1, t, t 1,n-1 t,n-1 x 1 x auto exits line a,1 a, a,3 a,n-1 a,n station S,1 S, S,3 S,n-1 S,n An auto chassis enters each assembly line, has parts added at stations, and a finished auto exits at the end of the line. S i,j : the jth station on line i a i,j : the assembly time required at station S i,j t i,j : transfer time from station S i,j to the j+1 station of the other line. e i (x i ): time to enter (exit) line i 3 Optimal Substructure line 1 S 1,1 S 1, S 1,3 S 1,n-1 S 1,n chassis enters e 1 e t 1,1 t,1 t 1, t, a 1,1 a 1, a 1,3 a 1,n-1 a 1,n x1 t 1,n-1 t,n-1 x auto exits line a,1 a, a,3 a,n-1 a,n S,1 S, S,3 S,n-1 S,n Objective: Determine the stations to choose to minimize the total manufacturing time for one auto. Brute force: ( n ), why? The problem is linearly ordered and cannot be rearranged => Dynamic programming? Optimal substructure: If the fastest way through station S i,j is through S 1,j-1, then the chassis must have taken a fastest way from the starting point through S 1,j-1. 4

3 Overlapping Subproblem: Recurrence line 1 S 1,1 S 1, S 1,3 S 1,n-1 S 1,n chassis enters e 1 e t 1,1 t,1 t 1, t, a 1,1 a 1, a 1,3 a 1,n-1 a 1,n x1 t 1,n-1 t,n-1 x auto exits line a,1 a, a,3 a,n-1 a,n S,1 S, S,3 S,n-1 S,n Overlapping subproblem: The fastest way through station S 1,j is either through S 1,j-1 and then S 1,j, or through S,j-1 and then transfer to line 1 and through S 1,j. f i [j]: fastest time from the starting point through S i,j e1 a1,1 if j 1 f 1[ j] min( f 1[ j 1] a1, j, f [ j 1] t, j 1 a1, j) if j The fastest time all the way through the factory f* = min(f 1 [n] + x 1, f [n] + x ) 5 Computing the Fastest Time Fastest-Way(a, t, e, x, n) 1. f 1 [1] = e 1 + a 1,1. f [1] = e + a,1 3. for j = to n 4. if f 1 [j-1] + a 1,j f [j-1] + t,j -1 + a 1,j 5. f 1 [j] = f 1 [j-1] + a 1,j 6. l 1 [j] = 1 7. else f 1 [j] = f [j-1] + t,j -1 + a 1,j 8. l 1 [j] = 9. if f [j-1] + a,j f 1 [j-1] + t 1,j -1 + a,j 10. f [j] = f [j-1] + a,j 11. l [j] = 1. else f [j] = f 1 [j-1] + t 1,j -1 + a,j 13. l [j] = if f 1 [n] + x 1 f [n] + x 15. f* = f 1 [n] + x l* = else f* = f [n] + x 18. l* = Running time? Linear time!! l i [j]: The line number whose station j-1 is used in a fastest way through S i,j 6 3

4 Constructing the Fastest Way Print-Station(l, n) 1. i = l*. Print line i, station n 3. for j = n downto 4. i = l i [j] 5. Print line i, station j-1 line 1, station 6 line, station 5 line, station 4 line 1, station 3 line, station line 1, station 1 S 1,4 S 1,1 S 1, S 1,3 S 1,5 S 1,6 line chassis enters auto exits line S,1 S, S,4 S,3 S,5 S,6 7 An Example S 1,4 S 1,1 S 1, S 1,3 S 1,5 S 1,6 line chassis enters auto exits line S,1 S, S,4 S,3 S,5 S,6 f 1 [j] f [j] j l 1 [j] l [j] 1 1 f* = 38 l* = 1 8 4

5 Dynamic Programming (DP) Typically apply to optimization problem. Generic approach Calculate the solutions to all subproblems. Proceed computation from the small subproblems to larger subproblems. Compute a subproblem based on previously computed results for smaller subproblems. Store the solution to a subproblem in a table and never recompute. Development of a DP 1. Characterize the structure of an optimal solution.. Recursively define the value of an optimal solution. 3. Compute the value of an optimal solution bottom-up. 4. Construct an optimal solution from computed information (omitted if only the optimal value is required). 9 When to Use Dynamic Programming (DP) DP computes recurrence efficiently by storing partial results efficient only when the number of partial results is small. Hopeless configurations: n! permutations of an n-element set, n subsets of an n-element set, etc. n Promising configurations: i n( n 1)/ i 1 contiguous substrings of an n-character string, n(n+1)/ possible subtrees of a binary search tree, etc. DP works best on objects that are linearly ordered and cannot be rearranged!! Linear assembly lines, matrices in a chain, characters in a string, points around the boundary of a polygon, points on a line/circle, the left-to-right order of leaves in a search tree, etc. Objects are ordered left-to-right Smell DP? 10 5

6 DP Example: Matrix-Chain Multiplication If A is a p x q matrix and B a q x r matrix, then C = AB is a p x r matrix q Ci [, j] Ai [, k] Bk [, j] k 1 time complexity: O(pqr). Matrix-Multiply(A, B) 1. if A.columns B.rows. error incompatible dimensions 3. else let C be a new A.rows * B.columns matrix 4. for i = 1 to A.rows 5. for j = 1 to B.columns 6. c ij = 0 7. for k = 1 to A.columns 8. c ij = c ij + a ik b kj 9. return C 11 DP Example: Matrix-Chain Multiplication The matrix-chain multiplication problem Input: Given a chain <A 1, A,, A n > of n matrices, matrix A i has dimension p i-1 x p i Objective: Parenthesize the product A 1 A A n to minimize the number of scalar multiplications Exp: dimensions: A 1 : 4 x ; A : x 5; A 3 : 5 x 1 (A 1 A )A 3 : total multiplications = 4 x x x 5 x 1 = 60 A 1 (A A 3 ): total multiplications = x 5 x x x 1 = 18 So the order of multiplications can make a big difference! 1 6

7 Matrix-Chain Multiplication: Brute Force A = A 1 A A n : How to evaluate A using the minimum number of multiplications? Brute force: check all possible orders? P(n): number of ways to multiply n matrices., exponential in n. Any efficient solution? The matrix chain is linearly ordered and cannot be rearranged!! Smell Dynamic programming? 13 Matrix-Chain Multiplication m[i, j]: minimum number of multiplications to compute matrix A i..j = A i A i +1 A j, 1 i j n. m[1, n]: the cheapest cost to compute A 1..n. matrix A i has dimension p i-1 x p i Applicability of dynamic programming Optimal substructure: an optimal solution contains within its optimal solutions to subproblems. Overlapping subproblem: a recursive algorithm revisits the same problem over and over again; only (n ) subproblems. 14 7

8 Bottom-Up DP Matrix-Chain Order A i dimension p i-1 x p i Matrix-Chain-Order(p) 1. n = p.length 1. Let m[1..n, 1..n] and s[1..n-1,..n] be new tables 3. for i = 1 to n 4. m[i, i] = 0 5. for l = to n // l is the chain length 6. for i = 1 to n l j = i+ l m[i, j] = 9. for k = i to j q = m[i, k] + m[k+1, j] + p i-1 p k p j 11. if q < m[i, j] 1. m[i, j] = q 13. s[i, j] = k 14. return m and s s 15 Constructing an Optimal Solution s[i, j]: value of k such that the optimal parenthesization of A i A i+1 A j splits between A k and A k+1 Optimal matrix A 1..n multiplication: A 1..s[1, n] A s[1, n] + 1..n Exp: call Print-Optimal-Parens(s, 1, 6): ((A 1 (A A 3 ))((A 4 A 5 ) A 6 )) Print-Optimal-Parens(s, i, j) 1. if i == j. print A i 3. else print ( 4. Print-Optimal-Parens(s, i, s[i, j]) 5. Print-Optimal-Parens(s, s[i, j] + 1, j) 6. print ) s

9 Top-Down, Recursive Matrix-Chain Order n 1 k 1 Recursive-Matrix-Chain(p, i, j) 1. if i == j. return 0 3. m[i, j] = 4. for k = i to j -1 5 q = Recursive-Matrix-Chain(p,i, k) + Recursive-Matrix-Chain(p, k+1, j) + p i-1 p k p j 6. if q < m[i, j] 7. m[i, j] = q 8. return m[i, j] Time complexity: ( n ) (T(n) > (T(k)+T(n-k)+1)). 17 Top-Down DP Matrix-Chain Order (Memoization) Complexity: O(n ) space for m[] matrix and O(n 3 ) time to fill in O(n ) entries (each takes O(n) time) Memoized-Matrix-Chain(p) 1. n = p.length - 1. let m[1..n, 1..n] be a new table. for i = 1 to n 3. for j = i to n 4. m[i, j] = 5. return Lookup-Chain(m, p,1,n) Lookup-Chain(m, p, i, j) 1. if m[i, j] <. return m[i, j] 3. if i == j 4. m[ i, j] = 0 5. else for k = i to j q = Lookup-Chain(m, p, i, k) + Lookup-Chain(m, p, k+1, j) + p i-1 p k p j 7. if q < m[i, j] 8. m[i, j] = q 9. return m[i, j] 18 9

10 Two Approaches to DP 1. Bottom-up iterative approach Start with recursive divide-and-conquer algorithm. Find the dependencies between the subproblems (whose solutions are needed for computing a subproblem). Solve the subproblems in the correct order.. Top-down recursive approach (memoization) Start with recursive divide-and-conquer algorithm. Keep top-down approach of original algorithms. Save solutions to subproblems in a table (possibly a lot of storage). Recurse only on a subproblem if the solution is not already available in the table. If all subproblems must be solved at least once, bottom-up DP is better due to less overhead for recursion and for maintaining tables. If many subproblems need not be solved, top-down DP is better since it computes only those required. 19 Longest Common Subsequence Problem: Given X = <x 1, x,, x m > and Y = <y 1, y,, y n >, find the longest common subsequence (LCS) of X and Y. Exp: X = <a, b, c, b, d, a, b> and Y = <b, d, c, a, b, a> LCS = <b, c, b, a> (also, LCS = <b, d, a, b>). Exp: DNA sequencing: S1 = ACCGGTCGAGATGCAG; S = GTCGTTCGGAATGCAT; LCS S3 = CGTCGGATGCA Brute-force method: Enumerate all subsequences of X and check if they appear in Y. Each subsequence of X corresponds to a subset of the indices {1,,, m} of the elements of X. There are m subsequences of X. Why? 0 10

11 Optimal Substructure for LCS Let X = <x 1, x,, x m > and Y = <y 1, y,, y n > be sequences, and Z = <z 1, z,, z k > be LCS of X and Y. 1. If x m = y n, then z k = x m = y n and Z k-1 is an LCS of X m-1 and Y n-1.. If x m y n, then z k x m implies Z is an LCS of X m-1 and Y. 3. If x m y n, then z k y n implies Z is an LCS of X and Y n-1. c[i, j]: length of the LCS of X i and Y j c[m, n]: length of LCS of X and Y Basis: c[0, j] = 0 and c[i, 0] = 0 1 Top-Down DP for LCS c[i, j]: length of the LCS of X i and Y j, where X i = <x 1, x,, x i > and Y j =<y 1, y,, y j >. c[m, n]: LCS of X and Y. Basis: c[0, j] = 0 and c[i, 0] = 0. The top-down dynamic programming: initialize c[i, 0] = c[0, j] = 0, c[i, j] = NIL TD-LCS(i, j) 1. if c[i,j] == NIL. if x i == y j 3. c[i, j] = TD-LCS(i-1, j-1) else c[i, j] = max(td-lcs(i, j-1), TD-LCS(i-1, j)) 5. return c[i, j] 11

12 Find the right order to solve the subproblems To compute c[i, j], we need c[i-1, j-1], c[i-1, j], and c[i, j-1] b[i, j]: points to the table entry w.r.t. the optimal subproblem solution chosen when computing c[i, j] Bottom-Up DP for LCS LCS-Length(X,Y) 1. m = X.length. n = Y.length 3. let b[1..m, 1..n] and c[0..m, 0..n] be new tables 4. for i = 1 to m 5. c[i, 0] = 0 6. for j = 0 to n 7. c[0, j] = 0 8. for i = 1 to m 9. for j = 1 to n 10. if x i == y j 11. c[i, j] = c[i-1, j-1]+1 1. b[i, j] = 13. elseif c[i-1,j] c[i, j-1] 14. c[i,j] = c[i-1, j] 15. b[i, j] = `` '' 16. else c[i, j] = c[i, j-1] 17. b[i, j] = 18. return c and b 3 Example of LCS LCS time and space complexity: O(mn). X = <A, B, C, B, D, A, B> and Y = <B, D, C, A, B, A> LCS = <B, C, B, A>. 4 1

13 Constructing an LCS Trace back from b[m, n] to b[1, 1], following the arrows: O(m+n) time. Print-LCS(b, X, i, j) 1. if i == 0 or j == 0. return 3. if b[i, j] == 4. Print-LCS(b, X, i-1, j-1) 5. print x i 6. elseif b[i, j] == 7. Print-LCS(b, X, i -1, j) 8. else Print-LCS(b, X, i, j-1) 5 Optimal Binary Search Tree Given a sequence K = <k 1, k,, k n > of n distinct keys in sorted order (k 1 < k < < k n ) and a set of probabilities P = <p 1, p,, p n > for searching the keys in K and Q = <q 0, q 1, q,, q n > for unsuccessful searches (corresponding to D = <d 0, d 1, d,, d n > of n+1 distinct dummy keys with d i representing all values between k i and k i+1 ), construct a binary search tree whose expected search cost is smallest. k p k p 1 k 1 k 4 p 4 k 1 k 5 d 0 d 1 k 3 k 5 p 3 p 5 d 0 d 1 k 4 d 5 q 0 q 1 d d 3 d 4 d 5 k 3 d 4 q q 3 q 4 q 5 d d

14 An Example i p i q i n p i n i 1 i 0 qi k 1 k (depth 0) k k 1 k k 5 d 0 d 1 k 3 k d 0 d 1 k 4 d 5 Cost =.80 d d 3 d 4 d 5 n n T i i T i i i 1 i 0 n n T i i T i i E[search cost in T ] = ( depth ( k ) 1) p ( depth ( d ) 1) q depth ( k ) p depth ( d ) q i 1 i 0 7 k 3 d d 3 d 4 Cost =.75 Optimal!! Optimal Substructure If an optimal binary search tree T has a subtree T containing keys k i,, k j, then this subtree T must be optimal as well for the subproblem with keys k i,, k j and dummy keys d i-1,, d j. Given keys k i,, k j with k r (i r j) as the root, the left subtree contains the keys k i,, k r-1 (and dummy keys d i-1,, d r-1 ) and the right subtree contains the keys k r+1,, k j (and dummy keys d r,, d j ). For the subtree with keys k i,, k j with root k i, the left subtree contains keys k i,.., k i-1 (no key) with the dummy key d i-1. k k 1 k 5 d 0 d 1 k4 d 5 k 3 d d 3 d

15 Overlapping Subproblem: Recurrence e[i, j] : expected cost of searching an optimal binary search tree containing the keys k i,, k j. Want to find e[1, n]. e[i, i -1] = q i-1 (only the dummy key d i-1 ). If k r (i r j) is the root of an optimal subtree containing keys k i,, k j and let wi (, j j j ) p l q l then l i l i 1 e[i, j] = p r + (e[i, r-1] + w(i, r-1)) + (e[r+1, j] +w(r+1, j)) = e[i, r-1] + e[r+1, j] + w(i, j) 1 Recurrence: qi if j i 1 ei [, j] min{ ei [, r 1] er [ 1, j] wi (, j)} if i j i r j k Node depths increase by 1 after merging two subtrees, and so do the costs k 3 k d d 3 d 4 d Computing the Optimal Cost Need a table e[1..n+1, 0..n] for e[i, j] (why e[1, 0] and e[n+1, n]?) Apply the recurrence to compute w(i, j) (why?) q if j i wi [, j] wi [, j 1] pj qj if i j i 1 1 Optimal-BST(p, q, n) 1. let e[1..n+1, 0..n], w[1..n+1, 0..n], and root[1..n, 1..n] be new tables. for i = 1 to n e[i, i-1] = q i-1 4. w[i, i-1] = q i-1 5. for l = 1 to n 6. for i = 1 to n l j = i+ l e[i, j] = 9. w[i, j] = w[i, j-1] + p j + q j 10. for r = i to j 11. t = e[i, r-1] + e[r+1, j] + w[i, j] 1. if t < e[i, j] 13. e[i, j] = t 14. root[i, j] = r 15. return e and root root[i, j] : index r for which k r is the root of an optimal search tree containing keys k i,, k j. e j i k 3 k 4 k 5 d d 3 d 4 d 5 15

16 Example e[1, 1] = e[1, 0] + e[, 1] + w(1,1) i = p e i = q j i i root j i w e[1, 5] = e[1, 1] + e[3, 5] + w(1,5) 5 1 = = k (r = ; r=1, 3?) j i k 1 k d 0 d 1 k d k d 4 d d 3 31 Appendix A: Rod Cutting Cut steel rods into pieces to maximize the revenue Assumptions: Each cut is free; rod lengths are integral numbers. Input: A length n and table of prices p i, for i = 1,,, n. Output: The maximum revenue obtainable for rods whose lengths sum to n, computed as the sum of the prices for the individual rods. length i price p i length i = 4 1 max revenue r 4 = 5+5 = Objects are linearly ordered (and cannot be rearranged)?? 3 16

17 Optimal Rod Cutting length i price p i max revenue r i If p n is large enough, an optimal solution might require no cuts, i.e., just leave the rod as n unit long. Solution for the maximum revenue r i of length i rn max( pn, r1 rn 1, r rn,..., rn 1 r1) max ( pi rn i) r 1 = 1 from solution 1 = 1 (no cuts) r = 5 from solution = (no cuts) r 3 = 8 from solution 3 = 3 (no cuts) r 4 = 10 from solution 4 = + r 5 = 13 from solution 5 = + 3 r 6 = 17 from solution 6 = 6 (no cuts) r 7 = 18 from solution 7 = or 7 = r 8 = from solution 8 = i n 33 Optimal Substructure length i price p i max revenue r i Optimal substructure: To solve the original problem, solve subproblems on smaller sizes. The optimal solution to the original problem incorporates optimal solutions to the subproblems. We may solve the subproblems independently. After making a cut, we have two subproblems. Max revenue r 7 : r 7 = 18 = r 4 + r 3 = (r + r ) + r 3 or r 1 + r 6 rn max( pn, r1 rn 1, r rn,..., rn 1 r1) Decomposition with only one subproblem: Some cut gives a first piece of length i on the left and a remaining piece of length n - i on the right. rn max ( pi 1 i n r n i 34 ) 17

18 Recursive Top-Down Solution r n max ( p 1 i n i r n i ) Cut-Rod(p, n) 1. if n == 0. return 0 3. q = - 4. for i = 1 to n 5. q = max(q, p[i] + Cut-Rod(p, n - i)) 6. return q Inefficient solution: Cut-Rod calls itself repeatedly, even on subproblems it has already solved!! Cut-Rod(p, 4) Cut-Rod(p, 3) 1, if n 0 n 1 T ( n) 1 T ( j), if n 0. j 0 T(n) = n Cut-Rod(p, 1) Cut-Rod(p, 0) Overlapping subproblems? 35 Top-Down DP Cut-Rod with Memoization Complexity: O(n ) time Solve each subproblem just once, and solves subproblems for sizes 0,1,, n. To solve a subproblem of size n, the for loop iterates n times. Memoized-Cut-Rod(p, n) 1. let r[0..n] be a new array. for i = 0 to n 3. r[i] = - 4. return Memoized-Cut-Rod -Aux(p, n, r) Memoized-Cut-Rod-Aux(p, n, r) 1. if r[n] 0. return r[n] 3. if n == 0 4. q = 0 5. else q = - 6. for i = 1 to n // Each overlapping subproblem // is solved just once!! 7. q = max(q, p[i] + Memoized-Cut-Rod -Aux(p, n-i, r)) 8. r[n] = q 9. return q 36 18

19 Bottom-Up DP Cut-Rod Complexity: O(n ) time Sort the subproblems by size and solve smaller ones first. When solving a subproblem, have already solved the smaller subproblems we need. Bottom-Up-Cut-Rod(p, n) 1. let r[0..n] be a new array. r[0] = 0 3. for j = 1 to n 4. q = - 5. for i = 1 to j 6. q = max(q, p[i] + r[j i]) 7. r[j] = q 8. return r[n] 37 Bottom-Up DP with Solution Construction Extend the bottom-up approach to record not just optimal values, but optimal choices. Saves the first cut made in an optimal solution for a problem of size i in s[i] Extended-Bottom-Up-Cut-Rod(p, n) 1. let r[0..n] and s[0..n] be new arrays. r[0] = 0 3. for j = 1 to n 4. q = - 5. for i = 1 to j 6. if q < p[i] + r[j i] 7. q = p[i] + r[j i] 8. s[j] = i 9. r[j] = q 10. return r and s Print-Cut-Rod-Solution(p, n) 1. (r, s) = Extended-Bottom-Up-Cut-Rod(p, n). while n > 0 3. print s[n] 4. n = n s[n] i r[i] s[i]

20 Appendix B: Optimal Polygon Triangulation Terminology: polygon, interior, exterior, boundary, convex polygon, triangulation? The Optimal Polygon Triangulation Problem: Given a convex polygon P = <v 0, v 1,, v n-1 > and a weight function w defined on triangles, find a triangulation that minimizes w( ). One possible weight function on triangle: w( v i v j v k )= v i v j + v j v k + v k v i, where v i v j is the Euclidean distance from v i to v j. 39 Optimal Polygon Triangulation (cont'd) Correspondence between full parenthesization, full binary tree (parse tree), and triangulation full parenthesization full binary tree full binary tree (n-1 leaves) triangulation (n sides) t[i, j]: weight of an optimal triangulation of polygon <v i-1, v i,, v j >. 40 0

21 Pseudocode: Optimal Polygon Triangulation Matrix-Chain-Order is a special case of the optimal polygonal triangulation problem. Only need to modify Line 9 of Matrix-Chain-Order. Complexity: Runs in (n 3 ) time and uses (n ) space. Optimal-Polygon-Triangulation(P) 1. n = P.length. for i = 1 to n 3. t[i,i] = 0 4. for l = to n 5. for i = 1 to n l j = i + l t[i, j] = 8. for k = i to j-1 9. q = t[i, k] + t[k+1, j ] + w( v i-1 v k v j ) 10. if q < t[i, j] 11. t[i, j] = q 1. s[i,j] = k 13. return t and s 41 Appendix C: LCS for Flip-Chip Routing Lee, Lin, and Chang, ICCAD-09 Given: A set of driver pads on driver pad rings, a set of bump pads on bump pad rings, a set of nets/connections Objective: Connect driver pads and bump pads according to a predefined netlist such that the total wirelength is minimized driver pad bump pad ring net assignment (1) () 4 1

22 Minimize # of Detoured Nets by LCS Cut the rings into lines/segments (form linear orders) d 1 d 3 d 1 d 3 S b d n 1 n 3 d 4 n n 4 b 1 b b 3 b 4 n 3 b 1 n b n 1 b 3 n 4 b 4 (1) () net sequence S d n 1 n n 1 n 3 n 4 n 3 d 1 d d 1 d 3 d 4 d 3 b 1 b b 3 b 4 43 d 1 d 3 d 1 d d 1 d 3 d 4 d 3 n 3 n n 1 (3) (4) n 4 S d =[1,,1,3,4,3] S b =[3,,1,4] Need detour for only n 3 #Detours Minimization by Dynamic Programming Longest common subsequence (LCS) computation d 1 d d 3 d 1 d d 3 d 1 d d 3 b 3 b 1 b b 3 b 1 b b 3 b 1 b seq.1=<1,,3> (a) seq.=<3,1,> (b) Common subseq = <3> (c) LCS= <1,> Maximum planar subset of chords (MPSC) computation d 1 d d 3 d 1 d d 3 d 1 d d 3 b 3 b 1 b b 3 b 1 b b 3 b 1 b b 4 b 5 b 6 b 4 b 5 b 6 b 4 b 5 b 6 (d) chord set: {3,4,5} (e) subset:{3} Y.-W. Chang (f) MPSC = {4,5} 44

23 Supowit's Algorithm for Finding MPSC Supowit, Finding a maximum planar subset of a set of nets in a channel, IEEE TCAD, Problem: Given a set of chords, find a maximum planar subset of chords. Label the vertices on the circle 0 to n-1. Compute MIS(i, j): size of maximum independent set between vertices i and j, i < j. Answer = MIS(0, n-1). Vertices on the circle Unit 7 Y.-W. Chang 45 Dynamic Programming in Supowit's Algorithm Apply dynamic programming to compute MIS(i, j ). Unit 7 Y.-W. Chang 46 3

24 Ring-by-Ring Routing Decompose chip into rings of pads Initialize I/O-pad sequences Route from inner rings to router rings Exchange net order on current ring to be consistent with I/O pads Keep applying LCS and MPSC algorithms between two adjacent rings to minimize #detours Over 100X speedups over ILP current ring preceding ring Y.-W. Chang 47 Global Routing Results The global routing result of circuit fc64 A routing path for each net is guided by a set of segments Segment 48 4

25 Detailed Routing: Phase 1 Segment-by-segment routing in counter-clockwise order As compacted as possible 49 Detailed Routing: Phase Net-by-net re-routing in clockwise order Wirelength and number of bends minimizations 50 5

26 Appendix D: Standard-Cell Based VLSI Design Style 51 Pattern Graphs for an Example Library 5 6

27 Technology Mapping Technology Mapping: The optimization problem of finding a minimum cost covering of the subject graph by choosing from the collection of pattern graphs for all gates in the library. A cover is a collection of pattern graphs such that every node of the subject graph is contained in one (or more) of the pattern graphs. The cover is further constrained so that each input required by a pattern graph is actually an output of some other pattern graph. 53 Trivial Covering Mapped into -input NANDs and 1-input inverters. 8 -input NAND-gates and 7 inverters for an area cost of 3. Best covering? an example subject graph 54 7

28 Optimal Tree Covering by Dynamic Programming If the subject directed acyclic graph (DAG) is a tree, then a polynomial-time algorithm to find the minimum cover exists. Based on dynamic programming: optimal substructure? overlapping subproblems? Given: subject trees (networks to be mapped), library cells Consider a node n of the subject tree Recursive assumption: For all children of n, a best match which implements the node is known. Cost of a leaf is 0. Consider each pattern tree which matches at n, compute cost as the cost of implementing each node which the pattern requires as an input plus the cost of the pattern. Choose the lowest-cost matching pattern to implement n. 55 Best Covering A best covering with an area of 15. Obtained by the dynamic programming approach. 56 8

Matrix-Chain Multiplication

Matrix-Chain Multiplication Matrix-Chain Multiplication Let A be an n by m matrix, let B be an m by p matrix, then C = AB is an n by p matrix. C = AB can be computed in O(nmp) time, using traditional matrix multiplication. Suppose

More information

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

More information

Lecture 18: Applications of Dynamic Programming Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY 11794 4400

Lecture 18: Applications of Dynamic Programming Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY 11794 4400 Lecture 18: Applications of Dynamic Programming Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Problem of the Day

More information

Solutions to Homework 6

Solutions to Homework 6 Solutions to Homework 6 Debasish Das EECS Department, Northwestern University [email protected] 1 Problem 5.24 We want to find light spanning trees with certain special properties. Given is one example

More information

Analysis of Algorithms I: Optimal Binary Search Trees

Analysis of Algorithms I: Optimal Binary Search Trees Analysis of Algorithms I: Optimal Binary Search Trees Xi Chen Columbia University Given a set of n keys K = {k 1,..., k n } in sorted order: k 1 < k 2 < < k n we wish to build an optimal binary search

More information

CS473 - Algorithms I

CS473 - Algorithms I CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine

More information

OPTIMAL BINARY SEARCH TREES

OPTIMAL BINARY SEARCH TREES OPTIMAL BINARY SEARCH TREES 1. PREPARATION BEFORE LAB DATA STRUCTURES An optimal binary search tree is a binary search tree for which the nodes are arranged on levels such that the tree cost is minimum.

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

More information

Lecture 13: The Knapsack Problem

Lecture 13: The Knapsack Problem Lecture 13: The Knapsack Problem Outline of this Lecture Introduction of the 0-1 Knapsack Problem. A dynamic programming solution to this problem. 1 0-1 Knapsack Problem Informal Description: We have computed

More information

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Why? A central concept in Computer Science. Algorithms are ubiquitous. Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

More information

CMSC 451 Design and Analysis of Computer Algorithms 1

CMSC 451 Design and Analysis of Computer Algorithms 1 CMSC 4 Design and Analysis of Computer Algorithms David M. Mount Department of Computer Science University of Maryland Fall 003 Copyright, David M. Mount, 004, Dept. of Computer Science, University of

More information

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

More information

CS473 - Algorithms I

CS473 - Algorithms I CS473 - Algorithms I Lecture 9 Sorting in Linear Time View in slide-show mode 1 How Fast Can We Sort? The algorithms we have seen so far: Based on comparison of elements We only care about the relative

More information

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity.

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity. 7 Catalan Numbers Thomas A. Dowling, Department of Mathematics, Ohio State Uni- Author: versity. Prerequisites: The prerequisites for this chapter are recursive definitions, basic counting principles,

More information

Warshall s Algorithm: Transitive Closure

Warshall s Algorithm: Transitive Closure CS 0 Theory of Algorithms / CS 68 Algorithms in Bioinformaticsi Dynamic Programming Part II. Warshall s Algorithm: Transitive Closure Computes the transitive closure of a relation (Alternatively: all paths

More information

Network (Tree) Topology Inference Based on Prüfer Sequence

Network (Tree) Topology Inference Based on Prüfer Sequence Network (Tree) Topology Inference Based on Prüfer Sequence C. Vanniarajan and Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology Madras Chennai 600036 [email protected],

More information

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)! The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >

More information

Clustering UE 141 Spring 2013

Clustering UE 141 Spring 2013 Clustering UE 141 Spring 013 Jing Gao SUNY Buffalo 1 Definition of Clustering Finding groups of obects such that the obects in a group will be similar (or related) to one another and different from (or

More information

Interconnection Networks. Interconnection Networks. Interconnection networks are used everywhere!

Interconnection Networks. Interconnection Networks. Interconnection networks are used everywhere! Interconnection Networks Interconnection Networks Interconnection networks are used everywhere! Supercomputers connecting the processors Routers connecting the ports can consider a router as a parallel

More information

Scheduling Shop Scheduling. Tim Nieberg

Scheduling Shop Scheduling. Tim Nieberg Scheduling Shop Scheduling Tim Nieberg Shop models: General Introduction Remark: Consider non preemptive problems with regular objectives Notation Shop Problems: m machines, n jobs 1,..., n operations

More information

Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

More information

Dynamic programming. Chapter 6. 6.1 Shortest paths in dags, revisited S C A B D E

Dynamic programming. Chapter 6. 6.1 Shortest paths in dags, revisited S C A B D E Chapter 6 Dynamic programming In the preceding chapters we have seen some elegant design principles such as divide-andconquer, graph exploration, and greedy choice that yield definitive algorithms for

More information

Models in Transportation. Tim Nieberg

Models in Transportation. Tim Nieberg Models in Transportation Tim Nieberg Transportation Models large variety of models due to the many modes of transportation roads railroad shipping airlines as a consequence different type of equipment

More information

Part 2: Community Detection

Part 2: Community Detection Chapter 8: Graph Data Part 2: Community Detection Based on Leskovec, Rajaraman, Ullman 2014: Mining of Massive Datasets Big Data Management and Analytics Outline Community Detection - Social networks -

More information

Introduction to Scheduling Theory

Introduction to Scheduling Theory Introduction to Scheduling Theory Arnaud Legrand Laboratoire Informatique et Distribution IMAG CNRS, France [email protected] November 8, 2004 1/ 26 Outline 1 Task graphs from outer space 2 Scheduling

More information

Triangulation by Ear Clipping

Triangulation by Ear Clipping Triangulation by Ear Clipping David Eberly Geometric Tools, LLC http://www.geometrictools.com/ Copyright c 1998-2016. All Rights Reserved. Created: November 18, 2002 Last Modified: August 16, 2015 Contents

More information

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1 5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1 General Integer Linear Program: (ILP) min c T x Ax b x 0 integer Assumption: A, b integer The integrality condition

More information

Binary Heaps. CSE 373 Data Structures

Binary Heaps. CSE 373 Data Structures Binary Heaps CSE Data Structures Readings Chapter Section. Binary Heaps BST implementation of a Priority Queue Worst case (degenerate tree) FindMin, DeleteMin and Insert (k) are all O(n) Best case (completely

More information

Static Load Balancing

Static Load Balancing Load Balancing Load Balancing Load balancing: distributing data and/or computations across multiple processes to maximize efficiency for a parallel program. Static load-balancing: the algorithm decides

More information

EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27

EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27 EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27 The Problem Given a set of N objects, do any two intersect? Objects could be lines, rectangles, circles, polygons, or other geometric objects Simple to

More information

Computational Geometry. Lecture 1: Introduction and Convex Hulls

Computational Geometry. Lecture 1: Introduction and Convex Hulls Lecture 1: Introduction and convex hulls 1 Geometry: points, lines,... Plane (two-dimensional), R 2 Space (three-dimensional), R 3 Space (higher-dimensional), R d A point in the plane, 3-dimensional space,

More information

Data Structure with C

Data Structure with C Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which

More information

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new Reminder: Complexity (1) Parallel Complexity Theory Lecture 6 Number of steps or memory units required to compute some result In terms of input size Using a single processor O(1) says that regardless of

More information

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2). CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

More information

24. The Branch and Bound Method

24. The Branch and Bound Method 24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no

More information

Decision-Tree Learning

Decision-Tree Learning Decision-Tree Learning Introduction ID3 Attribute selection Entropy, Information, Information Gain Gain Ratio C4.5 Decision Trees TDIDT: Top-Down Induction of Decision Trees Numeric Values Missing Values

More information

Fast Sequential Summation Algorithms Using Augmented Data Structures

Fast Sequential Summation Algorithms Using Augmented Data Structures Fast Sequential Summation Algorithms Using Augmented Data Structures Vadim Stadnik [email protected] Abstract This paper provides an introduction to the design of augmented data structures that offer

More information

GRAPH THEORY LECTURE 4: TREES

GRAPH THEORY LECTURE 4: TREES GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection

More information

Dynamic programming. Doctoral course Optimization on graphs - Lecture 4.1. Giovanni Righini. January 17 th, 2013

Dynamic programming. Doctoral course Optimization on graphs - Lecture 4.1. Giovanni Righini. January 17 th, 2013 Dynamic programming Doctoral course Optimization on graphs - Lecture.1 Giovanni Righini January 1 th, 201 Implicit enumeration Combinatorial optimization problems are in general NP-hard and we usually

More information

How To Solve The Cluster Algorithm

How To Solve The Cluster Algorithm Cluster Algorithms Adriano Cruz [email protected] 28 de outubro de 2013 Adriano Cruz [email protected] () Cluster Algorithms 28 de outubro de 2013 1 / 80 Summary 1 K-Means Adriano Cruz [email protected]

More information

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014 Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li Advised by: Dave Mount May 22, 2014 1 INTRODUCTION In this report we consider the implementation of an efficient

More information

Analysis of Algorithms I: Binary Search Trees

Analysis of Algorithms I: Binary Search Trees Analysis of Algorithms I: Binary Search Trees Xi Chen Columbia University Hash table: A data structure that maintains a subset of keys from a universe set U = {0, 1,..., p 1} and supports all three dictionary

More information

System Interconnect Architectures. Goals and Analysis. Network Properties and Routing. Terminology - 2. Terminology - 1

System Interconnect Architectures. Goals and Analysis. Network Properties and Routing. Terminology - 2. Terminology - 1 System Interconnect Architectures CSCI 8150 Advanced Computer Architecture Hwang, Chapter 2 Program and Network Properties 2.4 System Interconnect Architectures Direct networks for static connections Indirect

More information

Hadoop SNS. renren.com. Saturday, December 3, 11

Hadoop SNS. renren.com. Saturday, December 3, 11 Hadoop SNS renren.com Saturday, December 3, 11 2.2 190 40 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December 3, 11 Saturday, December

More information

5.1 Bipartite Matching

5.1 Bipartite Matching CS787: Advanced Algorithms Lecture 5: Applications of Network Flow In the last lecture, we looked at the problem of finding the maximum flow in a graph, and how it can be efficiently solved using the Ford-Fulkerson

More information

Shortest Inspection-Path. Queries in Simple Polygons

Shortest Inspection-Path. Queries in Simple Polygons Shortest Inspection-Path Queries in Simple Polygons Christian Knauer, Günter Rote B 05-05 April 2005 Shortest Inspection-Path Queries in Simple Polygons Christian Knauer, Günter Rote Institut für Informatik,

More information

DESIGN AND ANALYSIS OF ALGORITHMS

DESIGN AND ANALYSIS OF ALGORITHMS CPS 3 DESIGN AND ANALYSIS OF ALGORITHMS Fall 8 Instructor: Herbert Edelsbrunner Teaching Assistant: Zhiqiang Gu CPS 3 Fall Semester of 8 Table of Contents Introduction 3 I DESIGN TECHNIQUES Divide-and-Conquer

More information

On the k-path cover problem for cacti

On the k-path cover problem for cacti On the k-path cover problem for cacti Zemin Jin and Xueliang Li Center for Combinatorics and LPMC Nankai University Tianjin 300071, P.R. China [email protected], [email protected] Abstract In this paper we

More information

Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees

Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees Learning Outcomes COMP202 Complexity of Algorithms Binary Search Trees and Other Search Trees [See relevant sections in chapters 2 and 3 in Goodrich and Tamassia.] At the conclusion of this set of lecture

More information

Matrix Multiplication

Matrix Multiplication Matrix Multiplication CPS343 Parallel and High Performance Computing Spring 2016 CPS343 (Parallel and HPC) Matrix Multiplication Spring 2016 1 / 32 Outline 1 Matrix operations Importance Dense and sparse

More information

Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

More information

AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC

AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC AN ALGORITHM FOR DETERMINING WHETHER A GIVEN BINARY MATROID IS GRAPHIC W. T. TUTTE. Introduction. In a recent series of papers [l-4] on graphs and matroids I used definitions equivalent to the following.

More information

CHAPTER 5 FINITE STATE MACHINE FOR LOOKUP ENGINE

CHAPTER 5 FINITE STATE MACHINE FOR LOOKUP ENGINE CHAPTER 5 71 FINITE STATE MACHINE FOR LOOKUP ENGINE 5.1 INTRODUCTION Finite State Machines (FSMs) are important components of digital systems. Therefore, techniques for area efficiency and fast implementation

More information

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which

More information

Clustering. 15-381 Artificial Intelligence Henry Lin. Organizing data into clusters such that there is

Clustering. 15-381 Artificial Intelligence Henry Lin. Organizing data into clusters such that there is Clustering 15-381 Artificial Intelligence Henry Lin Modified from excellent slides of Eamonn Keogh, Ziv Bar-Joseph, and Andrew Moore What is Clustering? Organizing data into clusters such that there is

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm. Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of

More information

HOLES 5.1. INTRODUCTION

HOLES 5.1. INTRODUCTION HOLES 5.1. INTRODUCTION One of the major open problems in the field of art gallery theorems is to establish a theorem for polygons with holes. A polygon with holes is a polygon P enclosing several other

More information

Lecture 10 Scheduling 1

Lecture 10 Scheduling 1 Lecture 10 Scheduling 1 Transportation Models -1- large variety of models due to the many modes of transportation roads railroad shipping airlines as a consequence different type of equipment and resources

More information

Discrete Optimization

Discrete Optimization Discrete Optimization [Chen, Batson, Dang: Applied integer Programming] Chapter 3 and 4.1-4.3 by Johan Högdahl and Victoria Svedberg Seminar 2, 2015-03-31 Todays presentation Chapter 3 Transforms using

More information

Algorithms and data structures

Algorithms and data structures Algorithms and data structures This course will examine various data structures for storing and accessing information together with relationships between the items being stored, and algorithms for efficiently

More information

Medical Information Management & Mining. You Chen Jan,15, 2013 [email protected]

Medical Information Management & Mining. You Chen Jan,15, 2013 You.chen@vanderbilt.edu Medical Information Management & Mining You Chen Jan,15, 2013 [email protected] 1 Trees Building Materials Trees cannot be used to build a house directly. How can we transform trees to building materials?

More information

Linear Programming. March 14, 2014

Linear Programming. March 14, 2014 Linear Programming March 1, 01 Parts of this introduction to linear programming were adapted from Chapter 9 of Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest and Stein [1]. 1

More information

Lecture 7: Clocking of VLSI Systems

Lecture 7: Clocking of VLSI Systems Lecture 7: Clocking of VLSI Systems MAH, AEN EE271 Lecture 7 1 Overview Reading Wolf 5.3 Two-Phase Clocking (good description) W&E 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.9, 5.5.10 - Clocking Note: The analysis

More information

Analysis of Algorithms, I

Analysis of Algorithms, I Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

More information

R-trees. R-Trees: A Dynamic Index Structure For Spatial Searching. R-Tree. Invariants

R-trees. R-Trees: A Dynamic Index Structure For Spatial Searching. R-Tree. Invariants R-Trees: A Dynamic Index Structure For Spatial Searching A. Guttman R-trees Generalization of B+-trees to higher dimensions Disk-based index structure Occupancy guarantee Multiple search paths Insertions

More information

Analysis of Binary Search algorithm and Selection Sort algorithm

Analysis of Binary Search algorithm and Selection Sort algorithm Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to

More information

Solution of Linear Systems

Solution of Linear Systems Chapter 3 Solution of Linear Systems In this chapter we study algorithms for possibly the most commonly occurring problem in scientific computing, the solution of linear systems of equations. We start

More information

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form Section 1.3 Matrix Products A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form (scalar #1)(quantity #1) + (scalar #2)(quantity #2) +...

More information

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams André Ciré University of Toronto John Hooker Carnegie Mellon University INFORMS 2014 Home Health Care Home health care delivery

More information

Binary Trees and Huffman Encoding Binary Search Trees

Binary Trees and Huffman Encoding Binary Search Trees Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary

More information

Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

More information

Lecture 10: Regression Trees

Lecture 10: Regression Trees Lecture 10: Regression Trees 36-350: Data Mining October 11, 2006 Reading: Textbook, sections 5.2 and 10.5. The next three lectures are going to be about a particular kind of nonlinear predictive model,

More information

Exam study sheet for CS2711. List of topics

Exam study sheet for CS2711. List of topics Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure

More information

Lecture 1: Course overview, circuits, and formulas

Lecture 1: Course overview, circuits, and formulas Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik

More information

Project Scheduling by Critical Path Method (CPM)

Project Scheduling by Critical Path Method (CPM) 12.1 Project Scheduling by Critical Path Method (CPM) Katta G. Murty Lecture slides CPM is application of DP to problems in Construction (project) Management. Many large construction projects going on

More information

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation: CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm

More information

Mathematical Induction. Lecture 10-11

Mathematical Induction. Lecture 10-11 Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

More information

Concurrency Control. Chapter 17. Comp 521 Files and Databases Fall 2010 1

Concurrency Control. Chapter 17. Comp 521 Files and Databases Fall 2010 1 Concurrency Control Chapter 17 Comp 521 Files and Databases Fall 2010 1 Conflict Serializable Schedules Recall conflicts (WR, RW, WW) were the cause of sequential inconsistency Two schedules are conflict

More information

Assessment Plan for CS and CIS Degree Programs Computer Science Dept. Texas A&M University - Commerce

Assessment Plan for CS and CIS Degree Programs Computer Science Dept. Texas A&M University - Commerce Assessment Plan for CS and CIS Degree Programs Computer Science Dept. Texas A&M University - Commerce Program Objective #1 (PO1):Students will be able to demonstrate a broad knowledge of Computer Science

More information

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems Harris Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems David Harris Harvey Mudd College [email protected] Based on EE271 developed by Mark Horowitz, Stanford University MAH

More information

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints

More information

Y. Xiang, Constraint Satisfaction Problems

Y. Xiang, Constraint Satisfaction Problems Constraint Satisfaction Problems Objectives Constraint satisfaction problems Backtracking Iterative improvement Constraint propagation Reference Russell & Norvig: Chapter 5. 1 Constraints Constraints are

More information

FUZZY CLUSTERING ANALYSIS OF DATA MINING: APPLICATION TO AN ACCIDENT MINING SYSTEM

FUZZY CLUSTERING ANALYSIS OF DATA MINING: APPLICATION TO AN ACCIDENT MINING SYSTEM International Journal of Innovative Computing, Information and Control ICIC International c 0 ISSN 34-48 Volume 8, Number 8, August 0 pp. 4 FUZZY CLUSTERING ANALYSIS OF DATA MINING: APPLICATION TO AN ACCIDENT

More information

11. APPROXIMATION ALGORITHMS

11. APPROXIMATION ALGORITHMS 11. APPROXIMATION ALGORITHMS load balancing center selection pricing method: vertex cover LP rounding: vertex cover generalized load balancing knapsack problem Lecture slides by Kevin Wayne Copyright 2005

More information

3. The Junction Tree Algorithms

3. The Junction Tree Algorithms A Short Course on Graphical Models 3. The Junction Tree Algorithms Mark Paskin [email protected] 1 Review: conditional independence Two random variables X and Y are independent (written X Y ) iff p X ( )

More information

Optimal Binary Search Trees Meet Object Oriented Programming

Optimal Binary Search Trees Meet Object Oriented Programming Optimal Binary Search Trees Meet Object Oriented Programming Stuart Hansen and Lester I. McCann Computer Science Department University of Wisconsin Parkside Kenosha, WI 53141 {hansen,mccann}@cs.uwp.edu

More information

Solving Geometric Problems with the Rotating Calipers *

Solving Geometric Problems with the Rotating Calipers * Solving Geometric Problems with the Rotating Calipers * Godfried Toussaint School of Computer Science McGill University Montreal, Quebec, Canada ABSTRACT Shamos [1] recently showed that the diameter of

More information

Single machine parallel batch scheduling with unbounded capacity

Single machine parallel batch scheduling with unbounded capacity Workshop on Combinatorics and Graph Theory 21th, April, 2006 Nankai University Single machine parallel batch scheduling with unbounded capacity Yuan Jinjiang Department of mathematics, Zhengzhou University

More information

28 Closest-Point Problems -------------------------------------------------------------------

28 Closest-Point Problems ------------------------------------------------------------------- 28 Closest-Point Problems ------------------------------------------------------------------- Geometric problems involving points on the plane usually involve implicit or explicit treatment of distances

More information

A Constraint Programming based Column Generation Approach to Nurse Rostering Problems

A Constraint Programming based Column Generation Approach to Nurse Rostering Problems Abstract A Constraint Programming based Column Generation Approach to Nurse Rostering Problems Fang He and Rong Qu The Automated Scheduling, Optimisation and Planning (ASAP) Group School of Computer Science,

More information

Binary Search Trees CMPSC 122

Binary Search Trees CMPSC 122 Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than

More information

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh

Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh Modern Optimization Methods for Big Data Problems MATH11146 The University of Edinburgh Peter Richtárik Week 3 Randomized Coordinate Descent With Arbitrary Sampling January 27, 2016 1 / 30 The Problem

More information

Data Mining on Streams

Data Mining on Streams Data Mining on Streams Using Decision Trees CS 536: Machine Learning Instructor: Michael Littman TA: Yihua Wu Outline Introduction to data streams Overview of traditional DT learning ALG DT learning ALGs

More information

Gate Delay Model. Estimating Delays. Effort Delay. Gate Delay. Computing Logical Effort. Logical Effort

Gate Delay Model. Estimating Delays. Effort Delay. Gate Delay. Computing Logical Effort. Logical Effort Estimating Delays Would be nice to have a back of the envelope method for sizing gates for speed Logical Effort Book by Sutherland, Sproull, Harris Chapter 1 is on our web page Also Chapter 4 in our textbook

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm. Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

More information

C H A P T E R. Logic Circuits

C H A P T E R. Logic Circuits C H A P T E R Logic Circuits Many important functions are naturally computed with straight-line programs, programs without loops or branches. Such computations are conveniently described with circuits,

More information

Course: Model, Learning, and Inference: Lecture 5

Course: Model, Learning, and Inference: Lecture 5 Course: Model, Learning, and Inference: Lecture 5 Alan Yuille Department of Statistics, UCLA Los Angeles, CA 90095 [email protected] Abstract Probability distributions on structured representation.

More information