Question: Knapsack Problem This assignment develops a two approximation algorithms for the Knapsack problem, defined as follows. There is a set of n items and knapsack

Knapsack Problem
This assignment develops a two approximation algorithms for the Knapsack problem, defined
as follows. There is a set of n items and knapsack that can hold a maximum weight of W.
Item i has value vi and weight wi. The goal is select a subset of items with maximum total
value subject to the constraint that their total weight is at most W.
There are dynamic programing algorithms for knapsack that run in O(nW) and O(nV)
time, where V=i?vi. These algorithms are pseduo-polynomial because the inputs to the
problem can be expressed in logW space. Therefore, O(nW) is actually exponential in the
input size! In fact, we can show the knapsack problem is NP-hard (for example from the
partition problem).
For any subset of items S, it will be convenient to define V(S)=iinS?vi, as the value
of S, and W(S)=tinS?wi, as the weight.
Problem 1
A natural greedy strategy is to rank the items by 'how good they are' (as measured by the
ratio of value to weight viwi) and pick items in decreasing order until the knapsack is filled.
Greedy
Sort and relabel items so that v1w1v2w2...vnwn.
Take the largest subset {1...k} that fits in the knapsack, t=1kwkW.
ModifiedGreedy
Return max(output of Greedy, highest valued item)
a) Provide an example input where Greedy approximately close to (OPT)/W. You don't need to assume that
vi's and wi's are integers.
b) Suppose that Greedy takes the first k items {1,...,k}. Prove that
i=1k+1vi>OPT,
note that this bound takes one additional item vk+1.
 Knapsack Problem This assignment develops a two approximation algorithms for the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!