A Sample Knapsack Problem
As an example, suppose you are planning a picnic. You've constructed a list of items you would like to carry with you on the picnic. Each item has a weight associated with it and your knapsack is limited to carrying no more than 15 pounds. You have also come up with a 1 to 10 rating for each item, which indicates how strongly you want to include the particular item in the or the picnic. This information is listed in the table below.
Item  | 
Weight  | 
Rating  | 
Ant Repellent  | 
1  | 
2  | 
Beer  | 
3  | 
9  | 
Blanket  | 
4  | 
3  | 
Bratwurst  | 
3  | 
8  | 
Brownies  | 
3  | 
10  | 
Frisbee  | 
1  | 
6  | 
Salad  | 
5  | 
4  | 
Watermelon  | 
10  | 
10  |