Question: Knapsack problems (see also Cormen at al.) The 0-1 knapsack problem is the following: a thief robbing a store finds n items. The ith item

Knapsack problems (see also Cormen at al.) The 0-1 knapsack problem is the following: a thief robbing a store finds n items. The ith item is worth v_i dollars and weighs w_i kilos with i and w_i positive integers. The thief wants to take as valuable a load as possible, but he can carry at most W kilos in his knapsack with W > 0. Which items should he take to maximise his loot? 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 modelling for the fractional knapsack problem: let S = { 1, 2, n} Opt (S, W) = p + v)j + Opt(S {j}, W - p_j middot w_j) and Opt(Y) = 0. Notice that the 0-1 knapsack problem is a particular case where p must be either 0 or 1. Prove that the fractional knapsack problem recursive solution defined by Equation I has optimal sub-structure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
