In: Math
You would like to make a nutritious meal of eggs, edamame and elbow macaroni. The meal should provide at least 30g of carbohydrates, at least 20g of protein, and no more than 60g of fat. An egg contains 2g of carbohydrates, 17g of protein, and 14g of fat. A serving of edamame contains 12g of carbohydrates, 12g of protein and 6 g of fat. A serving of elbow macaroni contains 43g of carbohydrates, 8g of protein, and 1g of fat. An egg costs $2, a serving of edamame costs $5, and a serving of elbow macaroni costs $3. Formulate a linear optimization model that could be used to determine the number of servings of egg, edamame, and elbow macaroni that should be in the meal in order to meet the nutrition requirements at minimal cost.
First we represent the problem in tabular form:
Carbohydrates | Protein | Fat | |
Egg | 2g | 17g | 14g |
edamame | 12g | 12g | 6g |
elbow macaroni | 43g | 8g | 1g |
Total | >=30g | >=20g | <=60 |
Given: An egg costs $2, a serving of edamame costs $5, and a serving of elbow macaroni costs $3.
Let the total number of eggs required = x1
Let the total number of edamame required = x2
Let the total number of elbow macaroni required = x3
Total cost is represented by Z.
The total cost is given by the required number of eggs, edamame and elbow macaroni multiplied by its per unit cost $2, $5, $3 respectively.
cost: Min z= 2x1+5x2+ 3x3
Constraints:
1. Each unit of egg, edamame and elbow macaroni contains 2g, 12g and 43g of carbohydrates respectively. The meal should provide atleast 30g of carbohydrates.
2x1+12x2+ 43x3 ≥ 30
2. Each unit of egg, edamame and elbow macaroni contains 17g, 12g and 8g of protein respectively. The meal should provide atleast 20g of protein.
17x1+12x2+ 8x3≥ 20
3. Each unit of egg, edamame and elbow macaroni contains 14g, 6g and 1g of fats respectively. The meal should provide not more than 60g of fats.
14x1+6x2+ x3 ≤ 60
4. Also the unit of egg, edamame and elbow macaroni requires are positive integers.
i.e. x1 ≥ 0, x2 ≥ 0, x3 ≥ 0