Skip to content
Tech News
← Back to articles

Cocktail Optimization, an Integer Programming Problem

read original more articles
Why This Matters

This article highlights the significant advancements in integer programming solvers, demonstrating how modern tools like Google’s OR Tools outperform custom algorithms in complex optimization tasks. For the tech industry and consumers, this means more efficient solutions for resource allocation and decision-making processes, enabling faster and more accurate results in various applications.

Key Takeaways

Cocktail Optimization, an Integer Programming Problem

June 18, 2026

I’ve been interested in integer programming problems for a long time (they the most interesting problems in dedupe). In the past, I approached them by writing custom branch-and-bound algorithms.

I have been using Google’s OR Tools for a project that involves a lot of vehicle routing, and I started to wonder how these mixed integer linear programming solvers would do against my lovingly crafted algorithms.

They utterly surpass them. These solvers are technical marvels, containing the congealed knowledge of thousands of hours of research and engineering. Of course my code wasn’t really going to compete.

A few years ago, I wrote a branch-and-bound solver for the problem of maximizing the number of cocktails you can make with certain number of ingredients on your cocktail tray. I was pretty proud of it, but if you set your ingredient budget to 30, it will take many minutes to find the optimum solution, and it would basically never stop looking for a better one.

As you can see below, with glpk.js, it takes milliseconds to find a final optimum.

With 30 ingredients, you can make 29 cocktail(s).

0 10 20 30 40 50 60 70 80 90 100 ↑ Cocktails you can make 20 40 60 80 100 120 Ingredients on your tray → 29