## The Maths

In this app we assign n gifts, to k friends. Thus, the total number of distinct arrangements (permutations) of n gifts allocated to k friends is given by:

So, for example, if we have two friends, and we wish to allocate exactly one gift to each friend out of a basket of gifts: a,b,c, we get the permutations: ab, ba, ac, ca, bc, cb. As the number of friends and the number of gifts grow, so does the number of permutations. For example, 8 gifts allocated to 6 friends, there are 8*7*6*5*4*3 = 20,160 possible ways to assign exactly one unique gift to each friend: 8 possible gifts for the first friend, 7 gifts left for the second friend, 6 for the third friend, etc. Clearly, the number of permutations grows at an alarming rate. Hence, in the interests of time and CPU, we set a maximum limit of:

This hits a maximum number of permutations just over 100 quadrillion (!!!) when there are 20 gifts assigned to 16 friends: 101,370,917,007,360,000.

Assigning the correct gift to the right friend is further complicated by their individual desires. Which friend would like which gift? You can assign their favourites using the Gift Preferences: 0 for no interest and 100 for like very much.

You can see in the diagram above that the Gift Preferences are scaled within the model based on the Overall Preference for each friend. When you examine the weights in the worked example on this website you will see that Dino Rex gets only a 30 as an Overall Preference. This is reflected in the scaled Gift Preferences as you can see in the chart above.

Consequently, when there are over 100 quadrillion permutations (or to be exact 101,370,917,007,360,000!), which selection makes sure that the gift being allocated to a friend is not only the one that they desire, but that pecking order during the allocation process is adhered to and that the budget constraint is satisfied.   We really want you to give the best gifts and to never worry about the money side of it again, you can not

Gift Optimizer does exactly what it is supposed to do and uses advanced mathematics to arrive at everyoneâ€™s optimal solution. You buy everyone their ideal gift, whilst keeping to within the budget. Gift Optimizer removes all the stress as the budget optimizer