GK Logo 003 350 x 100
Santa Clause (downloded from Google 07 Dec 2014, labelleed as free to reuse)
Santa Clause (downloded from Google 07 Dec 2014, labelleed as free to reuse)

As Christmas approaches, many of us are faced with the annual problem of who to buy presents for, how much to spend, what presents to buy and how to be fair to everybody.

Is this a tough problem to solve? Perhaps some science will help?

Let’s try and state the problem a little more precisely, and make it simple by assuming that we are buying presents for just one person. That does not detract from the more complex problem, especially if we establish that buying presents for one person is hard.

Your task is to buy as many presents as possible which maximizes the number of points, whilst staying within your budget.

How difficult do you think it is to find a solution to this problem so that you daughter gets the best possible gifts such that there is not another selection of gifts that has a higher overall points value?

In fact, it is surprisingly difficult, especially as the number of available presents (and people you are buying for)  increases.

Pile of wrapped presents: http://christmasstockimages.com/free/objects/slides/many_christmas_gifts.htm (CC 3.0)
Pile of wrapped presents: http://christmasstockimages.com/free/objects/slides/many_christmas_gifts.htm (CC 3.0)

The problem is the so called Knapsack Problem, so named as you have knapsack which can carry a certain weight (your budget). Each item has a weight (cost of each item) but also a value (the number of points). You have to fill the knapsack, maximizing the value, but keeping the sum of all the weights less than the capacity of your knapsack.

Or, in terms of the Christmas Present Problem, you need to buy the best selection of presents to give the maximum number of points, while staying within your overall budget.

The Knapsack Problem is known to be an NP-Hard problem. These type of problems do not, as yet, have any efficient algorithm that can produce the optimal solution in reasonable time. At least for large sized problem instances. Hopefully, you can still give your daughter the best set of presents!

In fact, if you can find an efficient algorithm you could win one million dollars.