Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Optimal Nutrition Through Linear Programming

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Marhl Compur. Modelling, Vol. 13, No. 2, pp. 93-103, 1990 0895-7177/90 53.00 + 0.

00
Printed in Great Britain. All rights reserved Copyright Q 1990 Pergamon Press plc

OPTIMAL NUTRITION THROUGH LINEAR PROGRAMMING


E. Y. RODIN
assisted by
J. DONALDSON, M. HAMMANN,M. KITTRELL and B. MINDLIN
Department of Systems Science and Mathematics, Washington University, St Louis, MO 63130, U.S.A.

TABLE OF CONTENTS

1. Introduction
2. Hypothetical problem
2.1. Problem statement
2.2. Graphical solution
2.3. The simplex method of solution
3. Model of the ideal diet plan
3.1. Food list
3.2. Constraints
3.3. Formulation of the model
3.4. Sample solutions
4. Conclusion
5. References
6. Exercises
I. Answers

1. INTRODUCTION

Many people are confronted daily with the problem of obtaining a nutritionally balanced diet.
Several factors have to be taken into consideration-calories, protein, iron, the various vitamins
and, of course, variety. Personal characteristics and lifestyle also have to be taken into account-
for example, an athlete’s optimal menu would differ markedly from a hospital patient’s ideal
meal plan.
We would like to develop a mathematical model for the ideal diet plan for different classifications
of people, i.e. athletes, patients, vegetarians, children and “average” male and female adults. Such
a plan should insure that over a specified period of time the diet supplies the proper nutrients
without exceeding certain caloric bounds. It also seems desirable to attempt to minimize the cost
of the plan. The presence of these nutritional constraints and the cost objective function suggests
that the development of the ideal diet plan is actually a linear programming (LP) problem.

2. HYPOTHETICAL PROBLEM

2.1. Problem statement


Suppose the only foods available for purchase are corn and green beans. Using the data in
Table 1, we want to satisfy the given nutrition and calorie constraints, and at the same time
minimize the cost.

Table I
Protein/lOOg Vitamin C/l00 g Cal/100 g Price/l00 g (S)
Green beans 1.5 20 I8 0.20
Corn 3.5 IO 100 0.15
Minimums 20 g/day 70 mg/day -
Maximums - - 600 calidav -
94 Educational Mathematical and Computer Modules

Let x, be the number of 100 g units of green beans and x2 the number of 100 g units of corn.
The total cost of these items will be
f = 0.2x, + 0.15x,. (1)
Nutritional balance in our diet requires that we meet the daily minimums and maximums of
protein, vitamin C and calories indicated in the last two rows of Table 1. The constraints can be
expressed as
1.5x, + 3.5x, > 20, (2)
20x, + 102> 70, (3)
and
18x, + 100x, < 600. (4)
Since we cannot eat a negative amount of food, we must also have
x, 2 0 and x2 > 0. (5)
2.2. Graphical solution
We will first attempt to solve this problem graphically. In Fig. 1, the three constraint inequalities
(2)<4) have been plotted. The shaded area represents those point which satisfy all the constraints
(2)-(4). They can be thought of as all possible solutions to the LP problem and are called the
feasible set.
We must now find the point (x: , xf ) which makes the cost function (1) smaller than would any
other point in the feasible set. To do this, some of the family of lines f = c have been drawn in
Fig. 1. Since the line f = 0.9 does not intersect the feasible set, but f = 1.2 does, the minimum of
f should be between these two values. In fact, the first member of the family f = c to intersect the

/ 1.5x, +3.5x2 l 20
XI

12

10

6
f =1.5

f-1.2

110.9
4

0 2 4 6 6 10 xp

Fig. 1
Optimalnutrition through LP 95

feasible set will be that line which touches the lower left-hand corner. Reading the values of x, and
x2 from the graph at this point we have that x : = 0.8, x: = 5.4 so that the value of the program
(the cost of the food) will be f = 974.
If x, and x2 were restricted to integer values, i.e. if corn and beans were only sold in units of
100 g, the optimal solution in the feasible wet would be XT = 2, XT = 5, and the value of the
program would be f = $1.15.

