I'd love to use the same system. Is it open source?
I'd love to use the same system. Is it open source?
Ill be happy to start an open source project with a few peeps if their interested as well?
Catch me on github https://github.com/Alfanhui
Recipes table : it tooks some months to fill it with our choices (prefered recipes) and add attributes to that : cold/warm meal, difficulty, time taken, kind of meal (junk, bistrot, classical, exotic...), does it scale (x0.5, x2, x4...).
ingredient_table : each receipe got ingredients. Every kind of ingredrients are on a separate table.
product_table : it is there i display what you can buy from stores : 6/12/24 eggs bundle, 250/500g butter
Then it starts to be ugly, cause there is constraints : loose and hard. Timetable is a hard constraint (i don't want to cook monday evening), so it will be double ration one of the day before, Season is a hard constraint (you buy vegetables when they are in season) Tastes are a hard constraint : you decides what kind of meal you want to eat during the weak
With that you get available recipes and a timetable for cooking and quantity to cook.
Price is a lose constraint, leftovers are a lose constraint, time spent cooking is a lose constraint (could be a hard, if you have enough recipes, but as i like cooking, it's no matter for me)
After, i enumerate all possibilities and each one get a score based on lose constraints : you can use a simple weighted average, exponentially weighted average... You tweak coefs to prefer a nice price or a little time spent and then it's done. Usually a chose randomly between the ten best solutions.
I got enough recipes to cover all hard constraints. I avoid lot of problems doing a big enumeration for all possibilities (it takes a couple of minutes at my scale for 200 recipes), also, hard constraints are pretty easy to deal with, it could be a lot more complicated if user become picky on meals. I'm no coder so i don't know any design pattern or anything that could help me to design a better algo. But, as far as i know, when you can't evaluate all possibilities you have to go the optimization road.
Answers to questions : - Yeah, there is this website : https://fr-en.openfoodfacts.org/ (broken TLS it seems) that could be used to pull data on ingredients, - I don't have plan to open-source it : it's pretty hacky, ugly and probably defy any coding rule (except 4 space ident PEP8). it's not even packeged (i've never done that before...)