Skip to content
HN On Hacker News ↗

Cocktail Optimization, an Integer Programming Problem

▲ 39 points 6 comments by ftgregg 3w ago HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully human-written

0 %

AI likelihood · overall

Human
100% human-written 0% AI-generated
SEGMENTS · HUMAN 1 of 1
SEGMENTS · AI 0 of 1
WORD COUNT 213
PEAK AI % 0% · §1
Analyzed
Jun 21
backend: pangram/v3.3
Segments scanned
1 windows
avg 213 words each
Distribution
100 / 0%
human / AI fraction
Verdict
Human
Pangram v3.3

Article text · 213 words · 1 segments analyzed

Human AI-generated
§1 Human · 0%

June 18, 2026I’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).

0102030405060708090100↑ Cocktails you can make20406080100120Ingredients on your tray →29

Cocktail Ingredients

Here’s the shopping list:

Ingredient Number of Cocktails

Subscribe to get Slow-News as an email newsletter.