AMPL Programming Question: Happy Kids operates a day care for preschoolers. They
ID: 3773353 • Letter: A
Question
AMPL Programming Question:
Happy Kids operates a day care for preschoolers. They are trying to decide what to feed the children for lunches. They would like to keep their costs down, but they also need to meet the nutritional requirements of the children. They have already decided to go with peanut butter and jelly sandwiches, and some combination of graham crackers, milk and orange juice, apples, and bananas. A sandwich can have both types of jelly (grape, strawberry. The nutritional contents of each food choice are given in the table below.
Food item
Calories from fat
Total calories
Vitamin C (mg)
Protein (g)
Cost (cents)
White Bread (1slice)
10
70
0
3
5
Whole Wheat Bread (1slice)
8
70
1
4
6
Peanut butter (1 tbsp)
75
100
0
4
4
Grape jelly (1 tbsp)
0
50
3
0
7
Strawberry jelly (1 tbsp)
0
45
5
0
6
Graham cracker (1 cracker)
20
60
0
1
8
Milk (1 cup)
70
150
2
8
15
Orange juice (1 cup)
0
100
120
1
35
Apple (1 apple)
2
80
20
2
40
Banana (1 banana)
3
70
5
1
30
The nutritional requirements are as follows.
Each child should receive between 400 and 600 calories.
At least 70 percent of the total calories should not come from fat.
Each child should consume at least 50 milligrams (mg) of vitamin C
Each child should consume at least 15 grams (g) of protein.
Each child needs exactly 2 slices of bread to make the sandwich.
At least one tablespoons of jelly must be used for the sandwich
There must be at most as much peanut butter as jelly.
Each child should consume at least 1 cup of liquid (milk and / or juice).
One fruit per child.
The total amount spent on liquids and fruits must not exceed half the total cost of the meal.
Happy Kids would like to select a menu for each child of minimum cost that satisfies the above nutritional requirements. A linear programming model for this problem is provided below.
A. Algebraric Formation of the above problem (I did this part)
Decision variables: xj= amount of food item j measured in the units in the table
Minimize 5x1 + 6x2 + 4x3 + 7x4 + 6x5 + 8x6 + 15x7 + 35x8 + 40x9 + 30x10
Subject to:
70x1 + 70x2 + 100x3 + 50x4 + 45x5 + 60x6 + 150x7 + 100x8 + 80x9 + 70x10 =< 600
70x1 + 70x2 + 100x3 + 50x4 + 45x5 + 60x6 + 150x7 + 100x8 + 80x9 + 70x10 >= 400
10x1 + 8x2 + 75x3 + 20x6 + 70x7 + 2x9 + 3x10 =< 0.3(70x1+ 70x2+ 100x3+ 50x4+ 45x5+ 60x6+ 150x7+ 100x8+ 80x9+ 70x10 )
0x1 + 1x2 + 0x3 + 3x4 + 5x5 + 0x6 + 2x7 + 120x8 + 20x9 + 5x10 >= 50
3x1 + 4x2 + 4x3 + 0x4 + 0x5 + 1x6 + 8x7 + 1x8 + 2x9 + 1x10 >= 15
x1+x2 = 2
x4 + x5 >=1
x3 =< (x4 + x5)
x7 + x8 >=1
x9 + x10 =1
15x7 + 35x8 + 40x9 + 30x10 =< 0.5 ( 5x1 + 6x2 + 4x3 + 7x4 + 6x5 + 8x6 + 15x7 + 35x8 + 40x9 + 30x10)
All X >= 0
B. Use AMPL to formulate and solve the above linear program. Obtain the dual values of the constraints.
C. Formulate the dual LP algebraically.
Food item
Calories from fat
Total calories
Vitamin C (mg)
Protein (g)
Cost (cents)
White Bread (1slice)
10
70
0
3
5
Whole Wheat Bread (1slice)
8
70
1
4
6
Peanut butter (1 tbsp)
75
100
0
4
4
Grape jelly (1 tbsp)
0
50
3
0
7
Strawberry jelly (1 tbsp)
0
45
5
0
6
Graham cracker (1 cracker)
20
60
0
1
8
Milk (1 cup)
70
150
2
8
15
Orange juice (1 cup)
0
100
120
1
35
Apple (1 apple)
2
80
20
2
40
Banana (1 banana)
3
70
5
1
30
Explanation / Answer
AMPL for nutrient of Happy Kids
Describing the linear program:
Already provided or given that: FoodPack, a collection of food items
NutriPack, a collection of various nutrients
cost n = cost of providing a single pack of meal n, for each such meal in FoodPack
minimumNeed n = minimum need of nutrient n in FoodPaCK
VARIABLE FOR decision making: Yn = packs of meals to be provided , where each n in FoodPack
Minimize the cost
subject to meeting the conditions:
Calories between 400 to 600 - assign variable: calry
70% or above of the calories should come from non-fat food items
minimum vitamin C per child = 50 mg : variable: vitC
minimum protein per child = 15 g : variable: prot
number of breads needed per child = 2 : variable: numBread
minimum jelly per sandwich = 1 tablespoon: variable: Jelly
variable: pntBtr (PeanutButter) must = Jelly
other variables:
minLiq = 1 cup per child
minFruitPerChild = 1
amtOnLiq, amtOnFruits
mealTotCost
0.5 * mealTotCost must <= amtOnLiq + amtOnFruits
AMPL Model:
set MEAL;
set NUTRIENT;
set CHILD;
param amount {MEAL} > 0;
param minMeal {MEAL} >= 0;
param maxNutri { nutri in MEAL} >= minMeal[nutri];
param nutri_min {NUTRIENT} >= 0;
param nutri_max {m in MUTRIENT} >= nutri_min[m];
param amount {NUTRIENT, MEAL} >= 0;
var Provide {nutri in MEAL} >= nutri_min[nutri], <= nutri_max[nutri];
keep TotalSepndingAtLowest: sum { nutri in MEAL} amount[nutri] * Provide[nutri];
sum {nutri in MEAL}
BeingConditioned to MealRequirement { m in NUTRIENT} :
nutri_min[m] <= sum {nutri in MEAL} amount [m,n] * Provide [n] <= nutri_max[m];
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.