01The problem, its variants, and why greedy fails
You are given N items; item i has weight wᵢ > 0 and value pᵢ > 0. Choose a subset whose total weight is at most the capacity W and whose total value is maximal. In general this is NP-complete, but for moderate W dynamic programming solves it.
The lecture lists the variants: fractional (any part of an item may be taken), 0-1 (one copy of each item), bounded (at most kᵢ copies), unbounded (any number), multiple-choice (one item per group) and multiple knapsacks.
Its example: W = 50, items 10, 20, 30 kg worth $60, $100, $120. In the fractional problem greedy by value per kg is optimal: $240. In the 0-1 problem greedy takes the first two ($160) and the third no longer fits, yet items 2 and 3 give $220. Whether an item is worth taking depends on what else fits, so we need DP.