You are on page 1of 7

20

2.2.2

2 Linear Programming

Diet Problems

The diet problem is not only among the first linear programming problems to be
solved, but it is arguably also the most intuitive model. As a matter of fact, the
problem was studied in 1939 by the (later Nobel laureate) George Stigler in the
context of determining a cost-minimal nutritious food for the armed forces. Incidentally, he included 77 different foods in his model. His solution, while not
optimized, was found to be quite close to the optimal solution for his data. An
interesting account of the history of the diet problem is found in Garner Garille and
Gass (1981).
In general, two versions of the problem can be thought of. They are roughly
equivalent to the fundamental economic principle, applied to the determination of a
diet. The two criteria are cost and nutritional value, where cost is an input factor,
while nutritional value is an output. Thus we can either try to minimize the cost (the
input), while guaranteeing at least a certain and predetermined nutritional value
(the output), or we can attempt to maximize the nutritional value (the output),
while using no more than a prespecified dollar value (the input). In order to determine
which of the two versions is more suitable, consider this. In the latter approach, the
constraint is a simple resource constraint that states that the total amount of money
spent on food cannot exceed the decision makers budget. However, the objective
function is more complex. It is stated to maximize the nutritional value. The problem
with this is that the measure nutritional value is not a simple number, it is what is
usually referred to as multidimensional measure, as it comprises a large number of
measures: protein, carbohydrates, fats, vitamins, minerals, etc. And it is obviously not
meaningful to simply add those different units together so as to obtain a single onedimensional measure.
On the other hand, the former version of the problem is much easier to handle. The
objective is a simple (one-dimensional) cost minimization, in which the nutritional
content is relegated to the constraints. And this is where the requirements can be
handled quite easily: for each nutritional component, we can formulate one or two
constraints, an upper and/or a lower bound. As a simple numerical example, consider
three foodstuffs, e.g., hamburger, fries, and cheesecake (indicating that we are using the
term diet in the widest possible sense). As far as nutrients are concerned, we consider
only calories and fat in our example. Table 2.2 shows the nutritional contents of the
foodstuffs, the nutritional requirements, and the prices per serving of the foods.
Note that our numerical example expresses the calories in terms of the usual
kCal and we have an upper and a lower bound for it. (Note that in practice, the
recommended caloric intake depends on gender and age of an individual, as well as
other factors). On the other hand, the fat content is expressed in terms of the
recommended daily requirements and it is an upper bound.
The problem in the cost minimization version can then be formulated as follows.
First, we define the variables. As usual, the variables are defined depending on what
the decision maker would like to know, but does not at the moment. In this model,
the decision makers goal is to determine the quantities of the individual foods that
are to be included in the daily diet, so that we will define variables x1, x2, and x3 as

2.2

Applications of Linear Programming

21

Table 2.2 Input data for the sample problem

Calories
Fat
Cost per serving

Hamburger
3 oz
250
13 %
$1.59

Medium fries
4 oz
380
31 %
$2.19

Cheesecake
2.8 oz
257
28 %
$2.99

Nutritional requirement
[1,800; 2,200]
100 %

