Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Programming.

Similar presentations


Presentation on theme: "Dynamic Programming."— Presentation transcript:

1 Dynamic Programming

2 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

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

4 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

5 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:

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

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

8 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:

9 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

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

11 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

12 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

13 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.

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

15

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

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

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


Download ppt "Dynamic Programming."

Similar presentations


Ads by Google