2.3. The simplex method of solution


We will now solve the same problem using what is known as the simplex method. This method
has proved very successful in the solution of LP problems. It is an iterative method in which we
move from one feasible point to another in such a way that the objective function always increases.
2.3.1. Standard form. Before describing the simplex method we must put the problem into
standard form. Since any LP problem can be put in standard form, we need only describe the
simplex algorithm leading to a solution for that form.
The simplex method involves the solution of simultaneous linear algebraic equations so any
inequalities among the constraint set must be transformed into equalities. This can be achieved by
introducing extra unknowns called “slack” or “surplus” variables depending on the nature of the
inequality. Since these new variables must also be non-negative, constraints (2)-(4) can be rewritten
as
1.5x, + 3.5x, - s, = 20,
2x, + x* - s* = 7,

O.l8x,+x,+s,=6, (6)
where x, , x2, s, , s2 and s3 > 0. Note that the surplus variables, sl and s2, are preceded by minus
signs while the slack variable, s3, is preceded by a plus sign.
The standard form also requires that the objective function be maximized. In our problem we
are seeking to minimize the cost of the food so we must alter the objective function by negating
it. The solution maximizing the negative of the function will also minimize the function itself. Thus,
the objective function for our problem becomes

g = -0.2x, -0.15x*. (7)


2.3.2. Characterization of optimal solutions. The feasible set of points is defined similarly to the
way it was for the graphical method except that the slack variables must also be taken into account.
Thus, a feasible point for our problem is one satisfying constraints (6).
In general, two possibilities exist for the feasible set-either it is empty, i.e. the constraints are
contradictory, or it contains at least one feasible point. If at least one feasible point exists, then
the objective function either can be made infinitely large or has a finite maximum which may or
may not be unique. The feasible point at which the objective function takes on its maximum value
is called the optimal solution of the LP problem and the maximum of the function is called the
value of the program.
The feasible points of primary interest in the simplex method are those known as basic feasible
points. A basic feasible point is a feasible point for which n - m of the n variables are zero, where
m is the number of independent equations in the constraint set. For our problem a basic feasible
point must have 5 - 3, i.e. 2, of the variables as zero. The importance of the basic feasible points
is the relationship they bear to the optimal solution. This relationship is characterized by the
following theorem:

Theorem 1. If an optimal solution exists then there exists an optimal solution which
is also a basic feasible point, i.e. at least n - m of its coordinates are zero.
Thus, the simplex method need only be concerned with basic feasible points. Once such a point
has been found, we move to another basic feasible point which will increase the value of the
objective function. If no such increase can be made, then the current basic feasible point is the
optimal solution.
96 Educational Mathematical and Computer Modules

2.3.3. The simplex algorithm. In order to facilitate the use of this method in the solution of our
problem, we will first summarize the basic steps in the following manner:

1. Find a basic feasible point at which the iteration can begin by dividing the n
variables into n - m independent and m dependent variables.
2. Express the dependent variables and the objective function in terms of the
independent variables.
3. If none of the coefficients in the expression of the objective function in terms of
the present independent variables is positive, then the present basic feasible point
is an optimal solution, so stop.
4. For each of the independent variables, yi, which have positive coefficients in the
objective function, determine the largest possible positive increment, Ayi, one can
make in the independent variable without making any of the independent
variables negative. Note the values of these increments for each independent
variable as well as the corresponding increment in the objective function and the
dependent variable, y,, which inhibits any further increase in y, by becoming zero.
5. Interchange the independent variable yi with the dependent variable y, from
Step 4.
6. Return to Step 2.

The condition for completion of the process which is stated in Step 3 is known as the optimality
criterion. If the optimality criterion is satisfied, the objective function cannot increase when one
(or more) of the independent variables are given positive values. Since negative values are not
allowed, this insures that the objective function is maximized.
2.3.4. Solution of the nutrition problem. We are now ready to apply the simplex method to the
solution of the hypothetical nutrition problem. We will start by selecting x, and x2 as independent
variables. The objective function (7) is already in terms of these variables so we need only to rewrite
the constraints as

