# Lecture17 - Optimal linear interpolation CSE 421 Algorithms...

This preview shows pages 1–3. Sign up to view the full content.

1 CSE 421 Algorithms Richard Anderson Lecture 17 Dynamic Programming Optimal linear interpolation Error = Σ (y i –ax i –b) 2 Determine set of K lines to minimize error Opt k [ j ] : Minimum error approximating p 1 …p j with k segments Express Opt k [ j ] in terms of Opt k-1 [1],…,Opt k-1 [ j ] Opt k [ j ] = min i {Opt k-1 [ i ] + E i,j } Optimal sub-solution property Optimal solution with k segments extends an optimal solution of k-1 segments on a smaller problem Optimal multi-segment interpolation Compute Opt[ k, j ] for 0 < k < j < n for j := 1 to n Opt[ 1, j] = E 1,j ; for k := 2 to n-1 for j := 2 to n t := E 1,j for i := 1 to j -1 t = min (t, Opt[k-1, i ] + E i,j ) Opt[k, j] = t

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Determining the solution • When Opt[ k ,j ] is computed, record the value of i that minimized the sum • Store this value in a auxiliary array • Use to reconstruct solution Variable number of segments • Segments not specified in advance • Penalty function associated with segments • Cost = Interpolation error + C x #Segments
This is the end of the preview. Sign up to access the rest of the document.

## Lecture17 - Optimal linear interpolation CSE 421 Algorithms...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online