Re-posted from: https://white.ucc.asn.au/2018/05/28/Optimizing-your-diet-with-JuMP.html
I’ve been wanting to do a JuMP blog post for a while.
JuMP is a Julia mathematical programing library.
It is to an extent a DSL for describing constrained optimisation problems.
A while ago, a friend came to me who was looking to get “buff”,
what he wanted to do, was maximise his protein intake, while maintaining a generally healthy diet.
He wanted to know what foods he should be eating.
To devise a diet.
If one thinks about this,
this is actually a Linear Programming problem – constrained linear optimisation.
The variables are how much of each food to eat,
and the contraints are around making sure you have enough (but not too much) of all the essential vitamins and minerals.
Note: this is a bit of fun, in absolutely no way do I recommend using the diets the code I am about to show off generates.
I am in no way qualified to be giving dietry or medical advice, etc.
But this is a great way to play around with optimisation.
Continue reading