s, = 1.5x, + 3.5x, - 20,

s* = 2x, + x* - 7,

So = -0.18x, -x2 + 6. (8)

Our objective is to find a basic feasible point. To do this we fix x, = 0, and determine the minimum
value of x2 which will satisfy s, , s2, s3 > 0. It can be seen that when x, = 0, s2 > 0 requires x2 > 7
and sj 2 0 requires x2 < 6. So there is no such x2. Therefore, fix x2 = 0 to get

s, 2 0*x, > 13.3,

s2 20*x, 2 3.5,

s3 20*x, < 33.3.

Since the coefficient of x, in the objective equation is negative, we want to choose the minimum
x, which insures that all the slack variables will be nonnegative. Thus, the limiting constraint is
s, 2 0 and we exchange s, and x,, making s, and x2 the new independent variables.
We next solve for the others in terms of sl and x2:

x, = 2/3s, - 7/3x, + 4013,

S2 = 4/3S, - 1 l/3X2 + 5913,

s3 = 0.12s, - 1.42x, + 8.4. (9)

The objective function must also be put in terms of the new independent variables:

g = -0.4/3s, + 0.95/3x2 - 813.


Optimal nutrition through LP 97

Since x2 has a positive coefficient in the objective function, we want to fix s, = 0 and increase x,
as much as possible. If s, = 0, then

x, B 0 =x2 < 40/l,

s, > 0*x, < 59111,

s3 2 0*x, < 8.411.42.

The least of these upper limits is 59/ 11, imposed by s2. Following the same procedure as previously,
we switch s, and x,, making s, and s2 our independent variables. Constraints (8) can now be written
as

x2= 1/11(4s,-3s,+59),

x, =6/33s, +7/11s,+9/11,

s3 = -4.36/l Is, + 4.26/l Is, + 8.62/l 1, (10)


while the objective function becomes

g = -0.2/l Is, - 0.95/l Is, - 10.65/l 1.

Since s, and s2 both have negative coefficients in the objective function, and all the constraints (i.e
XI, x2, s3 > 0) are satisfied when s, = 0 and s2 = 0, the optimality criterion of Step 3 is satisfied.
Substituting s, = 0 and s, = 0 into equations (10) gives

x:=9/11 =0.818 and x:=59/11 -5.364.

The cost of these amounts of corn and green beans will be

f = -g = $0.97.

It should be noted that the optimal solution (XT, xf) as well as the value of the program were
the same whether the problem was solved graphically or by the simplex method. The advantages
of the simplex method are that it yields answers algebraically which may be only approximately
readable from a graph and it allows the solution of LP problems of higher dimension.

3. MODEL OF THE IDEAL DIET PLAN

3. I. Food list
A diet composed of only green beans and corn would be monotonous and nutritionally
unbalanced. The development of an ideal diet plan requires that the problem be expanded to
include a variety of foods including meats, fruits, vegetables, milk products, breads and cereals and
“junk” foods. A list of 38 foods and their nutritive content and cost per 100 g is presented in
Table 2.

3.2. Constraints
A balanced diet should, in the long run, contain the minimum daily requirements of vitamins
A, C and B6, iron and protein, while staying within a specific calorie range. These requirements
are summarized in Tables 3 and 4. The minimums and maximums vary from person to person
depending on age, weight and sex.
In addition to caloric and nutritional constraints it also is desirable to place some variety
constraints on the diet so that we do not end up eating a constant diet of liver and oranges for
instance. Also, if some foods of low nutritional value, for example candy bars, are desired, we must
put some minimum constraint on them.
98 Educational Mathematical and Computer Modules

