Cocktail Optimization, an Integer Programming Problem
Cocktail Optimization, an Integer Programming Problem
June 18, 2026<br>I’ve been interested in integer programming<br>problems for a long time (they the most interesting problems in dedupe).<br>In the past, I approached them by writing custom branch-and-bound algorithms.
I have been using Google’s OR Tools for<br>a project that involves a lot of vehicle routing, and I started to wonder how these mixed integer<br>linear programming solvers would do against my lovingly crafted algorithms.
They utterly surpass them. These solvers are technical marvels, containing the congealed<br>knowledge of thousands of hours of research and engineering. Of course my code wasn’t<br>really going to compete.
A few years ago, I wrote a branch-and-bound solver for the problem of maximizing the number<br>of cocktails you can make with certain number of ingredients on your cocktail tray.<br>I was pretty proud of it, but if you set your ingredient budget to 30, it will take many minutes to find<br>the optimum solution, and it would basically never stop looking for a better one.
As you can<br>see below, with glpk.js, it takes milliseconds to find<br>a final optimum.
With 30 ingredients, you can make 29 cocktail(s).
0102030405060708090100↑ Cocktails you can make20406080100120Ingredients on your tray →29
Cocktail<br>Ingredients
Here’s the shopping list:
Ingredient<br>Number of Cocktails
Subscribe to get Slow-News as an email newsletter.
Enter your email
Subscribe