Data & Analysis built-by-bobby.com

Essay · Data & Analysis

What Does It Cost to Eat Properly?

Solving George Stigler's 1945 'diet problem' on 1,016 real supermarket products I scraped: the cheapest basket that still meets your nutritional needs.

In 1945 the economist George Stigler asked a deceptively simple question: what is the cheapest diet that still keeps a person alive and nourished? He had no computer, so he reasoned his way to an answer of about $39.93 a year in 1939 prices. A few years later the same problem became the first real test of linear programming: the simplex method solved Stigler's diet to the cent. It is the founding example of operations research, the maths of doing something as cheaply as possible subject to constraints.

I wanted to run Stigler's problem on a real shop. That needs two things for every product, its price and its nutrition, and getting both together is harder than it sounds. EU law forces a nutrition table onto the packet, and most retailers do put it online, but nobody publishes it as data: it is buried in the page, behind bot protection, and no open dataset pairs price with nutrition anywhere. So I scraped it. This runs on 1,016 products from the Portuguese chain Continente, each with a shelf price and a full per-100g nutrition panel, cleaned from a genuinely messy scrape (Portuguese decimal commas, a mojibake euro sign, and micronutrients split across columns in three different units).

The cheapest nutritionally-adequate day

The optimiser buys the cheapest combination of real products that hits an adult’s daily floor, at least 2,000 kcal, 50g protein and 25g fibre, while staying under sensible caps on salt, sugar and saturated fat, and no more than 500g a day of any one product. Pick a diet:

The honest part: this basket is grim. Stigler knew that too — the cheapest adequate diet is monotonous by construction, because variety and pleasure aren’t in the constraints. The interesting result isn’t the menu, it’s the price: you can clear an adult’s basic macros for well under a euro a day. And note what the optimiser never buys: meat. The cheapest omnivore diet and the cheapest vegetarian diet are the same basket, because no meat product is ever worth its price per unit of nutrition.

The most nutrition per euro

Step back from the full basket and ask the narrower question that started this whole project: which actual products give you the most of a given nutrient per euro? These are named Continente lines, not food categories, so the answer is something you could put in a trolley.

Plot every product’s price against its protein density and the cheap-protein corner fills up with pulses, flours and pasta; meat and fish sit out on the expensive edge. Each dot is a real product; hover for the name.

Where does your grocery euro actually go?

It is tempting to blame the supermarket for the cost of food. The data says otherwise. Irish grocery is concentrated, the big five hold about 93% of the market, yet it is genuinely competitive on price: retailer net margins are razor-thin.

Aldi Ireland made a 0.8% net margin in 2023 and an actual loss in 2024; even Tesco Ireland ran about 5.4%. Irish food inflation over the cost-of-living surge (+24.3%, Jan 2022–May 2025) actually undershot the EU average (+29.0%). The price on the shelf is barely the retailer’s profit. Where the food chain’s margin really sits, and who really squeezes the farmer, is a separate story (the beef processors), and its own piece.

How honest is this?

Three caveats I’d rather state than hide. Coverage: the macros (energy, protein, fat, carbs, salt, sugar, fibre) are on nearly every product, but micronutrients are sparse, only 31 products report iron, 42 report calcium, so the leaderboards above are “cheapest source among products that report it,” not the whole shop, and a full all-vitamin optimisation isn’t honest with this data. Classification: the vegetarian/vegan tags are keyword-guessed from Portuguese names and ingredients, good but not perfect. Prices are a February 2022 Continente snapshot, so read the cents as a demonstration of the method, not today’s shelf, refreshing them is just a matter of re-running the scrape. And an Irish version is the obvious next step, and feasible, since SuperValu and Tesco Ireland also expose price and nutrition, joinable to Open Food Facts by barcode. The point of the piece isn’t a perfect diet. It’s that with the right data and a 1945 idea, “what should I actually buy?” becomes a question you can answer to the cent.