Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions