Previous Up

10.8  Exercises



  1. Consider the knapsack problem in section 10.7. Suppose that the items each have an associated profit, namely 17, 38, 18, 10 and 5, respectively. Which items should be included to maximise profit?



  2. Write a predicate which, given a list of sizes of items and a list of capacities of buckets, returns a list of (ground) sets indicating which items should go into each bucket. Obviously each item should go into exactly one bucket.

    Try it out with 5 items of sizes 20, 34, 9, 12 and 19, into 3 buckets of sizes 60, 20 and 20.

Previous Up