Professional Documents
Culture Documents
Big Mac Maximization Problem
Big Mac Maximization Problem
1 sets
2 i food items /Hamburger, Mclean, BigMac, SmallFF, Chicken, Honey,
3 ChefSalad, GardenSalad, EggMcMufin, Wheaties, Yoghurt,
4 Milk, OrangeJuice, GrapefruitJuice, AppleJuice/
5
6 j contents /Protein, Sodium, VitA,VitC,VitB1,VitB2,Niacin, Ca, Fe/
7
8 s special contents /calorie, fat/;
9
10 table q(i,j) quantities of contents
11 Protein Sodium VitA VitC VitB1 VitB2 Niacin Ca Fe
12 Hamburger 12 490 4 4 20 10 20 10 15
13 Mclean 22 670 10 10 25 20 35 15 20
14 BigMac 25 890 6 2 30 25 35 25 20
15 SmallFF 3 220 0 15 10 0 10 0 2
16 Chicken 20 580 0 0 8 8 40 0 6
17 Honey 0 0 0 0 0 0 0 0 0
18 ChefSalad 17 400 100 35 20 15 20 15 8
19 GardenSalad 4 70 90 35 6 6 2 4 8
20 EggMcMufin 18 710 10 0 30 20 20 25 15
21 Wheaties 2 220 20 20 20 20 20 2 20
22 Yoghurt 4 80 2 0 2 10 2 10 0
23 Milk 9 130 10 4 8 30 0 30 0
24 OrangeJuice 1 0 0 120 10 0 0 0 0
25 GrapefruitJuice 1 0 0 100 4 2 2 0 0
26 AppleJuice 0 5 0 2 2 0 0 0 4;
27
28
29
30 table qspe(i,s) quantities of special contents
31 Calorie Fat
32 Hamburger 265 9
33 Mclean 320 10
34 BigMac 500 26
35 SmallFF 220 12
36 Chicken 270 15
37 Honey 45 0
38 ChefSalad 170 9
39 GardenSalad 50 12
40 EggMcMufin 280 11
41 Wheaties 90 1
42 Yoghurt 105 1
43 Milk 110 2
44 OrangeJuice 80 0
45 GrapefruitJuice 80 0
46 AppleJuice 90 0;
47
48
49 Parameters
50 p(i) price of food type i
51 /Hamburger 0.59,Mclean 1.79,BigMac 1.65,SmallFF 0.68,Chicken 1.56,
52 Honey 0,ChefSalad 2.69,GardenSalad 1.96,EggMcMufin 1.36,Wheaties 1.09,
53 Yoghurt 0.63, Milk 0.56, OrangeJuice 0.88,GrapefruitJuice 0.68,
54 AppleJuice 0.68/
55 alow(j) lower bound for content j
56 /Protein 55,Sodium 0, VitA 100,VitC 100,VitB1 100,VitB2 100,Niacin 100
57 Ca 100, Fe 100/
58 aup(j) upper bound for content j /Protein 100,Sodium 3000, VitA 385,
59 VitC 1667,VitB1 4000,VitB2 11765,Niacin 233,Ca 250, Fe 562/
60
61 Scalars
62 f coefficient of fat per grams /9/
63 g percentage of calories coming at most from the fat /0.3/
64 cal maximumum calorie to be taken a day /1710/;
65
66 Variables x(i) quantity of food type i to be consumed
67 z total cost;
68
69 positive variable x;
70
71 Equations
72 cost objective function
73 LowerConstraint(j) lower bounded constraints
74 UpperConstraint(j) upper bounded constraints
75 SpecialConstraint calorie vs. fat constraint
76 CalorieConstraint binding calorie;
77
78 cost .. z =e= sum(i, p(i)*x(i));
79 LowerConstraint(j) .. sum(i, q(i,j)*x(i)) =g= alow(j);
80 UpperConstraint(j) .. sum(i, q(i,j)*x(i)) =l= aup(j);
81 SpecialConstraint .. f*sum(i, qspe(i,'fat')*x(i)) =l=
82 g*sum(i,qspe(i,'calorie')*x(i));
83 CalorieConstraint .. sum(i,qspe(i, 'calorie')*x(i)) =l= cal;
84
85 Model BigMac /all/;
86 Solve BigMac using lp maximizing z;
87
88 Display x.l, x.m;
GAMS Rev 138 MS Windows 05/21/04 08:41:21 Page 4
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Model Statistics SOLVE BigMac Using LP From line 86
MODEL STATISTICS
S O L V E S U M M A R Y
GAMS/Cplex Jan 19, 2004 WIN.CP.NA 21.3 025.027.041.VIS For Cplex 9.0
Cplex 9.0.0, GAMS Link 25
z total cost
INPUT C:\WINDOWS\gamsdir\BigMacMax.gms
OUTPUT C:\WINDOWS\gamsdir\BigMacMax.lst