Download - Dynamic Programming Tutorial
![Page 1: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/1.jpg)
Dynamic Programming Tutorial
Elaine ChewQMUL: ELE021/ELED021/ELEM021
26 March 2012
![Page 2: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/2.jpg)
Sources• Hillier, F. S. & G. J. Lieberman. Introduction to Operations
Research. Chapter 11: Dynamic Programming, 7th, 8th, 9th editions, McGraw-Hill.
• Dixon, S. & Widmer, G. (2005). MATCH: A Music Alignment Tool Chest. In Proceedings of the 6th Intl Conf on Music Information Retrieval, London, UK, 492-497.
• Yang, A., E. Chew & A. Volk (2005). A Dynamic Programming Approach to Adaptive Tatum Assignment for Rhythm Transcription. In Proceedings of the 1st IEEE Intl Wkshop on Multimedia Information Processing and, Irvine, CA, 577-584.
![Page 3: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/3.jpg)
Sources• Hillier, F. S. & G. J. Lieberman. Introduction to Operations
Research. Chapter 11: Dynamic Programming, 7th, 8th, 9th editions, McGraw-Hill.
• Dixon, S. & Widmer, G. (2005). MATCH: A Music Alignment Tool Chest. In Proceedings of the 6th Intl Conf on Music Information Retrieval, London, UK, 492-497.
• Yang, A., E. Chew & A. Volk (2005). A Dynamic Programming Approach to Adaptive Tatum Assignment for Rhythm Transcription. In Proceedings of the 1st IEEE Intl Wkshop on Multimedia Information Processing and, Irvine, CA, 577-584.
![Page 4: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/4.jpg)
Shortest Path Problem• V = set of vertices (or nodes)• E = set of edges (or arcs), including s (source) and t (sink)• C = [cij] = set of arc costs• X = indicator variable for whether arc ij is used
• Linear Programming Problem Formulation:
Min Σij cijxij
s.t. Σi xij = 1Σj xij = 10 ≤ xij ≤ 1
![Page 5: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/5.jpg)
Hogwarts (Shortest Path) Example
• Determine which route from entrance to exit has the shortest distance
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
Gringott’sWizarding
Bank
Entrance to Wizarding
World
QualityQuidditchSuppliesOllivander’s
Exit toCharing Cross
Road
The Leaky Cauldron
Magical Menagerie
![Page 6: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/6.jpg)
Algorithm
• At iteration i– Objective: find the i-th nearest node to the origin– Input: i-1 nearest node to the origin, shortest path
and distance– Candidates for i-th nearest node: nearest unsolved
node to one solved– Calculation for i-th nearest node: for each new
candidate, add new edge to previously found shortest path to the i-1-th nearest node. Among the new candidates, the node with shortest distance becomes the i-th nearest node.
![Page 7: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/7.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
![Page 8: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/8.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
0
![Page 9: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/9.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 Q
![Page 10: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/10.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
![Page 11: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/11.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 R
2 QR
CC
67
C 6 Q
![Page 12: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/12.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
6
![Page 13: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/13.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 R
2 QR
CC
67
C 6 Q
3 QC
OO
99
O 9 QC
![Page 14: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/14.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
6
9
![Page 15: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/15.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 R
2 QR
CC
67
C 6 Q
3 QC
OO
99
O 9 QC
4 QCO
GMM
121010
M 10 CO
![Page 16: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/16.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
6
9
10
![Page 17: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/17.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 R
2 QR
CC
67
C 6 Q
3 QC
OO
99
O 9 QC
4 QCO
GMM
121010
M 10 CO
5 QOM
GGE
121114
G 11 O
![Page 18: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/18.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
6
9
10
11
![Page 19: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/19.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
1 R Q 5 Q 5 R
2 QR
CC
67
C 6 Q
3 QC
OO
99
O 9 QC
4 QCO
GMM
121010
M 10 CO
5 QOM
GGE
121114
G 11 O
![Page 20: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/20.jpg)
ImplementationIteration, i Solved nodes
connected to unsolved
Closest connected unsolved node
Total distance involved
i-th nearest node
Minimum distance
Last connection
5 QOM
GGE
121114
G 11 O
6 OMG
EEE
141413
E 13 G
![Page 21: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/21.jpg)
Hogwarts (Shortest Path) Example
7
4
22
5
14
4
5
1 7
G
OE Q
R
M C
3
5
0
6
9
10
11
13
![Page 22: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/22.jpg)
Sources• Hillier, F. S. & G. J. Lieberman. Introduction to Operations
Research. Chapter 11: Dynamic Programming, 7th, 8th, 9th editions, McGraw-Hill.
• Dixon, S. & Widmer, G. (2005). MATCH: A Music Alignment Tool Chest. In Proceedings of the 6th Intl Conf on Music Information Retrieval, London, UK, 492-497.
• Yang, A., E. Chew & A. Volk (2005). A Dynamic Programming Approach to Adaptive Tatum Assignment for Rhythm Transcription. In Proceedings of the 1st IEEE Intl Wkshop on Multimedia Information Processing and, Irvine, CA, 577-584.
![Page 23: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/23.jpg)
Dynamic Time Warping
![Page 24: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/24.jpg)
Euclidean Distance
![Page 25: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/25.jpg)
(i,j)
![Page 26: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/26.jpg)
![Page 27: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/27.jpg)
Sources• Hillier, F. S. & G. J. Lieberman. Introduction to Operations
Research. Chapter 11: Dynamic Programming, 7th, 8th, 9th editions, McGraw-Hill.
• Dixon, S. & Widmer, G. (2005). MATCH: A Music Alignment Tool Chest. In Proceedings of the 6th Intl Conf on Music Information Retrieval, London, UK, 492-497.
• Yang, A., E. Chew & A. Volk (2005). A Dynamic Programming Approach to Adaptive Tatum Assignment for Rhythm Transcription. In Proceedings of the 1st IEEE Intl Wkshop on Multimedia Information Processing and, Irvine, CA, 577-584.
![Page 28: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/28.jpg)
Tatum Segmentation
• Tatum = smallest perceptual time unit in music
![Page 29: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/29.jpg)
Example Results
40
60
80
100
120
140
0 100 200 300 400
Beats
Tatum
Coarse Manual
Segmentation
bepthq3
son08_3
![Page 30: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/30.jpg)
Segmentation
• Example of tatum selection• Input:
– Note onset times, O(1,n) = {O1, O2,…, On}
• Output:– Segmentation points, S = {S1, S2,…,Sm}– Optimal tatum in each segment
![Page 31: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/31.jpg)
Remainder Squared Error
o(1) … o(j)
p
1 … j j+1
p
![Page 32: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/32.jpg)
ERR(.)
The error incurred by a tatum assignment, p, for onsets O(i+ 1,k) is given by the remainder squared error (RSE) function:
where oj (= Oj+1 – Oj) is the inter onset interval (IOI) between onsets j and j+1.
€
e(p,i + 1,k) =ojp
−ojp
+ 12
⎢ ⎣ ⎢
⎥ ⎦ ⎥
⎛
⎝ ⎜
⎞
⎠ ⎟
j =1
k − i −1
∑2
,
€
ERR(O(i + 1,k)) =p
min e(p,i + 1,k).
![Page 33: Dynamic Programming Tutorial](https://reader035.vdocument.in/reader035/viewer/2022062222/568163f3550346895dd57804/html5/thumbnails/33.jpg)
Optimal Segmentation
• Define OPT(k) to be the best segmentation (cost) for a given set of onsets O(1,k):
where ERR(.) returns the error incurred by the best tatum assignment for the set of onsets O(i+1,k).€
OPT(k) =1≤ i ≤kmin {OPT(i)+ ERR(O(i + 1,k))},
ki i+1 …1 …