(Solved) : 0 1 Knapsack Problem Following Thief Robbing Store Finds N Items Ith Item Worth Dollars We Q33114206 . . .

The 0-1 knapsack problem is the following: a thief robbing a store finds n items. The ith item is worth dollars and weighs kilos with i and w positive integers. The thief wants to take as valuable his knapsack with W >0. Which items should he take to maximise his loot? a load as possible, but he can carry at most W kilos in This is called the 0-1 knapsack problem because for each item, the thief must either take it or leave it behind. He cannot take a fractional amount of an item or take an item more than once. In the fractional knapsack problem, the setup is the same, but the thief can take fractions of items, rather than having to make a binary (0-1) choice for each item. After some deep thinking the lecturer of COMP333 proposes the following mod- elling for the fractional knapsack problem: let S-11,2.—,n) max and Opt (2, Y)-0. Notice that the 0-1 ㎞apsack problem is a particular case where p must be either 0or 1 Question 1 Prove that the fractional knapsack problem recursive solution defined by Equation I has optimal sub-structure. Question 2 Can you re-use your previous proof to prove that the 0-1 knapsack prob- lem has optimal sub-structure? If yes, you should show why, if not, provide an alternative proof. A greedy strategy for the fractional knapsack problem is to pick up as much as we can of the item that has greatest possible value per kilo. Assume we first compute the value per kilo for each item, 1L., Vİ-Uj/tDĩ. The greedy choice for Opt(S, W) is to take as much as we can of item i E S where i is maximal. Question 3 Show that the previous greedy choice yields an optimal solution for the fractional knapsack problem. Consider the following concrete instance of capacity of the knapsack is 80 and the 4 items are as follows the knapsack problem: the maximum weight 5 value SAUS0 SAU40 SAU45 SAU150 10 75 Question 4 Compute the optimal value for the fractional version using the greedy algorithm. Question 5 What is the maximal value for the 0-1 version? Compute the maximal value for the 0-1 version using the y algorithm. Conclusion? Show transcribed image text
Expert Answer
Answer to 0 1 Knapsack Problem Following Thief Robbing Store Finds N Items Ith Item Worth Dollars We Q33114206 . . .
OR