next up previous
Next: Up: Previous:

Fully Poly-Time Approximation Scheme



Trim(L, $\delta$) $\;\;\;\;\;$ $\;\;\;\;\;$; L = <y1, .., ym> sorted in non-decreasing order
1
$\;\;\;\;\;$m = \(\mid L \mid\)
2
$\;\;\;\;\;$L' = \(\langle y_1 \rangle\)
3
$\;\;\;\;\;$last = y1
4
$\;\;\;\;\;$for i = 2 to m
5
$\;\;\;\;\;$ $\;\;\;\;\;$if last < (1 - $\delta$)yi
6
$\;\;\;\;\;$ $\;\;\;\;\;$then append yi on end of L'
7
$\;\;\;\;\;$ $\;\;\;\;\;$ $\;\;\;\;\;$last = yi
8
$\;\;\;\;\;$return L'



Approx-Subset-Sum(S, t, $\epsilon$)
1
$\;\;\;\;\;$n = $\mid$S$\mid$
2
$\;\;\;\;\;$L0 = $\langle$0$\rangle$
3
$\;\;\;\;\;$for i = 1 to n
4
$\;\;\;\;\;$ $\;\;\;\;\;$Li = Merge-Lists( \(L_{i-1}, \;L_{i-1} \;+\; x_i\))
5
$\;\;\;\;\;$ $\;\;\;\;\;$Li = Trim(Li, \(\frac{\epsilon}{n}\))
6
$\;\;\;\;\;$ $\;\;\;\;\;$remove from Li elements > t
7
$\;\;\;\;\;$return largest value in Ln



Error passed to Trim is \(\frac{\epsilon}{n}\) to prevent too much inaccuracy after repeated trimmings.



Theorem 37.6

Approx-Subset-Sum is a fully poly-time approximation scheme for the subset-sum problem.


next up previous
Next: Up: Previous: