Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12141

Nested recipes for list of ingredients algorithm

$
0
0

I possess a list of nested recipes, similar to the example provided below:

  1. Mac n Cheese with Nuggets (gives 95 energy point)a) 2x Noodlesb) 1x Ketchupc) 1x Oild) 1x Chicken piecese) 1x cheese

  2. Ketchup (gives 20 energy point)a) 1x onionb) 1x tomatoc) 1x sugar

  3. noodles (gives 25 energy point)a) 1x milkb) 1x eggc) 1x flour

  4. 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


Viewing all articles
Browse latest Browse all 12141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>