4 ms·
Optimizing a diet using Linear Programming (in Julia)
- andreareina 8y agoI remember reading about a study that attempted something similar, they found that dietary guidelines were in fact impossible to meet using a "natural diet" without supplements (scare quotes because I don't remember the exact dietary constraints). I think the constraints also included lower bounds for things like sodium and potassium (this model only has upper bounds for them).
- newen 8y agoNo, this model has lower bounds on all nutrients humans need and upper bounds on some based on their toxicity.
- andreareina 8y agoYeah I misinterpreted the constraints. Still, this model has no lower bound on sodium and no upper bound on potassium; ideally both would be bounded on both sides.
- vardump 8y agoThat was hilarious. Figuring out sensible constraints seems to be a long iterative process. One diet suggested drinking 32l (~8.5 gallons) of water. This one was the computed "maximize protein" diet: status = solve(m) = :Optimal 10 grams Folic acid 1 grams Vitamin C 667 grams Flour, soya 24034 grams Lard 800 grams Suet 845 grams Amino acid or creatine powder 42752 grams Intense sweetener, containing aspartame, powdered formulation Almost 43 kg (~94 pounds) of intense sweetener? Sounds healthy!
- iamconfused 8y agoI wonder if you could get actionable results if recipes were the level of granularity you ran the analysis on.
- oxinabox 8y agoSource is on github, https://github.com/oxinabox/oxinabox.github.io/blob/master/notebook_posts/Optimizing%20your%20diet%20with%20JuMP.ipynb https://github.com/oxinabox/oxinabox.github.io/blob/master/n... Feel encouraged to mess around with it
- abacate 8y agoThe idea is interesting, though the results have indeed zero applicability unless a few additional rules are added to the system - like proportion of macro-nutrients (fats/proteins/carbohydrates) and some sensible variability to the meal plans (ie, no point in suggesting "1 gram" of some food source, either you suggest a "portion" or nothing). Personally, I think it would be easier to start with one's own dietary approach and try to put that into rules, then optimize it using additional guidelines (or removing some rules) instead of starting with something too loosely defined and letting the program choose different sources randomly.
- oxinabox 8y agoYes, portions need to be defined per thing though. 1 gram of a vitamin supplement is fine. 1 gram of eggs, not so much.