0% found this document useful (0 votes)
56 views

Big Mac Maximization Problem

The document describes a linear programming model that maximizes consumption of Big Macs subject to nutritional constraints. The model selects foods to consume each day to maximize total cost while meeting daily limits on calories, fat, vitamins and minerals. The optimal solution includes consuming Garden Salad, Wheaties, Milk, and Orange Juice.

Uploaded by

Braas Tardan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Big Mac Maximization Problem

The document describes a linear programming model that maximizes consumption of Big Macs subject to nutritional constraints. The model selects foods to consume each day to maximize total cost while meeting daily limits on calories, fat, vitamins and minerals. The optimal solution includes consuming Garden Salad, Wheaties, Milk, and Orange Juice.

Uploaded by

Braas Tardan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

BIG MAC MAXIMIZATION PROBLEM

GAMS Rev 138 MS Windows 05/21/04 08:41:21 Page 1


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
C o m p i l a t i o n

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

BLOCKS OF EQUATIONS 5 SINGLE EQUATIONS 21


BLOCKS OF VARIABLES 2 SINGLE VARIABLES 16
NON ZERO ELEMENTS 245

GENERATION TIME = 0.000 SECONDS 4.0 Mb WIN213-138 Feb 03, 2004

EXECUTION TIME = 0.000 SECONDS 4.0 Mb WIN213-138 Feb 03, 2004


GAMS Rev 138 MS Windows 05/21/04 08:41:21 Page 5
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
Solution Report SOLVE BigMac Using LP From line 86

S O L V E S U M M A R Y

MODEL BigMac OBJECTIVE z


TYPE LP DIRECTION MAXIMIZE
SOLVER CPLEX FROM LINE 86

**** SOLVER STATUS 1 NORMAL COMPLETION


**** MODEL STATUS 1 OPTIMAL
**** OBJECTIVE VALUE 21.7181

RESOURCE USAGE, LIMIT 0.150 1000.000


ITERATION COUNT, LIMIT 7 10000

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

Optimal solution found.


Objective : 21.718128

LOWER LEVEL UPPER MARGINAL

---- EQU cost . . . 1.000

cost objective function

---- EQU LowerConstraint lower bounded constraints

LOWER LEVEL UPPER MARGINAL

Protein 55.000 55.451 +INF .


Sodium . 1582.709 +INF .
VitA 100.000 385.000 +INF .
VitC 100.000 1483.166 +INF .
VitB1 100.000 239.084 +INF .
VitB2 100.000 190.588 +INF .
Niacin 100.000 100.000 +INF -0.009
Ca 100.000 100.000 +INF -0.027
Fe 100.000 117.640 +INF .

---- EQU UpperConstraint upper bounded constraints

LOWER LEVEL UPPER MARGINAL

Protein -INF 55.451 100.000 .


Sodium -INF 1582.709 3000.000 .
VitA -INF 385.000 385.000 0.017
VitC -INF 1483.166 1667.000 .
VitB1 -INF 239.084 4000.000 .
VitB2 -INF 190.588 11765.000 .
Niacin -INF 100.000 233.000 .
Ca -INF 100.000 250.000 .
Fe -INF 117.640 562.000 .
LOWER LEVEL UPPER MARGINAL

---- EQU SpecialCo~ -INF -105.824 . .


---- EQU CalorieCo~ -INF 1710.000 1710.000 0.011

SpecialConstraint calorie vs. fat constraint


CalorieConstraint binding calorie

---- VAR x quantity of food type i to be consumed

LOWER LEVEL UPPER MARGINAL

Hamburger . . +INF -1.933


Mclean . . +INF -1.163
BigMac . . +INF -2.941
SmallFF . . +INF -1.646
Chicken . . +INF -1.036
Honey . . +INF -0.495
ChefSalad . . +INF -0.292
GardenSalad . 2.940 +INF .
EggMcMufin . . +INF -1.020
Wheaties . 4.706 +INF .
Yoghurt . . +INF -0.267
Milk . 2.628 +INF .
OrangeJuice . 10.630 +INF .
GrapefruitJuice . . +INF -0.181
AppleJuice . . +INF -0.310

LOWER LEVEL UPPER MARGINAL

---- VAR z -INF 21.718 +INF .

z total cost

**** REPORT SUMMARY : 0 NONOPT


0 INFEASIBLE
0 UNBOUNDED
GAMS Rev 138 MS Windows 05/21/04 08:41:21 Page 6
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
E x e c u t i o n

---- 88 VARIABLE x.L quantity of food type i to be consumed

GardenSalad 2.940, Wheaties 4.706, Milk 2.628


OrangeJuice 10.630

---- 88 VARIABLE x.M quantity of food type i to be consumed

Hamburger -1.933, Mclean -1.163, BigMac -2.941


SmallFF -1.646, Chicken -1.036, Honey -0.495
ChefSalad -0.292, EggMcMufin -1.020, Yoghurt -0.267
GrapefruitJuice -0.181, AppleJuice -0.310

EXECUTION TIME = 0.010 SECONDS 2.9 Mb WIN213-138 Feb 03, 2004

USER: GAMS Development Corporation, Washington, DC G871201:0000CA-ANY


Free Demo, 202-342-0180, [email protected], www.gams.com DC9999

**** FILE SUMMARY

INPUT C:\WINDOWS\gamsdir\BigMacMax.gms
OUTPUT C:\WINDOWS\gamsdir\BigMacMax.lst

You might also like