Dynamic Programming.

Slides:



Advertisements
Similar presentations
Dynamic Programming.
Advertisements

Lecture 8: Dynamic Programming Shang-Hua Teng. Longest Common Subsequence Biologists need to measure how similar strands of DNA are to determine how closely.
CPSC 335 Dynamic Programming Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Overview What is Dynamic Programming? A Sequence of 4 Steps
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
Greedy Algorithms Basic idea Connection to dynamic programming
Greedy Algorithms Basic idea Connection to dynamic programming Proof Techniques.
Approaches to Problem Solving greedy algorithms dynamic programming backtracking divide-and-conquer.
RAIK 283: Data Structures & Algorithms
Dynamic Programming Part 1: intro and the assembly-line scheduling problem.
June 3, 2015Windows Scheduling Problems for Broadcast System 1 Amotz Bar-Noy, and Richard E. Ladner Presented by Qiaosheng Shi.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
Dynamic Programming CIS 606 Spring 2010.
Sequence Alignment Variations Computing alignments using only O(m) space rather than O(mn) space. Computing alignments with bounded difference Exclusion.
Chapter 8 Dynamic Programming Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Dynamic Programming Optimization Problems Dynamic Programming Paradigm
Analysis of Algorithms CS 477/677
Dynamic Programming Reading Material: Chapter 7 Sections and 6.
1 A Linear Space Algorithm for Computing Maximal Common Subsequences Author: D.S. Hirschberg Publisher: Communications of the ACM 1975 Presenter: Han-Chen.
Lecture 7 Topics Dynamic Programming
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Dynamic Programming – Part 2 Introduction to Algorithms Dynamic Programming – Part 2 CSE 680 Prof. Roger Crawfis.
Lecture 5 Dynamic Programming. Dynamic Programming Self-reducibility.
Dynamic Programming (16.0/15) The 3-d Paradigm 1st = Divide and Conquer 2nd = Greedy Algorithm Dynamic Programming = metatechnique (not a particular algorithm)
Dynamic Programming. Well known algorithm design techniques:. –Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic programming.
ADA: 7. Dynamic Prog.1 Objective o introduce DP, its two hallmarks, and two major programming techniques o look at two examples: the fibonacci.
Dynamic Programming Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by or formulated.
Fundamentals of Algorithms MCS - 2 Lecture # 7
1 Designing algorithms There are many ways to design an algorithm. Insertion sort uses an incremental approach: having sorted the sub-array A[1…j - 1],
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.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 28, 2014.
INTRODUCTION. What is an algorithm? What is a Problem?
Greedy Methods and Backtracking Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Dynamic Programming David Kauchak cs302 Spring 2013.
Approaches to Problem Solving greedy algorithms dynamic programming backtracking divide-and-conquer.
1 Dynamic Programming Topic 07 Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program, Image and Vision Computing Lab. School of Information and Computer Technology.
1 Today’s Material Dynamic Programming – Chapter 15 –Introduction to Dynamic Programming –0-1 Knapsack Problem –Longest Common Subsequence –Chain Matrix.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 18.
Chapter 15 Dynamic Programming Lee, Hsiu-Hui Ack: This presentation is based on the lecture slides from Hsu, Lih-Hsing, as well as various materials from.
Dynamic Programming Kun-Mao Chao ( 趙坤茂 ) Department of Computer Science and Information Engineering National Taiwan University, Taiwan
1 Algorithms CSCI 235, Fall 2015 Lecture 29 Greedy Algorithms.
Dynamic Programming. What is Dynamic Programming  A method for solving complex problems by breaking them down into simpler sub problems. It is applicable.
TU/e Algorithms (2IL15) – Lecture 4 1 DYNAMIC PROGRAMMING II
Lecture 5 Dynamic Programming
Dynamic Programming Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Introduction to the Design and Analysis of Algorithms
Lecture 5 Dynamic Programming
Prepared by Chen & Po-Chuan 2016/03/29
CS Algorithms Dynamic programming 0-1 Knapsack problem 12/5/2018.
A Quick Note on Useful Algorithmic Strategies
Richard Anderson Lecture 16a Dynamic Programming
Dynamic Programming 1/15/2019 8:22 PM Dynamic Programming.
Dynamic Programming.
A Note on Useful Algorithmic Strategies
A Note on Useful Algorithmic Strategies
A Note on Useful Algorithmic Strategies
A Note on Useful Algorithmic Strategies
Introduction to Algorithms: Dynamic Programming
Dynamic Programming.
DYNAMIC PROGRAMMING.
Longest Common Subsequence
Lecture 5 Dynamic Programming
A Note on Useful Algorithmic Strategies
Longest Common Subsequence
A Note on Useful Algorithmic Strategies
COMPSCI 330 Design and Analysis of Algorithms
Dynamic Programming.
Dynamic Programming Kun-Mao Chao (趙坤茂)
Presentation transcript:

Dynamic Programming

Dynamic Programming Dynamic Programming is a general algorithm design technique It breaks up a problem into a series of overlapping sub-problems ( sub-problem whose results can be reused several times) Main idea: set up a recurrence relating a solution to a larger instance to solutions of some smaller instances - solve smaller instances once record solutions in a table extract solution to the initial instance from that table

Discussed topics Assembly-line scheduling Partition of Data Sequence Route Segmentation and Classification for GPS data Longest Common Subsequence (LCS)

Assembly-line scheduling Recursive equation: where f1[j] and f2[j] are the accumulated time cost to reach station S1,j and S2,j a1,j is the time cost for station S1,j t2,j-1 is the time cost to change station from S2,j-1 to S1,j

Partition of Data Sequence Partition of the sequence X into to K non-overlapping groups with given cost functions f(xi, xj) so that the total value of the cost function is minimal:

Partition of Data Sequence G(k,n) is cost function for optimal partition of n points into k non-overlapping groups: Recursive equation:

Examples: Image Quantization Input Quantized Here, cost function is: Square Error Quantize value

Examples: Polygonal Approximation 5004 points are approximated by 78 points. Given approximated points M, errors are minimized. Given error ε, number of approximated points are minimized. Here, cost function is:

Examples: Route segmentation Ski Running and Jogging Non-moving Divide the routes into several segments by speed consistency Here, cost function is: Speed variance Time duration

Examples: Route classification Determine the moving type only by speed will cause mis-classification. Frequent Moving type dependency of 1st order HMM

Examples: Route classification (cont.) 1st order HMM, maximize: mi : moving type of segment i Xi : feature vector (e.g. speed) Solve by dynamic programming similar with the Assembly-line scheduling problem

Longest Common Subsequence (LCS) Find a maximum length common subsequence between two sequences. For instance, Sequence 1: president Sequence 2: providence Its LCS is priden. president providence

How to compute LCS? Let A=a1a2…am and B=b1b2…bn . len(i, j): the length of an LCS between a1a2…ai and b1b2…bj With proper initializations, len(i, j) can be computed as follows.

Running time and memory: O(mn) and O(mn).

Time Series Matching using Longest Common Subsequence delta = time matching region (left & right) epsilon = spatial matching region (up & down) Recursive equation:

Spatial Data Matching using Longest Common Subsequence epsilon = spatial matching distance Recursive equation:

Conclusion Main idea: Divide into sub-problems Design cost function and recursive function Optimization (fill in the table) Backtracking