Elements of Dynamic Programming For dynamic programming to

  • Slides: 19
Download presentation
Elements of Dynamic Programming • For dynamic programming to be applicable, an optimization problem

Elements of Dynamic Programming • For dynamic programming to be applicable, an optimization problem must have: 1. Optimal substructure – An optimal solution to the problem contains within it optimal solution to subproblems 2. Overlapping subproblems – The space of subproblems must be small; i. e. , the same subproblems are encountered over and over 11 -1

Features of a Dynamic Programming Algorithm: (1) A table (where we store optimal costs

Features of a Dynamic Programming Algorithm: (1) A table (where we store optimal costs of subproblems). (2) The entry dependency of the table (given by the recurrence relation). When we are interested in the design of efficient algorithms for dynamic Programming, a third feature emerges: (3) The order to fill in the table (the algorithm). Some times one can use some properties of the problem at hand to change the order in which (3) is computed to obtain better algorithms.

Convexity/Concavity Properties of the DP Table A (1) Monge (concave) [Monge 1781] A[a, c]

Convexity/Concavity Properties of the DP Table A (1) Monge (concave) [Monge 1781] A[a, c] + A[b, d ] < = A[b, c] + A[a, d] for all a< b and c< d Monge (convex) A[a, c] + A[b, d ] > = A[b, c] + A[a, d] for all a< b and c< d (2) Total Monotonicity (convex) A[a, c] > = A[b, c ] => A[a, d] > = A[b, d] for all a< b and c< d Total Monotonicity (concave) A[a, c] < = A[b, c ] => A[a, d] < = A[b, d] for all a< b and c< d a b c d

The Total Monotonicity Property A[a, c] < = A[b, c ] => A[a, d]

The Total Monotonicity Property A[a, c] < = A[b, c ] => A[a, d] ] < = A[b, d] (1) matrix A is Monotone if , for any column d > c, Column Maximum [d] >= Colum Maximum [c] (2) matrix A is Totally Monotone if every 2 x 2 submatrix is Monotone.

m n This statement holds for every 2 x 2 submatrix.

m n This statement holds for every 2 x 2 submatrix.

m n This statement holds for every 2 x 2 submatrix. G[k, k] >

m n This statement holds for every 2 x 2 submatrix. G[k, k] > G[k+1, k] and k < n

A. Aggarwal, M. Klawe, S. Moran, P. Shor and R. Wilber

A. Aggarwal, M. Klawe, S. Moran, P. Shor and R. Wilber

Invariant: G[k, 1. . k-1] is dead by total monotonicity.

Invariant: G[k, 1. . k-1] is dead by total monotonicity.

Max. Col. Compute(A= c 1, c 2, c 3, c 4, c 5, c

Max. Col. Compute(A= c 1, c 2, c 3, c 4, c 5, c 6) Reduce: A is 6 x 6, the number of rows is not greater than m… return

P the even columns of A

P the even columns of A

Max. Col. Compute(A= c 2, c 4, c 6) Reduce: A is 6 x

Max. Col. Compute(A= c 2, c 4, c 6) Reduce: A is 6 x 3, the number of rows is greater than m.

Time Analysis: Procedure Reduce takes time O(n)

Time Analysis: Procedure Reduce takes time O(n)