Given k food items, with constraints being the total weights of various nutrients, how do I find the minimum price p?

32 Views Asked by At

Let's say I have six food items; each of them have four attributes: the amount carbohydrates (in grams), the amount of protein, the amount of fat, and the price (in USD). I'd like to buy a combination of these food items such that I would consume a certain amount of carbs, protein, and fat per day for a week, all while minimizing the price.

Excluding the price equation, I have three equations and six unknowns (equations: total amount of carbs/protein/fat; unknowns: number of each food item to purchase). Collectively, these constitute the constraint. The criterion to be met is minimization of the price. How do I find the price?

1

There are 1 best solutions below

0
On

If you'd use matrices, for example, row echalon form then there is a high probability that you could end up with infinite number of solutions.

One of the easier methods from optimal control you can use is dynamic programming. For example, simplex algorithm, but as you only have 3 equations and 6 unknowns, it might me quite a challenge, as some could equal 0.

A good way to help yourself would be create more equations with those unknowns.