- 21. Dynamic Programming III
FPTAS [Ottman/Widmayer, Kap. 7.2, 7.3, Cormen et al, Kap. 15,35.5]
575
21. Dynamic Programming III FPTAS [Ottman/Widmayer, Kap. 7.2, 7.3, - - PowerPoint PPT Presentation
21. Dynamic Programming III FPTAS [Ottman/Widmayer, Kap. 7.2, 7.3, Cormen et al, Kap. 15,35.5] 575 Approximation Let (0 , 1) given. Let I opt an optimal selection. No try to find a valid selection I with v i (1 ) v i
575
576
i=1 vi).
577
falls v < vi
sonst.
578
579
579
579
579
579
Read out the solution: if g[i, v] = g[i − 1, v] then item i unused and continue with g[i − 1, v] otherwise used and continue with g[i − 1, b − vi] .
579
580
581
582
i∈Iopt
|Iopt|≤n
I′
583
i∈Iopt
n
584
n
n .34
i∈Iopt vi and thus K′ ≤ K and the
34We can assume that items i with wi > W have been removed in the first place. 585
ε. The scheme is
586
587
i=1 qi · vi under n i=1 qi · wi ≤ W.
588
i=1 wi ≤ W}. Set
i=1 wi
wj+1
589
i ri · wi = i qi · wi = W.
i): r′ i = ri∀i < k. r′ k = qk. Remove
i=k+1 δi = x · wk from items k + 1 to n. This works because
i=k ri · wi = n i=k qi · wi.
590
n
ivi = rkvk + xwk
n
n
n
n
i) is also optimal. Iterative application of this idea generates
591
592
a b c d e f Frequency (Thousands) 45 13 12 16 9 5 Code word with fix length 000 001 010 011 100 101 Code word variable length 101 100 111 1101 1100
592
a b c d e f Frequency (Thousands) 45 13 12 16 9 5 Code word with fix length 000 001 010 011 100 101 Code word variable length 101 100 111 1101 1100
592
593
593
593
593
a:45 b:13
c:12 d:16
e:9 f:5 1 1 1 1 1
a:45
c:12 b:13
f:5 e:9 d:16 1 1 1 1 1
594
595
595
595
596
597
598
599
600