Part of the appeal of pharmaceutical interventions is they provide “one weird trick” to fix complex problems. Diet is one such complex problem. Everyone wants to find the best diet that keeps them healthy and fit, but the perfect diet eludes us all. At the ML for Healthcare Conference last week, I discussed how the perfect diet is impossible. And attempting to determine the “optimal” diet highlights the absurdity of the optimization mindset.

Proclaiming “diet can’t be optimized” will confuse anyone who has taken an introductory course on optimization. The first thing we teach is the “optimal diet problem.” It’s the simplest example of *linear programming*.

Let’s say I want to eat 40g of protein in a meal, and I want the meal to be less than 500 calories. Bro science suggests I can do this well using only chicken, broccoli, and rice. This table gives the respective amount of protein and calories for a pound of each:

In my meal, I will eat *C* pounds of chicken, *B *pounds of broccoli, and *R* pounds of rice. I can write that the total amount of protein must exceed 40 as a linear inequality.

`100 C + 15 B + 22 R ≥ 40`

Similarly, I can pose my desire to make the meal low in calories by having the inequality constraint

`540 C + 150 B + 1000 R ≤ 500`

Finally, I must have that all of these quantities, *C*, *B*, and *R* are greater than or equal to zero. Sadly, there is no negative food that magically cuts calories. The cost of this meal will be given by the formula

`cost = 8.99 C + 3.99 B + 0.50 R`

Each of these expressions is linear, and this is why the problem is called a linear program. Linear programs like this can be solved instantaneously on my laptop. My solver tells me that I should eat ⅓ a cup of chicken, a cup of rice, and no broccoli. The solver would have had me add some broccoli if I added a requirement to get my Vitamin C. I can cover more nutritional constraints by adding the appropriate ingredients.

You could imagine generalizing this procedure to any table of foods and nutrients. Every food has some amount of calories. If you add up the calories of the foods you eat in a day, this should be less than your calorie allowance. Every food has some amount of macro and micronutrients, and you can also count these to ensure that your diet exceeds the daily recommendations. Both the calorie restrictions and dietary requirements are linear inequality constraints, and finding the minimum cost diet that satisfies all of your constraints is a linear program.

The diet problem is cute, intuitive, and fun to present to undergraduates. But after digging into its origins, I’m not sure if I’d use it as my leading example.

The diet problem was invented by economist George Stigler in 1945, a few years before Dantzig had conceived of linear programming. Stigler did not come up with this problem to help guide nutrition. Rather, he wrote his paper as a rant against USDA suggestions for a diet, claiming that they were not based in science. “Optimal diet” has always been fraught with politics.

Stigler assembled the nutritional information of 77 different foods and found the minimum cost diet that satisfied 9 nutritional guidelines set by the USDA (for calories, protein, calcium, iron, vitamins A, B1, B2, B3, and C).

Though no linear programming solver existed, Stigler did some heuristic calculations and found a diet that would cost 11 cents a day in 1939 dollars, over 2.5x less than what was proposed as minimum cost by the USDA. But Stigler’s diet was horrifying. In a day you were allotted one pound of flour, two ounces of evaporated milk, five ounces of cabbage, one ounce of spinach, and a pound of dried navy beans. No one who wasn’t being tortured would eat this.

Can we fix Stigler’s diet with some extra modeling and optimization? If I wanted to stay in the economic mindset, the time required to make the ingredients into food should factor in. Stigler’s diet gives ingredients, not food. Dried beans and flour aren’t consumable without a great deal of cooking. What is the cost of meal prep?

Perhaps I could quantify the mental anguish associated with eating five cans of beans every day. Given what these would do to my insides, I imagine no one would want to be around me. The social isolation would have associated cost that I’m sure economists could neatly quantify. But even if this was possible (it’s not), we have three costs that we need to balance, requiring us to invoke some form of multi-criterion optimization. Perhaps we could add a constraint requiring dietary “variety” but what would this look like? And would the problem still be solvable?

Stigler differs from the USDA by providing no money for spices as they would cost extra. How could you mathematically model that food needs some spice? What is the mathematical model of “palatability”? Or of “social value”? What does the Pareto landscape of palatability versus cost look like? Of course, you can’t quantify everything that goes into eating, and the attempt to quantify the nuances leads only to absurdity. But if you can’t quantify it, you can’t optimize it.

Your points are well taken from the perspective of an individual considering their own diet. But what about, say, the head of a large public school cafeteria? What if said person-in-charge is busy dealing with other aspects of their job and would like to automatically generate menus? (Or at least auto-generate a few suggestions.) I would argue that in this scenario, every approach *is* optimization. In other words, any algorithm for generating candidate menus is operating according to some (possibly implicit) objective function. However, I don't mean to claim that this objective function is *right* or even that some "correct" objective exists. Unlike algorithms that we design, reality is vague, indeterminate, and not well defined!

Of course, many would further claim that the optimal diet is not a static thing, but a rhythm. It has elements of periodization (seasonality, culture) in it. This would be good for the mind and the body. The body is very adaptive and being healthy requires exercising the adaptation mechanisms regularly (NNT has some paragraphs along those lines in Antifragile IIRC). One example would be the recurring zero diet, fasting, culturally imposed. Diet is (was) cultural. Bro science went to town on fasting recently, as expected. Maybe there is some stochastic LP to handle all of the above?