11-1 Elements of Dynamic Programming For dynamic programming to be applicable, an optimization problem must have: 1.Optimal substructure –An optimal solution.

Slides:



Advertisements
Similar presentations
Dynamic Programming ACM Workshop 24 August Dynamic Programming Dynamic Programming is a programming technique that dramatically reduces the runtime.
Advertisements

Algorithm Design Methodologies Divide & Conquer Dynamic Programming Backtracking.
Knapsack Problem Section 7.6. Problem Suppose we have n items U={u 1,..u n }, that we would like to insert into a knapsack of size C. Each item u i has.
Dynamic Programming An algorithm design paradigm like divide-and-conquer “Programming”: A tabular method (not writing computer code) Divide-and-Conquer.
Overview What is Dynamic Programming? A Sequence of 4 Steps
1 Dynamic Programming (1). 2 Dynamic Programming The dynamic programming archetype is used to solve problems that can be defined by recurrences with overlapping.
Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by recurrences with overlapping subproblems.
Dynamic Programming Lecture 9 Asst. Prof. Dr. İlker Kocabaş 1.
CPSC 311, Fall 2009: Dynamic Programming 1 CPSC 311 Analysis of Algorithms Dynamic Programming Prof. Jennifer Welch Fall 2009.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2002 Lecture 2 Tuesday, 2/5/02 Dynamic Programming.
Dynamic Programming Reading Material: Chapter 7..
Dynamic Programming Technique. D.P.2 The term Dynamic Programming comes from Control Theory, not computer science. Programming refers to the use of tables.
Chapter 8 Dynamic Programming Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2009 Design Patterns for Optimization Problems Dynamic Programming.
Dynamic Programming1. 2 Outline and Reading Matrix Chain-Product (§5.3.1) The General Technique (§5.3.2) 0-1 Knapsack Problem (§5.3.3)
CPSC 411 Design and Analysis of Algorithms Set 5: Dynamic Programming Prof. Jennifer Welch Spring 2011 CPSC 411, Spring 2011: Set 5 1.
1 Dynamic Programming Andreas Klappenecker [based on slides by Prof. Welch]
UNC Chapel Hill Lin/Manocha/Foskey Optimization Problems In which a set of choices must be made in order to arrive at an optimal (min/max) solution, subject.
Analysis of Algorithms CS 477/677
Dynamic Programming Reading Material: Chapter 7 Sections and 6.
Dynamic Programming A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 8 ©2012 Pearson Education, Inc. Upper Saddle River,
Analysis of Algorithms
1 Theory I Algorithm Design and Analysis (11 - Edit distance and approximate string matching) Prof. Dr. Th. Ottmann.
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Table of Contents Matrices - Multiplication Assume that matrix A is of order m  n and matrix B is of order p  q. To determine whether or not A can be.
First Ingredient of Dynamic Programming
SMAWK. REVISE Global alignment (Revise) Alignment graph for S = aacgacga, T = ctacgaga Complexity: O(n 2 ) V(i,j) = max { V(i-1,j-1) +  (S[i], T[j]),
Dynamic Programming (16.0/15) The 3-d Paradigm 1st = Divide and Conquer 2nd = Greedy Algorithm Dynamic Programming = metatechnique (not a particular algorithm)
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 8 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Dynamic Programming. Well known algorithm design techniques:. –Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic programming.
Dynamic Programming Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by or formulated.
1 Summary of lectures 1.Introduction to Algorithm Analysis and Design (Chapter 1-3). Lecture SlidesLecture Slides 2.Recurrence and Master Theorem (Chapter.
CSCI 256 Data Structures and Algorithm Analysis Lecture 14 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
COSC 3101A - Design and Analysis of Algorithms 7 Dynamic Programming Assembly-Line Scheduling Matrix-Chain Multiplication Elements of DP Many of these.
CS 312: Algorithm Design & Analysis Lecture #23: Making Optimal Change with Dynamic Programming Slides by: Eric Ringger, with contributions from Mike Jones,
If A and B are both m × n matrices then the sum of A and B, denoted A + B, is a matrix obtained by adding corresponding elements of A and B. add these.
1 Dynamic Programming Andreas Klappenecker [partially based on slides by Prof. Welch]
Dynamic Programming. Many problem can be solved by D&C – (in fact, D&C is a very powerful approach if you generalize it since MOST problems can be solved.
12-CRS-0106 REVISED 8 FEB 2013 CSG523/ Desain dan Analisis Algoritma Dynamic Programming Intelligence, Computing, Multimedia (ICM)
Optimization Problems In which a set of choices must be made in order to arrive at an optimal (min/max) solution, subject to some constraints. (There may.
Dynamic Programming1. 2 Outline and Reading Matrix Chain-Product (§5.3.1) The General Technique (§5.3.2) 0-1 Knapsack Problem (§5.3.3)
Computer Sciences Department1.  Property 1: each node can have up to two successor nodes (children)  The predecessor node of a node is called its.
COSC 3101NJ. Elder Announcements Midterms are marked Assignment 2: –Still analyzing.
Chapter 7 Dynamic Programming 7.1 Introduction 7.2 The Longest Common Subsequence Problem 7.3 Matrix Chain Multiplication 7.4 The dynamic Programming Paradigm.
1 Today’s Material Dynamic Programming – Chapter 15 –Introduction to Dynamic Programming –0-1 Knapsack Problem –Longest Common Subsequence –Chain Matrix.
A Sub-quadratic Sequence Alignment Algorithm. Global alignment Alignment graph for S = aacgacga, T = ctacgaga Complexity: O(n 2 ) V(i,j) = max { V(i-1,j-1)
Dynamic Programming (optimization problem) CS3024 Lecture 10.
1 Chapter 15-2: Dynamic Programming II. 2 Matrix Multiplication Let A be a matrix of dimension p x q and B be a matrix of dimension q x r Then, if we.
Simplifying Dynamic Programming Jamil Saquer & Lloyd Smith Computer Science Department Missouri State University Springfield, MO USA.
Dynamic Programming Typically applied to optimization problems
Rod cutting Decide where to cut steel rods:
Dynamic Programming Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Seminar on Dynamic Programming.
Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by recurrences with overlapping subproblems.
Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by recurrences with overlapping subproblems.
Chapter 8 Dynamic Programming
Advanced Design and Analysis Techniques
Dynamic Programming.
Dynamic Programming Dr. Yingwu Zhu Chapter 15.
Dynamic Programming.
Calendar like the Periodic Table
Chapter 15: Dynamic Programming II
Dynamic Programming.
Elements of Dynamic Programming
Dynamic Programming II DP over Intervals
Matrix Chain Product 張智星 (Roger Jang)
Lecture 5 Dynamic Programming
Analysis of Algorithms CS 477/677
Matrix Chain Multiplication
Seminar on Dynamic Programming.
Presentation transcript:

11-1 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

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] + 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[a,d] ] < = A[b, d] for all a< b and c< d a b cd

The Total Monotonicity Property A[a, 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 2x2 submatrix is Monotone.

m n This statement holds for every 2x2 submatrix.

m n

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

MaxColCompute(A= c1,c2,c3,c4,c5,c6) Reduce: A is 6x6, the number of rows is not greater than m… return

P  the even columns of A

MaxColCompute(A= c2,c4,c6) Reduce: A is 6x3, the number of rows is greater than m.

Time Analysis: Procedure Reduce takes time O(n)