the quantities of hamburgers, medium fries, and cheesecakes in the diet. As long as
we use well-defined servings as units, and stick to the same units for each food,
there is no problem inadvertently adding apples and oranges, or hamburgers and
fries for that matter. What we are adding are their nutritional contents, as we show
in this example.
First consider the objective function. The general idea is to minimize the costs of
all foodstuffs in the diet. Consider one of these foods at a time. As shown in
Table 2.2, each hamburger costs $1.59. Since there will be x1 hamburgers in the
diet, the total costs incurred by hamburgers in the diet are 1.59x1. Similarly, the
costs that can be attributed to fries and cheesecake are 2.19x2 and 2.99x3, respectively, so that the objective function is the sum of these three terms.
Let us now formulate the constraints. In doing so, we consider one requirement
at a time. First, we focus on the lower bound of the constraints. What we would like
to express is that the caloric content of the diet should be at least 1,800. The calories
in the diet derive from the three foods. The number of calories in the diet that are
from hamburgers are 250x1, the number of calories from fries are 380x2, and the
calories from cheesecake are 257x3. Adding up these three expressions results in the
total number of calories that we actually have in the diet. This number should not
fall short of 1,800 (the first constraint), and it should also not exceed 2,200 (the
second constraint). Note that both of these constraints have the same left-hand side.
The constraint that regulates the fat content of the diet is constructed similarly.
Overall, the constraint should state that the content of fat in the diet should not
exceed 100 % of the recommended daily value. Where does the fat in the diet come
from? In this example, it derives from hamburgers (for a total of 13x1), fries (for a
total of 31x2), and cheesecake (for a total of 28x3). This total fat content should then
not exceed 100 %.
In summary, the problem can then be formulated as follows.

In addition to the lower and upper bounds on the caloric intake and the upper
bound on the fat content of the diet, we include the nonnegativity constraints on the

22

2 Linear Programming

Table 2.3 Nutritional contents of food and their prices


Pasta
Calories
300
Fat
1g
Cholesterol
0 mg
Sodium
1 mg
Carbohydrates 63 g
Fiber
3g
Protein
11 g
Vitamin A
0%
Vitamin C
0%
Calcium
2%
Iron
20%
Price per
19
serving
per 3
oz

Tomato
juice
60
0g
0 mg
650 mg
12 g
3g
2g
8%
30%
2%
15%
56 per
10 fl.oz.

Clam
chowder
220
13 g
5m g
790 g
19 g
2g
5g
2%
2%
2%
8%
90 per
8.8 fl.oz.

Medium
beef chuck
259
16.3 g
89 mg
95 mg
20 g
0g
26.1 g
1%
0%
1%
17%
82 per
3 oz

Milk
110
2.5 g
10 mg
120 mg
12 g
0g
9g
10%
0%
30%
0%
51 per
cup

Orange
juice
132
0g
0 mg
5 mg
33.4 g
0g
0.5 g
2%
62%
0%
2%
53 per
8.8 fl.oz.

Apple
55
0.22 g
0 mg
1.1 mg
14.6 g
2.5 g
0.3 g
1%
8%
1%
1%
37
each

Potato
chips
152
9.8 g
0 mg
168.4 mg
15 g
1.3 g
2g
0%
15%
1%
3%
32
per loz

quantities of foods included in the diet, as the idea is to eat rather than regurgitate.
Incidentally, the solution to this formulation specifies that the planner eat 6
hamburgers, serving of fries, and no cheesecake. Doing so will provide 100 %
of the allowable fat intake, generate 1,800 cal, and cost $11.32.
While this solution may be optimal with respect to the problem as specified
above, it is clearly riddled with a number of problems. The number of hamburgers
in the diet is obviously much too high for all but the most determined junk food
junkies. It will require additional constraints which are added in the loop that
attempts to reconcile the solution of the model with the real problem of finding a
cost-effective diet. In order to illustrate the modeling process, we use a somewhat
larger problem with real data. The data of the eight foods included and the eleven
nutrients is found in Table 2.3.
As far as the daily nutritional requirements are concerned, we have identified the
following parameters. The diet should include
Between 1,800 and 2,200 cal,
No more than 65 g of fat,
No more than 300 mg of cholesterol,
No more than 2,400 mg of sodium,
At least 300 g of carbohydrates,
At least 25 g of fiber,
At least 50 g or protein, and
At least 100 % of the recommended daily allowance of vitamins A and C,
calcium, and iron.
We first define variables x1, . . ., x8 for the number of servings of the eight foods
outlined in Table 2.3. Following the ideas developed above for the small problem,
we can now formulate the diet problem. The formulation is as follows.

2.2

Applications of Linear Programming

23

