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 (9)
- Free trade (1)
- AdaBoost in F# (2)

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

green coffee bean pure extract 800 mg wrote: Hello there I am so grateful I found your web site... [More]

buyinvestmentpropertyonline.com wrote: Howdy I am so thrilled I found your site, I really... [More]

Suggested Internet page wrote: I am now not certain where you are getting your in... [More]