Approximation Algorithms for Knapsack Problems�
1
Tsvi Kopelowitz
Modified by Ariel Rosenfeld
Knapsack
�Formally:
2
Assumptions
Note:
3
Uniform Knapsack (simple form)
4
Uniform Knapsack (proof)
5
2-approximation �(general knapsack)
6
2-approximation try it yourself…
7
2-approximation �(general knapsack)
Claim:
Proof sketch (fill the details yourselves):
8
9
A(i,j) = Smallest weight subset of objects 1,…,i with a total value of j.
A DP algorithm for knapsack
A 1 2 3 j n vmax
1
2
3
i
n
Upper bound on optimal profit
A DP algorithm for knapsack
10
Definitions
11
Definition: Fully Polynomial Time Approximation Scheme � (FPTAS)
Given ε, delivers a solution with a ratio of (1- ε) for maximum and a ratio of (1+ ε) for minimum, and runs in time polynomial in the size of the input and (1/ε)
Definition: Pseudo-polynomial
If input of integers is given in unary form, runs in polynomial time.
FPTAS for knapsack
The Idea – use scaling!!
12
Correctness
Proof: For every i: .�
(1) => (3)
(2) (4)
13
Correctness
Proof continued:
(1) (3) ��
(2) (4)
•
14
Complexity and Notes
Time:
15