| The McDonald's Diet Problem | A Case Study in Optimization Using AMPL |
stretto% ampl
ampl: model diet1.mod;
ampl: data diet1.dat;
ampl data: solve;
MINOS 5.4: ignoring integrality of 9 variables
MINOS 5.4: optimal solution found.
8 iterations, objective 14.8557377
ampl: display Buy;
Buy [*] :=
'Quarter Pounder w/ Cheese' 4.38525
'McLean Deluxe w/ Cheese' 0
'Big Mac' 0
Filet-O-Fish 0
'McGrilled Chicken' 0
'Fries, small' 6.14754
'Sausage McMuffin' 0
'1% Lowfat Milk' 3.42213
'Orange Juice' 0
;
ampl: display n_min,Diet.body,n_max;
: n_min Diet.body n_max :=
Cal 2000 3965.37 Infinity
Carbo 350 350 375
Protein 55 172.029 Infinity
VitA 100 100 Infinity
VitC 100 132.213 Infinity
Calc 100 234.221 Infinity
Iron 100 100 Infinity
;
ampl: let {j in FOOD} f_max[j] := 2;
ampl: solve;
MINOS 5.4: ignoring integrality of 9 variables
MINOS 5.4: optimal solution found.
6 iterations, objective 16.76576923
ampl: display Buy;
Buy [*] :=
'Quarter Pounder w/ Cheese' 2
'McLean Deluxe w/ Cheese' 2
'Big Mac' 2
Filet-O-Fish 0
'McGrilled Chicken' 0
'Fries, small' 1.42308
'Sausage McMuffin' 1
'1% Lowfat Milk' 2
'Orange Juice' 2
;
ampl: display n_min,Diet.body,n_max;
: n_min Diet.body n_max :=
Cal 2000 3798.08 Infinity
Carbo 350 350 375
Protein 55 193.269 Infinity
VitA 100 100 Infinity
VitC 100 305.346 Infinity
Calc 100 234 Infinity
Iron 100 141.846 Infinity
;
ampl: objective Nutr_Amt["Cal"];
ampl: solve;
MINOS 5.4: ignoring integrality of 9 variables
MINOS 5.4: optimal solution found.
6 iterations, objective 3488.286853
ampl: display Total_Cost;
Total_Cost = 17.2484
ampl: display Buy;
Buy [*] :=
'Quarter Pounder w/ Cheese' 1.95219
'McLean Deluxe w/ Cheese' 2
'Big Mac' 0
Filet-O-Fish 0.358566
'McGrilled Chicken' 2
'Fries, small' 2
'Sausage McMuffin' 0
'1% Lowfat Milk' 2
'Orange Juice' 2
;
ampl: display n_min,Diet.body,n_max;
: n_min Diet.body n_max :=
Cal 2000 3488.29 Infinity
Carbo 350 350 375
Protein 55 195.681 Infinity
VitA 100 100 Infinity
VitC 100 339.713 Infinity
Calc 100 197.944 Infinity
Iron 100 106.629 Infinity
;
ampl:
Return to the AMPL examples page.