Hacker News new | ask | show | jobs
by swalsh 2446 days ago
I ended up building my own solution to this problem too (though mine is not open to public)

The main thing I wanted to optimize was menu planning. So I wrote a genetic algorithm which will generate a menu, add the score, mutate the menu in some way, and iterate. In my database I have a rough price per ingredient, and my families enjoyment of the recipe (though I have kind of a lagging gradient which reduces the score per recipe to prevent duplication). I also have included in my algorithm what I call slots. So something like a lasagna will take 4 slots where as a stir fry will be 1 slot. I sync my schedule and break it down to slots. This allows the algorithm to fit the recipe to the time available. I dont score slots though otherwise short recipes always win.

Since the algorithm optimizes based on the week, but keeps a running inventory it's pretty good at maximizing my grocery bill and family enjoyment. My average grocery bill is between $40-$60 a week. And I cook 5 times a week.

10 comments

I've done this as well using scraped recipes from a website that conveniently labeled all ingredients with data tags for their referral program.

Although my goal was to find recipes that shared ingredients to cut back on wastage. I used a constraint solver (https://developers.google.com/optimization) and asked it to produce 5 recipes requiring the minimum number of ingredients, and was rather amused that the first run included such classics as "boiled egg", "butter potato" and "toast".

That sounds like a fun project, where did you get the data from?
Don't really want to say because of legality of scraping, but it was a big one with convenient data attributes on the ingredient elements. Shouldn't be too hard to figure out.
C'mon now... talking about data attributes on a html element is not illegal.

allrecipes.com has data attributes on their ingredient list. seriouseats.com has css classes on their ingredients. those are two that i just checked on the spot.

I ended up building my own solution to this problem too (though mine is not open to public)

Me too, although I'm solving a different problem: organization. I'm not so concerned with cost or nutritional value. In the end I went with a somewhat simpler route: LaTeX (well xelatex). I built a couple document classes, one creates a letter sized document and one creates a 4x6 index card sized document. I used the former to concatenate all the recipes into a master PDF as well. This "master" PDF contains the recipes as well as indexes (by author, by ingredient).

I've tried tablets in the kitchen, but ultimately for me the most convenient thing was to just tape a printout onto a cabinet door and go from there.

YMMV.

You mind sharing? My home grown solution also focuses on generating physical documents, but I'm not so happy with my Markdown + custom formatting engine solution.
This sounds like something I would use if it were public. It would be awesome If I could swap recipes from the plan. For example, if I didn't feel like having stir fry I could swap it out for a meal with similar points.
I've thought about making it public, but it's highly optimized for me... also therea no gui. It's just a command line app in python. I could make it open source though. It would be neat to see how other people modify it.
Agree with the others, please consider making this open source. Would love to use and contribute to it!
Maybe find some people from this list that you can try to present with a private alpha version - no polish no bells and whistles - less than an mvp. See what happens from there.
vinney@exnil.io
kudos! i got similar problems with optimizing recipes & groceries, but i never got past google keep and apple reminder.

anyway, a word of caution about open sourcing. people are quick to scream that you make the source available. but what about this? an article/blog describing in more details how you solved the problem instead? few people ever ask that.

what i saw with open source is, once you put the code out there, people will start requesting features, making you carry the burden of maintenance, etc. but ofc there are good things too. i just haven't seen it with small niche projects.

my 2 cents.

I would love to see it even if only to see how that algorithm works.
I would also love to see it ! Please make it opensource if you can, thanks
Please make it open source if possible. I would love to be able to use it.
Would love to see it. Please reach out to me if you do open source it.
Add me to the list of interested parties. :-)
I'm interested as well!
I've a different take. I use a voice diary app that I built (originally for hiking trips) - I take a picture of the ingredients, then record the cooking instructions, and replay this when cooking (the picture shows as background when you play the recording). I add notes about the ingredients, or tags to the recording.

It's easier for me to "listen" to a recipe and pause as needed, vs. to look it up. It's a more casual approach though - no constraint optimisation, or anything like this, but I find it works great for me. Also I can share a recipe this way with someone else by just sharing the recording p2p.

Sounds like https://www.eatthismuch.com/ but with a different algorithm
Would also love to check out an open source version.
I have been thinking about building something like this also. I work from home and so I open the fridge throughout the day for 3 meals, snack, lunch for kids etc.

And I noticed how much is thrown out despite attempts to not do so, because different items have different shelf life.

Wow this looks like an app i could pay for. How do you score the candidates ? Manually ? How do you not end up with the same reciepies recommended all over again, i.e, do you always use a new mutation to try ?
How many people can you feed on $60 a week? Is this in the USA?
I live in MA. This is for 2 adults, 1 4-year-old, 1 almost 2-year-old. I should mention, this price does not include the cost of lunches (The school provides lunch, my wife buys lunch at work, and I usually snack throughout the day instead of eating lunch). Next, I don't buy processed or pre-made foods. So I'll snack on nuts instead of chips. It started as a health thing (they're always filled with sugar, and stuff) but i've found it's also saves a bunch of money. I make my own stocks, and sauces. I cook a lot of chicken, and usually I'll buy bone-in thighs. It started as a flavor thing (I find breast meat flavorless) but it's super cost effective. A family pack costs $.99 a pound, so for less than $5 I can get 2 meals worth of chicken, some bones for stock, and some fat for schmaltz. The rest of the savings come from efficiency. My program groups like ingredients, so I have less waste. A cart full of fresh vegetables, some dairy products, a couple family sized proteins, the occasional staple, and a few bonus treats for the kids is super cheap.

My bill also doesn't include alcohol. I've given up drinking mostly to boost my night-time productivity, but I'll buy wine in bulk which I mostly use for cooking, though I might have a glass with dinner.

You can feed a family of 4 on $60/week in the USA. Especially if you buy staples and raw ingredients and cook everything from scratch.

Rice, flour, beans, lentils, etc should be the bulk of your staples. They are also dirt cheap. Remainder of the money can be used on fresh vegetables.

I would love to use something like this, sounds incredible.