Table 2
Food Protein Iron Vit C Vit A Vit 86 Calories cost (S)
Chicken 30 I.5 0 75 0.35 I83 0.23
Ham 18 2.5 0 0 0.5 246 0.48
Liver I9 I7 25 12,000 0.6 I55 0.12
Bologna 13 2 0 0 0 350 0.57
Pork 24 2.5 0 0 0.1 390 0.28
Sirloin steak 28 4.5 0 0 0.08 440 0.59
Fish I7 0.8 0 0 0.2 220 0.35
Peanut butter 30 2 0 0 0.45 350 0.28
Eggs 13 2.5 0 1000 0.2 80 0.06
Skim milk 3.5 0.1 I 0 0.04 34 0.05
Am. cheese 25 0.7 5 705 0.3 331 0.47
Yogurt 4 0 I 12s 0.04 280 0.15
Cottage cheese 30 0 0 4 8 95 0.23
Butter 0.5 0.1 0 3500 0 750 0.19
Ice cream 4.5 0.2 I 450 0 II6 0.07
Whole milk 3.5 0 2 I25 0.04 65 0.06
White bread 8 2 0 0 0.07 250 0.13
Wheat bread 8 8 0 0 2 265 0.08
Special K 28 IO 70 5000 2 388 0.27
Sugar pops 5 4 62 4400 2 380 0.35
Rice 2 0.2 0 0 0.07 380 0.09
Spaghetti 3.5 0.4 0 0 0 I05 0.1 I
Donuts 7 0.1 0 0 0 500 0.30
Coca-Cola 0 0 0 0 0 38 0.04
Candy bar 0 0 0 0 0 530 0.59
Apples 0.2 0.3 6 75 0.05 42 0.11
Oranges 0.9 0.3 50 I50 0.05 38 0.1 I
Bananas I 0.5 IO 300 0.3 85 0.07
Strawberries 0.7 0.7 60 7s 0.05 27 0.12
Green beans I.5 0.8 20 600 0 18 0.20
Corn 3.5 0.6 IO 400 0.1 100 0.15
Carrots I 0.6 6 12,000 0.08 27 0.09
Potatoes 2 0.6 25 0 0.3 75 0.02
Tomatoes I 0.5 25 1000 0.09 I6 0.22
Chicken soup I4 2.5 0 325 0 350 0.12
Ted 0.1 0 0 0 0 I 0.07
Coffee 0.3 0 0 0 0 3 0.75

3.3. Formulation of the model


The problem can be formulated in the same manner as the simpler one. First we define the
variables,
xi: each food item (i = 1 to 38)
Ai: amount of vitamin A in 100 g of x,
Ci: amount of vitamin C in 100 g of xi
Bi: amount of vitamin B6 in 100 g of xi
Fi: amount of iron in 100 g of xi
Ri: amount of protein in xi
Pi: cost of 100 g of xi
Ki: calories for 100 g of xi.
The objective of the process is to minimize the cost of the foods while meeting the nutritional,
caloric and variety constraints. Thus, the objective function is to be minimized and can be written
as
38
f = c P,Xi. (11)
i=l

Table 3. Formulas for calorie allowance


Men
25 years old 725+31 W
45 years old 650 + 28 W
65 years old 550 + 23.5 W
W0l?lePl
25 years old 525 + 27 W
45 years old 475 + 24.5 W
65 years old 400 + 20.5 W
W = weight in kg
Optimal nutrition through LP 99

Table 4. Recommended daily dietary allowances


Protein (mg) Iron (mg) Vit C (mg) Vit A (iu) Vit B6 (mg)
Men (1541b, 69”)
18-35 years old 70 10 70 5000 2
35-55 years old 70 10 70 5000 2
55-75 years old 70 IO 70 5000 2
Women (IZSlb, 64”)
18-35 years old 58 15 70 5000 2
3%55 years old 58 15 70 5000 2
55-75 yean old 58 IO 70 5000 2

The nutrition constraints are

F R,xi 3
i= I
&in (12)

and the caloric constraint is

Kmi,< f K,Xi d -La,. (13)


i= I

Note that in the more realistic problem under consideration we must also require that a certain
minimum number of calories be consumed on a daily basis. We can insure variety by requiring

X max 2 xi 2 Xnk (14)

for each food.

3.4. Sample solutions


