COMS 482: unofficial class blog

Lecture 34: Knapsack Approximations

Posted in Class Notes by Elliott Back on April 20th, 2005.

Some approximation bounds so far:

  • Makespan: 3/2, 4/3
  • Center selection: 2
  • Vertex cover: 2

The goal is to achieve a (1 + e) approximation.

Knapsack Problem:

We can carry at most W weight. We have n items to choose from, each with weight wi and a value vi. Our goal is to maximize value without exceeding weight boundary W. Using Dynamic Programming, we can define:

Opt(i, V) = smallest weight possible using items {1, …, i} and choosing value >= V.

Given the Opt(*, *) function and W, we can search the opt-table to find the largest V for which opt(n, V) <= W:

V = sum(vi in S) <= sum(vi for all i) <= nv*, where v* = max vi

Therefore, the algorithm runs in time O(n2v*).

Algorithm notes:

If the nth item is not in opt solution, then Opt(n, V) = Opt(n-1, V). If the nth item is in the optimal solution, then Opt(n, V) = wn + Opt(n-1, V-Vn)–so, just take the minimum:

Opt(n, V) = min({Opt(n-1, V), wn + Opt(n-1, V-Vn})

There are some table bounds to consider:

Opt(1, V) = w1 if v1 >= V, else infinity
Opt(k, 0) = 0
Opt(k, < 0) = 0

Finally, we can write the algorithm outline:

Knapsack0Approx(e):
    b = (e/n) * max(vi)
    for all i vi^ = ceil(vi/b)
    solve problem with vi^ via DP outline above
    return result set S

This entry was posted on Wednesday, April 20th, 2005 at 10:54 am and is tagged with knapsack, dynamic programming, v max, return result, optimal solution, ceil, approximation, approximations, vertex, w1, algorithm, infinity, lt, nbsp, v1. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Leave a Reply

Powered by WP Hashcash