next up previous
Next: Activity-Selection (scheduling) problem Up: CSE 2320: Algorithms and Previous: Fractional Knapsack Problem exhibits

Fractional Knapsack Problem

Now we need to show that an initial greedy choice of item h leads to an optimal solution. We can make the greedy choice first.

Case I:
If W < wh, then and for all j $\neq$ h is the only take.

We can fill the knapsack with the highest value-per-pound item.

Case II:
There is room left after greedy choice. L(i), L(j) > 0, i $\neq$ j. Assume item i was the first choice and j = h a subsequent choice.

Thus, V = L(i) \(\frac{v_i}{w_i}\) + L(h) \(\frac{v_h}{w_h}\).

If we choose the same amount L(h) of item h first (we cannot choose more or we would have by the above result), then the value will be

V' = L(h) \(\frac{v_h}{w_h}\) + L(i) \(\frac{v_i}{w_i}\)

V' = V

Thus we can make the greedy choice first.

Copyright © 1998 The University of Texas at Arlington