The LP problem formulated in the preceding section is much too large to solve without the
assistance of a computer. A computer package utilizing the simplex method was used to plan a
diet for 20-year-old male weighing 150 lb.
With no variety constraints, the diet consisted of only liver, rice, potatoes, coke and tea and cost
only 79+.a day. Although this diet is not costly, it does lack something. In order to make the diet
more interesting, a general 20 g/day minimum was imposed with the following additional
constraints:

0.8 g/day G liver < 2.0 g/day,

20 g/day < potatoes < 100 g/day,

1 g/day < butter < 5 g/day,

20 g/day < rice G 25 g/day,

200 g/day < tea.


100 Educational Mathematical and Computer Modules

Table 5. Sample menu


Breakfast Lunch Dinner
Sunday 2 Eggs Peanut butter Chicken
Hash browns Skim milk Rice-3 oz
(6 oz) Cook carrots
Ice cream
Monday Special K Chicken noodle soup Ham
(2 02) Apple Boiled potatoes
Green beans
Tuesday Sugar pops Yogurt Liver and egg
(2 02) Carrot Scalloped potatoes
Candy bar
Wednesday Cottage cheese Peanut butter Pork
Banana Rice-3 oz
Thursday Special K Bologna Spaghetti and tomato
(2 02) Am. cheese Carrot
Strawberries (2 02) Ice cream
Friday Sugar pops Peanut butter Fish
(2 02) Whole milk Corn
Orange Candy bar Green beans
Saturday Special K Am. cheese Sirloin steak
(1 02) Carrot Baked potatoes
Sugar pops White bread Corn
(1 02) Cake
6 slices of wheat bread per meal
I can of coke and 2 candy bars for snacks
I .2 oz of butter per week

The results of this problem were used to plan the menu in Table 5. The menu was obtained by
multiplying the number of days by the proportions provided by the LP problem. The daily
expenditure for food for this menu is $1.86.

4. CONCLUSION

The methods of LP could be applied to the nutrition problem to vary the menu to the particular
needs of individuals. For instance, a vegetarian could substitute other foods for the meats listed,
or a “weight watcher” could minimize the calories instead of the costs. Whether it is a hospital
planning menus or a family working with a limited income, this model will provide a nutritionally
sound menu, catering to individual situations, at a minimum cost.
In general, LP can be used to solve constrained minimization or maximization problems in a
variety of fields. Some examples of such applications are the product-mix problem, personnel
assignment, transportation problem and scheduling.

5. REFERENCES
I. S. P. Bradley, A. C. Hax and T. L. Magnanti, Applied Mathematical Programming. Addison-Wesley, Reading, Mass.
(1977)
2. F. Hart, A. M. Leslie and H. J. Fisher, Modern Food Analysis. Springer, New York (1971).
3. K. L. Jones, L. W. Shainberg and C. 0. Byer, Foods, Diet and Nutrition. Canfield Press, San Francisco, Calif. (1970).
4. D. R. Osborn and P. Voogt, The Analysis of Nutrients in Food. Academic Press, London (1978).
5. C. Rorres and H. Anton, Applications of Linear Algebra. Wiley, New York (1977).

6. EXERCISES
Suppose that your diet consisted of only cottage cheese and wheat bread and the only constraints on your diet were
that your protein must be > 30 g/day and your calorie intake must be <950/day. You would like to minimize the daily
cost of this diet.
(a) Formulate the LP problem.
(b) Solve the problem graphically
(c) Construct the standard form of the problem and solve it using the simplex method.
Suppose that instead of a maximum caloric intake of 950 calories we needed a minimum of 265. Make the appropriate
changes in the LP problem and solve it graphically and by means of the simplex method.
What would the maximum food cost be under the constraints of Exercise I? Of Exercise 2?
Optimal nutrition through LP 101

4. Instead of solving the problem as stated (the primal problem), one could instead formulate and solve the dual problem.
To change the primal to the dual problem you follow four steps:
(a) interchange the number of variables and the number of constraints;
(b) interchange the constraint vector and the cost vector;
(c) reverse the constraint inequalities;
(d) change maximums to minimums and vice versa.
The value of the dual problem is the same as the value of the primal problem. Formulate and solve the dual problem
associated with Exercise 1.
5. Use a computer package to develop an ideal diet plant for yourself or someone you know.

