Chapter 1 - One Variable Optimization
Chapter 1 - One Variable Optimization
Chapter 1 - One Variable Optimization
ONE VARIABLE
OPTIMIZATION
Fourth edition
2013, Elsevier Inc. All rights reserved. 3
4 CHAPTER 1. ONE VARIABLE OPTIMIZATION
Example 1.1. A pig weighing 200 pounds gains 5 pounds per day and costs
45 cents a day to keep. The market price for pigs is 65 cents per pound, but is
falling 1 cent per day. When should the pig be sold?
The mathematical modeling approach to problem solving consists of ve
steps:
The rst step is to ask a question. The question must be phrased in mathemat-
ical terms, and it often requires a good deal of work to do this. In the process
we are required to make a number of assumptions or suppositions about the
way things really are. We should not be afraid to make a guess at this stage.
We can always come back and make a better guess later on. Before we can ask
a question in mathematical terms we need to dene our terms. Go through the
problem and make a list of variables. Include appropriate units. Next make a
list of assumptions about these variables. Include any relations between vari-
ables (equations and inequalities) that are known or assumed. Having done all
of this, we are ready to ask a question. Write down in explicit mathematical
language the objective of this problem. Notice that the preliminary steps of
listing variables, units, equations and inequalities, and other assumptions are
really a part of the question. They frame the question.
In Example 1.1 the weight w of the pig (in lbs), the number of days t until
we sell the pig, the cost C of keeping the pig t days (in dollars), the market
price p for pigs ($/lb), the revenue R obtained when we sell the pig ($), and our
resulting net prot P ($) are all variables. There are other numerical quantities
involved in the problem, such as the initial weight of the pig (200 lbs). However,
these are not variables. It is important at this stage to separate variables from
those quantities that will remain constant.
Next we need to list our assumptions about the variables identied in the
rst stage of step 1. In the process we will take into account the eect of the
constants in the problem. The weight of the pig starts at 200 lbs and goes up
by 5 lbs/day so we have
( )
5 lbs
(w lbs) = (200 lbs) + (t days).
day
1.1. THE FIVE-STEP METHOD 5
Assumptions: w = 200 + 5t
p = 0.65 0.01t
C = 0.45t
R=pw
P =RC
t0
Objective: Maximize P
Notice that we have included units as a check that our equation makes sense.
The other assumptions inherent in our problem are as follows:
( ) ( ) ( )
p dollars 0.65 dollars 0.01 dollars
= (t days)
lb lb lb day
( )
0.45 dollars
(C dollars) = (t days)
day
( )
p dollars
(R dollars) = (w lbs)
lb
(P dollars) = (R dollars) (C dollars)
form for which an eective general solution procedure exists. Most research in
applied mathematics consists of identifying these general categories of problems
and inventing ecient ways to solve them. There is a considerable body of
literature in this area, and many new advances continue to be made. Few, if
any, students in this course will have the experience and familiarity with the
literature to make a good selection for the modeling approach. In this book,
with rare exceptions, problems will specify the modeling approach to be used.
Our example problem will be modeled as a onevariable optimization problem,
or maximumminimum problem.
We outline the modeling approach we have selected. For complete details
we refer the reader to any introductory calculus textbook.
P =RC
= p w 0.45t
= (0.65 0.01t)(200 + 5t) 0.45t.
y = f (x)
(1.1)
= (0.65 0.01x)(200 + 5x) 0.45x
(8 x)
f (x) = ,
10
so that f (x) = 0 at the point x = 8. Since f is increasing on the interval
(, 8) and decreasing on (8, ), the point x = 8 is the global maximum. At
1.1. THE FIVE-STEP METHOD 7
134
132
f(x)
130
128
126
0 5 10 15 20
x
Figure 1.2: Graph of net prot f (x) = (0.65 0.01x)(200 + 5x) 0.45x versus
time to sell x for the pig problem.
this point we have y = f (8) = 133.20. Since the point (x, y) = (8, 133.20) is
the global maximum of f over the entire real line, it is also the maximum over
the set x 0.
Step 5 is to answer the question posed originally in step 1; i.e., when to sell
the pig in order to maximize prot. The answer obtained by our mathematical
model is to sell the pig after eight days, thus obtaining a net prot of $133.20.
This answer is valid as long as the assumptions made in step 1 remain valid.
Related questions and alternative assumptions can be addressed by changing
what we did in step 1. Since we are dealing with a real problem (A farmer owns
pigs. When should they be sold?), there is an element of risk involved in step 1.
For that reason it is usually necessary to investigate several alternatives. This
process, called sensitivity analysis, will be discussed in the next section.
The main purpose of this section was to introduce the ve-step method for
mathematical modeling. Figure 1.3 summarizes the method in a form convenient
for later reference. In this book we will apply the ve-step method to solve a
wide variety of problems in mathematical modeling. Our discussion of step 2
will generally include a description of the modeling approach selected, along
with an example or two. The reader who is already familiar with the modeling
approach may choose to skip this part, or just skim to pick up the notation.
Some of the other points summarized in Fig. 1.3, such as the use of appropriate
technology, will be expanded upon later in this book.
The exercises at the end of each chapter also require the application of the
8 CHAPTER 1. ONE VARIABLE OPTIMIZATION
State any assumptions you are making about these variables, including
equations and inequalities.
Restate the question posed in step 1 in the terms of the modeling approach
specied in step 2.
You may need to relabel some of the variables specied in step 1 in order
to agree with the notation used in step 2.
Note any additional assumptions made in order to t the problem de-
scribed in step 1 into the mathematical structure specied in step 2.
ve-step method. Getting in the habit of using the ve-step method now will
make it easier to succeed on the more dicult modeling problems to come. Be
sure to pay particular attention to step 5. In the real world, it is not enough
to be right. You also need the ability to communicate your ndings to others,
some of whom may not be as mathematically knowledgeable as you.
r x
($/day) (days)
0.008 15.0
0.009 11.1
0.010 8.0
0.011 5.5
0.012 3.3
Table 1.1: Sensitivity of best time to sell x to rate r at which price is falling for
the pig problem.
16
14
12
x (days)
10
8
6
4
2
0.008 0.009 0.01 0.011 0.012
r ($ / day)
Figure 1.4: Graph of best time to sell x versus rate r at which price is falling
for the pig problem.
1.2. SENSITIVITY ANALYSIS 11
130
125
120
115
f(x)
110
105
100
95
0 5 10 15 20
x
Figure 1.5: Graph of net prot f (x) = (0.65 0.015x)(200 + 5x) 0.45x versus
time to sell x for the pig problem in the case r = 0.015.
15
10
5
x (days)
-5
-10
3 4 5 6 7
g (lbs / day)
Figure 1.6: Graph of best time to sell x versus growth rate g for the pig problem.
The optimal time to sell is given by Eq. (1.4) so long as it represents a nonneg-
ative value of x. Figure 1.6 shows the relationship between the growth rate g
and the optimal time to sell.
It is most natural and most useful to interpret sensitivity data in terms of
relative change or percent change, rather than in absolute terms. For example, a
10% decrease in r leads to a 39% increase in x, while a 10% decrease in g leads
to a 34% decrease in x. If x changes by an amount x, the relative change
in x is given by x/x, and the percent change in x is 100 x/x. If r changes
by r, resulting in the change x in x, then the ratio between the relative
changes is x/x divided by r/r. Letting r 0 and using the denition of
the derivative, we obtain
x/x dx r
.
r/r dr x
dx 7
=
dr 25r2
= 2, 800
1.2. SENSITIVITY ANALYSIS 13
we have
dx g
S(x, g) =
dg x
( )
5
= (4.9)
8
= 3.0625,
so that a 1% increase in the growth rate of the pig would cause us to wait about
3% longer to sell the pig.
In order to compute the sensitivity S(y, g), rst substitute (1.4) into the
objective function y = f (x) from (1.3) to obtain
( [ ]) ( [ ])
5(13g 49) 5(13g 49)
y = 0.65 0.01 200 + g
2g 2g
[ ]
5(13g 49)
0.45
2g
150.0625
= + 50.375 + 10.5625g.
g
Then compute the derivative
dy 150.0625
= + 10.5625,
dg g2
dy g
S(y, g) =
dg y
( )
5
= (4.56)
133.20
= 0.17.
14 CHAPTER 1. ONE VARIABLE OPTIMIZATION
If the pig grows 10% faster than expected, the expected net prot will be 1.7%
larger. The computation of the derivative dy/dg in this case involves quite a bit
of algebra. In Chapter 2, we will discuss how a computer algebra system can be
used to perform the necessary algebraic computations.
The successful application of sensitivity analysis procedures requires good
judgment. It is usually not possible to compute sensitivity coecients for each
parameter in the model, nor is this particularly desirable. We need to select
those parameters about which there is the most uncertainty and perform sen-
sitivity analysis on them. The interpretation of sensitivity coecients also de-
pends on the degree of uncertainty, the fundamental question being the extent
to which our uncertainty about the data aects our condence in the answer.
In the pig problem, we are probably considerably more certain of the growth
rate g than of the rate r at which prices fall. A 25% error in g would be quite
surprising if we have observed the past history of growth in this pig or in similar
animals. A 25% error in our estimate of r would not be at all surprising.
How can a model give the right answer if the assumptions are wrong? While
mathematical modeling strives for perfection, perfection can never be achieved.
It would be more descriptive to say that mathematical modeling strives toward
perfection. A wellconstructed mathematical model will be robust, which is to
say that while the answers it gives may not be perfectly correct, they will be
close enough to be useful in a realworld context.
Let us examine the linearity assumptions made in the pig problem. Our
basic equation is
P = pw 0.45t,
where p is the selling price of the pig in dollars per pound, and w is the weight
of the pig in pounds. If the original data and assumptions of the model are
not too far o, then the best time to sell the pig is obtained by setting P = 0.
Calculate to nd
p w + pw = 0.45
dollars per day. The term p w + pw represents the rate of increase in the value
of the pig. Our model tells us to keep the pig as long as the value of the pig is
increasing faster than the cost of feeding it. Furthermore, the change in the pigs
value has two components, p w and pw . The rst term, p w, represents the loss
in value due to a drop in price. The second term, pw , represents the gain in
value due to the pig gaining weight. Consider the practical problems involved in
the application of this more general model. The data required include a complete
specication of both the future growth of the pig and the future changes in price
as dierentiable functions of time. There is no way to know these functions
exactly. There is even some question as to whether they make sense. Can the
pig be sold at 3 A.M. Sunday morning? Can price be an irrational number? Let
us construct a realistic scenario. The farmer has a pig weighing approximately
200 lbs. The pig has been gaining about ve lbs/day during the last week. Five
days ago the pig could have been sold for 70 cents/lb but by now the price has
dropped to 65 cents/lb. What should we do? The obvious approach is to project
on the basis of this data (w = 200, w = 5, p = 0.65, p = 0.01) and decide
when to sell. This is exactly what we did. We understand that p and w will
not remain constant over the next few weeks, and that therefore p and w will
not be linear functions of time. However, as long as p and w do not change
too much over this period, the error involved in assuming they remain constant
will not be too great.
We are now prepared to give a somewhat broader interpretation to the results
of our sensitivity analysis from the preceding section. Recall that the sensitivity
of the best time to sell (x) to changes in the growth rate w was calculated to be
3. Suppose that in fact the growth rate over the next few weeks is somewhere
between 4.5 and 5.5 lbs/day. This is within 10% of the assumed value. Then
the best time to sell the pig will be within 30% of 8 days, or between 5 and 11
days. The amount of lost prot by selling at 8 days is less than 1 dollar.
With regard to price, suppose that we feel the value p = .01, or a 1
cent/day drop in price over the next few weeks, is a worstcase scenario. Prices
are likely to drop more slowly in the future and may even level o (p = 0).
16 CHAPTER 1. ONE VARIABLE OPTIMIZATION
All we can really say now is that we should wait at least 8 days to sell. For
small values of p (near zero), our model suggests waiting a very long time to
sell. However, our model is not valid over long time intervals. The best course
of action in this case is probably to keep the pig for a week, reestimate the
parameter values p, p , w , and w, and start over.
1.4 Exercises
1. An automobile manufacturer makes a prot of $1,500 on the sale of a
certain model. It is estimated that for every $100 of rebate, sales increase
by 15%.
(a) What amount of rebate will maximize prot? Use the ve-step
method, and model as a onevariable optimization problem.
(b) Compute the sensitivity of your answer to the 15% assumption. Con-
sider both the amount of rebate and the resulting prot.
(c) Suppose that rebates actually generate only a 10% increase in sales
per $100. What is the eect? What if the response is somewhere
between 10 and 15% per $100 of rebate?
(d) Under what circumstances would a rebate oer cause a reduction in
prot?
2. In the pig problem, perform a sensitivity analysis based on the cost per
day of keeping the pig. Consider both the eect on the best time to sell
and on the resulting prot. If a new feed costing 60 cents/day would let
the pig grow at a rate of 7 lbs/day, would it be worth switching feed?
What is the minimum improvement in growth rate that would make this
new feed worthwhile?
3. Reconsider the pig problem of Example 1.1, but now assume that the price
for pigs is starting to level o. Let
(a) Graph Eq. (1.5) along with our original price equation. Explain why
our original price equation could be considered as an approximation
to Eq. (1.5) for values of t near zero.
(b) Find the best time to sell the pig. Use the ve-step method, and
model as a onevariable optimization problem.
(c) The parameter 0.00004 represents the rate at which price is leveling
o. Conduct a sensitivity analysis on this parameter. Consider both
the optimal time to sell and the resulting prot.
1.4. EXERCISES 17
(d) Compare the results of part (b) to the optimal solution contained
in the text. Comment on the robustness of our assumptions about
price.
4. An oil spill has fouled 200 miles of Pacic shoreline. The oil company
responsible has been given 14 days to clean up the shoreline, after which
a ne will be levied in the amount of $10,000/day. The local cleanup crew
can scrub ve miles of beach per week at a cost of $500/day. Additional
crews can be brought in at a cost of $18,000 plus $800/day for each crew.
5. It is estimated that the growth rate of the n whale population (per year)
is rx(1 x/K), where r = 0.08 is the intrinsic growth rate, K = 400, 000
is the maximum sustainable population, and x is the current population,
now around 70,000. It is further estimated that the number of whales
harvested per year is about 0.00001 Ex, where E is the level of shing
eort in boatdays. Given a xed level of eort, population will eventually
stabilize at the level where growth rate equals harvest rate.
(a) What level of eort will maximize the sustained harvest rate? Model
as a onevariable optimization problem using the ve-step method.
(b) Examine the sensitivity to the intrinsic growth rate. Consider both
the optimum level of eort and the resulting population level.
(c) Examine the sensitivity to the maximum sustainable population.
Consider both the optimum level of eort and the resulting popu-
lation level.
6. In Exercise 5, suppose that the cost of whaling is $500 per boatday, and
the price of a n whale carcass is $6,000.
(a) Find the level of eort that will maximize prot over the long term.
Model as a onevariable optimization problem using the ve-step
method.
18 CHAPTER 1. ONE VARIABLE OPTIMIZATION
(b) Examine the sensitivity to the cost of whaling. Consider both the
eventual prot in $/year and the level of eort.
(c) Examine the sensitivity to the price of a n whale carcass. Consider
both prot and level of eort.
(d) Over the past 30 years there have been several unsuccessful attempts
to ban whaling worldwide. Examine the economic incentives for
whalers to continue harvesting. In particular, determine the con-
ditions (values of the two parameters: cost per boatday and price
per n whale carcass) under which harvesting the n whale produces
a sustained prot over the long term.
7. Reconsider the pig problem of Example 1.1, but now suppose that our
objective is to maximize our prot rate ($/day). Assume that we have
already owned the pig for 90 days and have invested $100 in this pig to
date.
(a) Find the best time to sell the pig. Use the ve-step method, and
model as a onevariable optimization problem.
(b) Examine the sensitivity to the growth rate of the pig. Consider both
the best time to sell and the resulting prot rate.
(c) Examine the sensitivity to the rate at which the price for pigs is
dropping. Consider both the best time to sell and the resulting prot
rate.
8. Reconsider the pig problem of Example 1.1, but now take into account
the fact that the growth rate of the pig decreases as the pig gets older.
Assume that the pig will be fully grown in another ve months.
(a) Find the best time to sell the pig in order to maximize prot. Use the
ve-step method, and model as a onevariable optimization problem.
(b) Examine the sensitivity to the time it will take until the pig is fully
grown. Consider both the best time to sell and the resulting prot.
9. A local daily newspaper with a circulation of 80,000 subscribers is thinking
of raising its subscription price. Currently the price is $1.50 per week, and
it is estimated that the paper would lose 5,000 subscribers if the rate were
to be raised by ten cents/week.
(a) Find the subscription price that maximizes prot. Use the ve-step
method, and model as a onevariable optimization problem.
(b) Examine the sensitivity of your answer in part (a) to the assumption
of 5,000 lost subscribers. Calculate the optimal subscription rate
assuming that this parameter is 3,000, 4,000, 5,000, 6,000, or 7,000.
(c) Let n = 5, 000 denote the number of subscribers lost when the sub-
scription price increases by ten cents. Calculate the optimal subscrip-
tion price p as a function of n, and use this formula to determine the
sensitivity S(p, n).
1.4. EXERCISES 19
(d) Should the paper change its subscription price? Justify your conclu-
sions in plain English.
Further Reading
1. Cameron, D., Giordano, F. and Weir, M. Modeling Using the Derivative:
Numerical and Analytic Solutions. UMAP module 625.