In the subsequent discussion, we will refer to the solutions and their respective
nutritional contents shown in Tables 2.4 and 2.5 (where entries in are shown in
boldface, if the nutritional content of a diet has reached its bound). Solving the
above model results in the original Solution 0. The most prominent features of
this solution is that other than a modest amount of pasta, the diet includes only
liquids, most prominently in excess of 9 servings of milk. The decision maker may
want to limit the milk intake to more reasonable levels, so that an upper bound of
four servings of milk is added, i.e., the constraint x5  4. It turns out that this
constraint is so strong that the model has no more feasible solution. In order to
restore feasibility, the decision maker has now decided to add additional foods,
most prominently yoghurt, bread, and margarine (whose quantities are denoted by
the new variables x9, x10, and x11, respectively). The prices and nutritional contents
of the foods are shown in Table 2.6. Solving the problem with the new foods results
in solution 1, shown again in Tables 2.4 and 2.5.
We first notice that the price of the diet has decreased dramatically, a result of
new inexpensive foods that have been introduced into the problem. (As usual, while

24

2 Linear Programming

Table 2.4 Solutions in the modeling process


Original
solution
Foodstuff No. 0 4 milk
Pasta
2.58
No
Tomato
1.95
Feasible
juice
Clam
0
solution
chowder
Beef
0.09
Introduce
chuck
Milk
9.3
Yoghurt,
Orange
0.08
Bread,
juice
Apple
4.6
Margarine
Potato
0
chips
Yoghurt
Bread
Margarine
Eggs
Cost
$8.14

6
Solution bread
1
Sln 2
0.1
1.46
0
0.91

4
margarine
Sln 3
0
0

Add
eggs
Sln 4
0
0

Calories
2,000
Solution
4a
0
0

Cholesterol
250
Solution 4b
0
0

0.38

0.2

0.32

0.36

3.87
1.33

3.45
0.87

4
5.47

4.0
3.47

4
2.76

4
3.2

2.23
0

2.35
0

8.68
0

6.0
0

7.61
0

8.2
0

0
9.57
5.65

0
6
6.05

0
1.65
4

$4.62

$4.70 $8.81

0
5
4
1.14
$7.12

0
2.99
4
1.09
$7.26

0
2.2
4
0.84
$7.63

Table 2.5 Nutritional achievements of the solutions


Original
solution
0
Calories [1,800; 1,800
2,200]
Fat  65
28
Cholesterol  300 101
Sodium  2,400 2,400
Carbs  300
369
Fiber  25
25
Protein  50
120
Vitamin
100
A  100 %
Vitamin
100
C  100 %
Calcium  100 %
293
Iron  100 %
100

Solution Solution Solution Solution Solution Solution


1
2
3
4
4a
4b
2,200
2,200
2,200
2,200
2,000
2,000
65
39
2,400
340
25
75
100

65
35
2,400
340
25
74
100

52
74
1,097
401
25
58
100

57
300
1,674
366
25
72
100

58
300
1,358
324
25
67
100

56
250
1,231
332
25
64
100

100

100

409

263

232

264

118
103

111
107

129
100

130
100

131
100

131
100

added constraints limit the choices and increase the cost of the solution, added
variables represent added opportunities that may reduce the price). The solution
now includes significant amounts of the new foods bread and margarine.

2.2

Applications of Linear Programming

25

Table 2.6 Additional foods


Calories
Fat
Cholesterol
Sodium
Carbs
Fiber
Protein
Vitamin A
Vitamin C
Calcium
Iron
Price per serving

Yoghurt
160
2.5 g
10 mg
75 mg
20 g
0g
6g
2%
2%
20 %
2%
56 per cup

Bread
110
1g
0 mg
160 mg
22 g
2g
4g
0%
0%
0%
10 %
8.6 per slice

Becel
70
8g
0 mg
70 mg
0
0
0g
10 %
0%
0%
0%
5 per 2 teaspoons

Eggs
78
5.3 g
212 mg
62 mg
0.6 g
0g
6.3 g
6%
0%
3%
3%
20 each