I. ANSWERS
I. (a) X, = amount of cottage cheese, x2 = amount of wheat bread. Constraints:

30x, + 8x, > 30,

95x, + 265x, < 950,

Minimize:
f = 0.23x, + 0.08x,.

(b)

X2
6

f =0.46 tx;,x; )=(l,O)


f = 0.23

2 4 6 6 10 x,

308, / + 6x2 b 30

(c) Standard form:


30x, + 8x, - s, = 30,

95x, + 265x, + s> = 950,

Xl, x2, 31, s2 2 0.

Maximize:
g = -0.23x, -0.08x,.

Choose x, and x2 as the independent variables. Then

s, = 30x, + 8x, - 30,

sr = -95x, - 265x, + 950.

For x, = 0, S, 2 0 requires x2 > 3.75, s2 > 0 requires x2 Q 3.6. There is no such x2. Therefore, fix x2 = 0. s, > 0 requires
x I/> 19s 2A> 0 requires x, < 10. Since the coefficient of x, in the objective function is negative we choose the minimum
x, and exchange s, and x,. Solving for x, and s2 in terms of s, and x2, we have

4
x,=2--x,+ 1,
30 I5

s,=+9+9xx,+95o

and
-0.23
ps, - 0.02~~ - 0.23.
g= 30
102 Educational Mathematical and Computer Modules

Choosing S, = 0 and x2 = 0 will maximize g since their coefficients are negative and still insure sr and x, > 0. Thus,
-uF = 1 and .x: = 0, and the minimum cost is 0.23.
Notice that the caloric constraint did not affect the solution. This is an example of an inoperative
constraint.
New constraint:
95x, +265x, > 265.

Graphical solution

30x, + .s;* a 30 95& + 265x2 b 265 ’

Simplex method
New constraint:
95x, f 265.x, - s2 = 265.

Choose x, and x2 as the independent variables, then

s, = 30x, + 8x, - 30,

sz = 95x, f 265x, = 265.

For x, = 0, r, 2 0 requires x2 2 3.75, s2 > 0 requires x2 > 1. Exchanging .r, and ~2, we have

sr = T - 898.75x, + 278.15
and
g = 0.07x, - O.OlS, - 0.3

Since x, has a positive coefficient in g, we fix s, = 0 and increase X, as much as possible:

Therefore, exchange x, and s2 to get

x, = 0.0369s, - 0.00111~~ + 0.811,

x2 = -0.0132s, + 0.00417s, + 0.709


and
g = -0.0074s, - 0.0000777s, - 0.243.

Since s, and s2 both have negative coefficients in g and all the constraints are satisfied, take S, = 0 = s2. Thus, x7 = 0.811
and x: = 0.709 and the minimum cost is f = $0.24.
The constraints stay the same; maximizef= 0.23x, + 0.08.x,. Graphically for Exercise I: (x;, x;) = (10, 0), f = $2.30.
Graphically for Exercise 2: (XT. x!) = (co, co).
Simplex method for Exercise 1
Let S, + x, be independent:
x,=$-gx’+ 10,

-30
s, = 95 s2 - 75.7x, + 270

and
-0.23
ps2 - 0.57x, + 2.30.
f= 95
Thus, the maximum off is attained for s2 = x2 = 0 which means (xr , x$) = (10, 0).
Optimal nutrition through LP 103

4. Since only the first constraint was operative in Exercise 1, we will only use it to formulate the dual problem. Thus, we
have one variable an two constraints:
3Oy, c 0.23,
Sy, 6 0.08.
Maximize:
h = 3Oy,.
The constraints imply that y, < 0.23/30 and the maximum of the objective function will be h = 0.23. Note that this is
the same as the value of the program in Exercise 1. In general, it the number of constraints of a problem is much greater
than the number of variables, it is usually better to formulate and solve the dual problem.

You might also like