TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Optimizing a diet using Linear Programming (in Julia)

33 pointsby oxinaboxabout 7 years ago

5 comments

vardumpabout 7 years ago
That was hilarious. Figuring out sensible constraints seems to be a long iterative process.<p>One diet suggested drinking 32l (~8.5 gallons) of water.<p>This one was the computed &quot;maximize protein&quot; diet:<p><pre><code> 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 </code></pre> Almost 43 kg (~94 pounds) of intense sweetener? Sounds healthy!
andreareinaabout 7 years ago
I remember reading about a study that attempted something similar, they found that dietary guidelines were in fact impossible to meet using a &quot;natural diet&quot; without supplements (scare quotes because I don&#x27;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).
评论 #17178287 未加载
abacateabout 7 years ago
The 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&#x2F;proteins&#x2F;carbohydrates) and some sensible variability to the meal plans (ie, no point in suggesting &quot;1 gram&quot; of some food source, either you suggest a &quot;portion&quot; or nothing).<p>Personally, I think it would be easier to start with one&#x27;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.
评论 #17203506 未加载
oxinaboxabout 7 years ago
Source is on github, <a href="https:&#x2F;&#x2F;github.com&#x2F;oxinabox&#x2F;oxinabox.github.io&#x2F;blob&#x2F;master&#x2F;notebook_posts&#x2F;Optimizing%20your%20diet%20with%20JuMP.ipynb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oxinabox&#x2F;oxinabox.github.io&#x2F;blob&#x2F;master&#x2F;n...</a> Feel encouraged to mess around with it
iamconfusedabout 7 years ago
I wonder if you could get actionable results if recipes were the level of granularity you ran the analysis on.