Let’s take a last stab at our beer-delivery problem. We tried out a Sieve, we used the Microsoft Solver – time for some recursion.

How can we organize our recursion?

If we had only 1 type of beer pack, say, 7-packs, the best way to supply *n* bottles of beer is to supply the closest integer greater than n/7, that is, $$\lceil {n \over 7} \rceil$$

If we had 7-packs and 13-packs, we need to consider multiple possibilities. We can select from 0 to the ceiling of n/7 7-packs, and, now that we have only one type of case pack left, apply the same calculation as previously to the remaining bottles we need to supply – and select the best of the combinations, that is, the combination of beer packs closest to the target.

If we had even more types of beer packs available, we would proceed the same way, by trying out the possible quantities for the first pack, and given the first, for the second, and so on until we reach the last type of pack – which is pretty much the outline of a recursive algorithm.

## Comments

- It takes one to know one (3)
- Create optimization programs dynamically with C# and the Microsoft Solver Foundation (8)
- Management, the Gordon Ramsay way (4)
- VSTO add-in with multiple assemblies (5)

Comment RSSRon wrote: Statistics are used much like a drunk uses a lampp... [More]

Ron wrote: I just started tinkering with Solver the other day... [More]

bryan tyler nelson wrote: I do not even understand how I stopped up right he... [More]

prestamo wrote: What i do not realize is in truth how you are now ... [More]