I possess a list of nested recipes, similar to the example provided below:
Mac n Cheese with Nuggets (gives 95 energy point)a) 2x Noodlesb) 1x Ketchupc) 1x Oild) 1x Chicken piecese) 1x cheese
Ketchup (gives 20 energy point)a) 1x onionb) 1x tomatoc) 1x sugar
noodles (gives 25 energy point)a) 1x milkb) 1x eggc) 1x flour
cheeseburger & potato (gives 50 energy point)a) 1x burgerb) 1x cheesec) 1x oild) 2x potato
those may not be real but just an example.
Suppose I have a list of ingredients in my inventory, and I'm aware of the prices for any missing ingredients in the flea market, where prices can fluctuate.
I require an algorithm to identify recipes with the highest energy that can be prepared with the ingredients I have on hand. Additionally, it should consider spending as less as possible to purchase any missing ingredients. We can regard the flea market spending budget as an input to the algorithm, provided by the user.
I am not sure which math can be useful here, any help is highly appreciated.
Thank you in advance
I tried looking at Knapsack problem algorithm but i doubt this is a solution https://en.wikipedia.org/wiki/Knapsack_problem#Multi-dimensional_knapsack_problem