The nutritional content of the new solution also differs quite dramatically from that
of the previous solution: the caloric content is now at the upper rather than the lower
bound, the fat content is also at the upper bound, while sodium is still at the upper
bound, and the nutrients fiber, vitamin A and vitamin C are at the lower bounds.
The decision maker may feel that the present solution includes too much bread,
so that a constraint is added that limits the bread content of the diet to no more than
six slices, i.e., x10  6. The result is Solution 2. This solution is marginally more
expensive than its predecessor, it features significant more pasta, and in general
appears more palatable. However, the margarine content is quite high, so that in the
next step, the decision maker adds a requirement that limits the margarine content
to no more than four servings, i.e., x11  4. The result is Solution 3. This
requirement causes the price of the diet to almost double (which poses the question
whether or not the requirement is really that crucial). Furthermore, the diet now
consists mostly of milk, orange juice, and apples. It is hardly surprising that the
vitamin C content of the diet has quadrupled as compared to the previous solution.
Also, fat is no longer a binding constraint and the sodium content is cut in half.
However, the diet is still barely satisfying the fiber content, and its vitamin A
content is also at the lower bound.
In order to address some of the nutritional issues, the decision maker has decided
to add eggs as an additional food. Their price and nutritional content are shown in
Table 2.6. Solving the expanded model results in Solution 4. Now the diet
includes again more bread and margarine, and more moderate amounts of milk,
orange juice, and apples. Also, the price has dropped again to $7.12.
In principle, the decision maker is happy with the diet, as it has been determined
at this point. However, it may be desirable to find out the effects that result from the
changes of some of the requirements. For instance, what happens if the caloric
intake is restricted to no more than 2,000 rather than 2,200? Solving the revised
model results in Solution 4a. We notice a very modest price increase, of a diet that

26

2 Linear Programming

now includes less orange juice, more apples, and significantly less bread. We are
now at the upper allowable limit for cholesterol, while fiber, vitamin A and iron are
stubbornly clinging to their respective lower bounds. (A good idea at this point
would be to introduce additional foods that are rich in these nutrients).
Instead, the decision maker may wish to reduce the cholesterol in the diet from
its present upper bound of 300 to 250. Resolving the problem results again in a
fairly modest price increase and a solution that is similar to the previous diet, except
that the quantity of apples has now reached again unreasonable levels. We terminate our discussion at this point, which is not to suggest that the present diet is
reasonable: the purpose of this section was to introduce the reader to the modeling
process that repeatedly revises the model based on the present solution.

2.2.3

Allocation Problems

Allocation problems are one of the most prominent areas of application in linear
programming. All models in this class have in common that they deal with the
allocation of scarce resources to (economic) activities. At times, more than one
scarce resource exists, in which case the modeler can choose any one of them as the
basis for the mathematical formulation. This will be further elaborated upon below.
Due to the many different types of allocation problems, we will present two such
scenarios below.
First consider an investment allocation problem. Problems of this nature were
first formulated by Markowitz in the early 1950s as nonlinear optimization
problems. Here, we will discuss a linear version of the problem. In this problem,
the decision maker has to decide how much of the scarce resource (money) to
allocate to different types of investments. As we will see below, this observation
already indicates how to define the variables.
In our numerical example, the investor has $300,000 that can be invested. In
addition to the money at hand, it is possible to borrow up to $100,000 at 12 %
interest. This money can be used for leveraging (borrow to invest). The investor has
narrowed down the choices to six alternatives, shown in Table 2.7. The table also
shows the expected annual interest or dividend for the investment alternatives, the
expected annual increase of the value of the investment, and an indication of the
risk of the investment (per dollar).
We will consider two versions of the problem: the first version attempts to
maximize the expected value of the assets at the end of the planning period
(1 year), while the second version minimizes the total risk of the investment.
First consider version 1. The value of the assets after 1 year equals todays value
of the investment plus the expected interest or dividend plus the expected change in
value within a year minus the amount of money that was borrowed (principal and

You might also like