COMS 482: unofficial class blog


Lecture 34: Knapsack Approximations

Posted in Class Notes by Elliott Back on April 20th, 2005. [Del.icio.us]

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 , , , , , , , , , , , , , , . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Leave a Reply

Prevent comment spam using the voluminous and magnitudinous WP Hashcash?

Please take time to enjoy the archives: May 2005 (1) April 2005 (11) March 2005 (11) February 2005 (15) January 2005 (7)

Fresh, related resources:

Supplied by Google Blog Search
  • Knapsack problem
    George Dantzig (1957) proposed a greedy approximation algorithm to solve the knapsack problem. His version sorts the essentials in decreasing order of value per unit of weight, pj / wj. It then proceeds to insert them into the sack, ...
  • Lecture 34: Knapsack Approximations
    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, ...