{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

week-6 - The Knapsack Problem The classic Knapsack problem...

This preview shows pages 1–3. Sign up to view the full content.

1 The Knapsack Problem The classic Knapsack problem is typically put forth as: A thief breaks into a store and wants to fill his knapsack with as much value in goods as possible before making his escape. Given the following list of items available, what should he take? • Item A, weighing w A pounds and valued at v A • Item B, weighing w B pounds and valued at v B • Item C, weighing w C pounds and valued at v C The Simplest Versions… Can items be divided up such that only a portion is taken? The thief can hold 5 pounds and has to choose from: 3 pounds of gold dust at \$379.22/pound 6 pounds of silver dust at \$188.89/pound 1/9 pound of platinum dust at \$433.25/pound Are all of the weights or total values identical? The thief breaks into a ring shop where all of the rings weight 1oz. He can hold 12 ounces; which should he take? A Deceptively Hard Version… What if each problem has the same price/pound? This problem reduces to the bin-packing problem: we want to fit as many pounds of material into the knapsack as possible. How can we approach this problem?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Example The thief breaks into a gold refinery; he can steal from a selection of raw gold nuggets, each of the same value per pound. If he can carry 50 pounds, what selection would maximize the amount he carries out? 47.3 pounds 6.0 pounds 5.2 pounds 36.7 pounds 5.6 pounds 5.2 pounds 25.5 pounds 5.6 pounds 5.0 pounds 16.7 pounds 5.4 pounds 3.2 pounds 8.8 pounds 5.3 pounds 0.25 pounds An Easier Version... What if all of the sizes we are working with are relatively small integers? For example, if we could fit 10 pounds and: Object A is 2 pounds and worth \$40 Object B is 3 pounds and worth \$50 Object C is 1 pound and worth \$100 Object D is 5 pounds and worth \$95 Object E is 3 pounds and worth \$30 We can use dynamic programming!
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 8

week-6 - The Knapsack Problem The classic Knapsack problem...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online