

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
introduction of probability distribution and operation research
Typology: Lecture notes
1 / 33
This page cannot be seen from the preview
Don't miss anything!


























Real-Life Application—Optimization of Crosscutting and Log Allocation
aV|WG[GrJaGWsGr
Mature trees are harvested and crosscut into logs to manufacture different end products
(construction lumber, plywood, wafer boards, or paper). Log specifications (e.g., length
and end diameters) differ depending on the mill where the logs are processed. With
harvested trees measuring up to 100 ft in length, the number of crosscut combinations
meeting mill requirements can be large, and the manner in which a tree is disassembled
into logs can affect revenues. The objective is to determine the crosscut combinations
that maximize the total revenue. The study uses dynamic programming to optimize the
process. The proposed system was first implemented in 1978 with an annual increase in
profit of at least $7 million. Details of the case are presented at the end of the chapter.
12.1 RECURSIVE NATURE OF DYNAMIC PROGRAMMING (DP)
COMPUTATIONS
The main idea of DP is to decompose the problem into (more manageable) subprob-
lems. Computations are then carried out recursively where the optimum solution of
one subproblem is used as an input to the next subproblem. The optimum solution
for the entire problem is at hand when the last subproblem is solved. The manner in
which the recursive computations are carried out depends on how the original prob-
lem is decomposed. In particular, the subproblems are normally linked by common
constraints. The feasibility of these common constraints is maintained at all iterations.
Example 12.1-1 (SJQrVGsV-RQWVGPrQblGm)
Start 3 7
Route network for Example 12.1-
f
1
f
1
f
0
f
2
f
2
f
3
Decomposition of the shortest-route problem into stages
Recursive Equation. This section shows how the recursive computations in
Example 12.1-1 can be expressed mathematically. Let f
i
(x
i
) be the shortest distance to
node x
i
at stage i, and define d 1 x
i - 1
, x
i
2 as the distance from node x
i - 1
to node x
i
. The
DP recursive equation is defined as
f
0
1 x
0
= 12 = 0
f
i
1 x
i
2 = min
all feasible
1 x
i - 1
, x
i
2 routes
5 d 1 x
i - 1
, x
i
2 + f
i - 1
1 x
i - 1
2 6, i = 1, 2, 3
All distances are measured from 0 by setting f
0
1 x
0
= 12 = 0. The main recursive
equation expresses the shortest distance f
i
(x
i
) at stage i as a function of the next node, x
i
.
In DP terminology, x
i
is referred to as the state at stage i. The state links successive stages
in a manner that permits making optimal feasible decisions at a future stage indepen-
dently of the decisions already made in all preceding stages.
The definition of the state leads to the following unifying framework for DP.
Principle of Optimality. Future decisions for all future stages constitute an optimal
policy regardless of the policy adopted in all preceding stages.
The implementation of the principle of optimality is evident in the computations
in Example 12.1-1. In stage 3, the recursive computations at node 7 use the shortest
distance to nodes 5 and 6 (i.e., the states of stage 2) without concern about how nodes
5 and 6 are reached from the starting node 1.
The principle of optimality does not address the details of how a subproblem
is optimized. The reason is the generic nature of the subproblem. It can be linear or
nonlinear, and the number of alternative can be finite or infinite. All the principle
of optimality does is “break down” the original problem into more computationally
tractable subproblems.
AJa!MQmGPV:SQlvKPIMarrKaIGPrQblGm...wKVJD[PamKEPrQIrammKPI!
1
2
n
S ∞
1
e
1
Example 12.1-1 uses forward recursion in which the computations proceed from stage 1
to stage 3. The same example can be solved by backward recursion, starting at stage 3 and
ending at stage 1.
Naturally, both the forward and backward recursions yield the same optimum.
Although the forward procedure appears more logical, DP literature mostly uses back-
ward recursion. The reason for this preference is that, in general, backward recursion
can be more efficient computationally.
We will demonstrate the use of backward recursion by applying it to
Example 12.1-1. The demonstration will also provide the opportunity to present the
DP computations in a compact tabular form.
Example 12.2-
4
4
i
i
all feasible
routes 1 x
i - 1
, x
i
2
i - 1
i
i - 1
i - 1
3
2
1
1
Beckmann, M., “Dynamic Programming and the Secretary Problem,” Computers and Mathematics with
Applications, Vol. 19, No. 11, pp. 25–28, 1990.
2
Thomas S. Ferguson, “Who Solved the Secretary Problem?” Statistical Science, Vol. 4, No. 3, pp. 282–289,
Of the three elements, the definition of the state is usually the most subtle. The appli-
cations presented here show that the definition of the state varies depending on the
situation being modeled. Nevertheless, as you investigate each application, you will
find it helpful to consider the following questions:
without regard to how the decisions made at the preceding stages have been
reached?
You can enhance your understanding of the concept of the state by questioning
the validity of the way it is defined here. Try another definition that may appear “more
logical” to you, and use it in the recursive computations. You will soon discover that
the definitions presented here are correct. Meanwhile, the associated mental process
should give you a better understanding of the role of states in the development of DP
recursive equation.
12.3.1 kPapsaEM/Fl[-Awa[kKV/carIQ-LQadKPIMQdGl
The knapsack model classically deals with determining the most valuable items a com-
bat soldier carries in a backpack. The problem represents a general resource allocation
model in which limited resources are used by a number of economic activities. The
objective is to maximize the total return.
3
The (backward) recursive equation is developed for the general problem of al-
locating n items to a knapsack with weight capacity W. Let m
i
be the number of units
of item i in the knapsack, and define r
i
and w
i
as the unit revenue and weight of item i.
The general problem can be represented as
Maximize z = r
1
m
1
2
m
2
n
m
n
subject to
w
1
m
1
2
m
2
n
m
n
… W
m
1
, m
2
, c, m
n
nonnegative integers
The three elements of the model are
i
= 0, 1, c,
W
w
i
,
where
W
w
i
is the largest integer less than or equal to
W
w
i
. This definition allows the
solution to allocate none, some, or all of the resource W to any of the m items. The
return for m
i
is r
i
m
i
.
3
The knapsack problem is also known in the literature as the fly-away kit problem (determination of the
most valuable items a jet pilot takes on board) and the cargo-loading problem (determination of the most
valuable items to be loaded on a navy ship). It appears that the three names were coined to ensure equal
representation of three branches of the armed forces: army, air force, and navy!
i,
the total weight assigned to stages (items)
i, i + 1, c, and n. This definition recognizes that the weight limit is the only
constraint that binds all n stages.
4
Define
f
i
1 x
i
2 = maximum return for stages i, i + 1, and n, given state x
i
The most convenient way to construct the recursive equation is a two-step procedure:
Step 1. Express f
i
(x
i
) as a function of f
i
1 x
i + 1
2 as follows:
f
n + 1
1 x
n + 1
2 K 0
f
i
1 x
i
2 =
min
m
i
= 0, 1, c c
W
w i
d
5 r
i
m
i
i + 1
1 x
i + 1
26 , i = 1, 2, c, n
x
i
… W
Step 2. Express x
i + 1
as a function of x
i
to ensure consistency with the left-hand side of the
recursive equation. By definition, x
i
i + 1
= w
i
m
i
represents the weight used
at stage i. Thus, x
i + 1
= x
i
i
m
i
, and the proper recursive equation is given as
f
i
1 x
i
2 =
max
m
i
= 0, 1, c c
W
w
i
d
5 r
i
m
i
i + 1
1 x
i
i
m
i
2 6, i = 1, 2, c, n
x
i
… W
Example 12.3-
i
i
Item i w i
r
i
i
i
3
3
3
3
3
3
3
3
3
3
3
m
3
= 0, 1, c, 4
3
4
The definition of the state can be multidimensional. For example, the volume of the knapsack may pose
another restriction. In general, a multidimensional state implies more complex stage calculations. See
Section 12.4.
Excel Moment
i
Cell(s) Data
D3 Number of stages, N = 3
G3 Resource limit, W = 4
C4 Current stage = 3
E4 w
3
r 3
m
3
3
W
w
3
4
1
3
3
4,
3
Excel starting screen of the general DP knapsack model (file excelKnapsack.xls)
3
3
3
Stage 2:
Stage 3:
Stage 1:
Excel DP model for the knapsack problem of Example 12.3-1 (file excelKnapsack.xls)
1
2
5
1
1 x
5
2
1 x
5
4
Optimum solution
x
4
x
5
= 6 f
5
(x
4
) x
5
4
1
1 x
4
2
1 x
4
3
2 + f
5
1 x
4
Optimum solution
x
3
x
4
= 4 x
4
= 5 x
4
= 6 f
4
(x
3
) x
4
3
1
1 x
3
2
1 x
3
2
2 + f
4
1 x
3
2 Optimum solution
x
2
x
3
= 8 f
3
(x
2
) x
6
2
1
1 x
2
2
1 x
3
2
2 + f
3
1 x
2
2 Optimum solution
x
1
x
2
= 7 x
2
= 8 f
2
(x
1
) x
2
1
1
1 x
1
2
1 x
1
0
2 + f
2
1 x
1
Optimum solution
x 0
x
1
= 5 x
1
= 6 x
1
= 7 x
1
= 8 f
1
(x
0
) x
1
0
1
2
3
4
5
Week i
Minimum labor
force (b
i
Actual labor
force (x
i
) Decision Cost
1 5 5 Hire 5 workers 4 + 2 * 5 = 14
2 7 8 Hire 3 workers 4 + 2 * 3 + 1 * 3 = 13
3 8 8 No change 0
4 4 6 Fire 2 workers 3 * 2 = 6
5 6 6 No change 0
1
12.3.3 Equipment Replacement Model
Machines that stay longer in service incur higher maintenance cost and may be re-
placed after a number of years in operation. The situation deals with determining the
most economical age of a machine.
Suppose that the machine replacement problem spans n years. At the start of
each year, a machine is either kept in service an extra year or replaced with a new one.
Let r(t), c(t), and s(t) represent the yearly revenue, operating cost, and salvage value, re-
spectively, of a t-year-old machine. The cost of acquiring a new machine in any year is I.
The elements of the DP model are as follows:
start of year i.
Given that the machine is t years old at the start of year i, define
f
i
1 t 2 = maximum net income for years i, i + 1, c, and n
The recursive equation is
f
n
1 t 2 = max e
r 1 t 2 - c 1 t 2 + s 1 t + 12 , if KEEP
r 102 + s 1 t 2 + s 112 - I - c 102 , if REPLACE
f
i
1 t 2 = max e
r 1 t 2 - c 1 t 2 + f
i + 1
1 t + 12 , if KEEP
r 102 + s 1 t 2 - I - c 102 + f
i + 1
112 , if REPLACE
f , i = 1, 2, c, n - 1
Example 12.3-
K R Optimum solution
t r 1 t 2 + s 1 t + 12 - c 1 t 2 r 102 + s 1 t 2 + s 112 - c 102 - I f
4
(t) Decision
(Must replace)
K R Optimum solution
t r 1 t 2 - c 1 t 2 + f
4
1 t + 12 r 102 + s 1 t 2 - c 102 - I + f
4
112 f 3
(t) Decision
K R Optimum solution
t r 1 t 2 - c 1 t 2 + f
3
1 t + 12 R 102 + s 1 t 2 - c 102 - I + f
3
112 f 2
(t) Decision
1 19.0 - .6 + 67.1 = 85.5 20 + 80 - .2 - 100 + 85.7 = 85.5 85.5 K or R
K R Optimum solution
t r 1 t 2 - c 1 t 2 + f
2
1 t + 12 R 102 + s 1 t 2 - c 102 - I + f
2
112 f
1
(t) Decision
12.3.4 Investment Model
Suppose that you want to invest the amounts P
1
, P
2
,... , P
n
at the start of each of the
next n years. You have two investment opportunities in two banks: First Bank pays an
interest rate r
1
, and Second Bank pays r
2
, both compounded annually. To encourage
deposits, both banks pay bonuses on new investments in the form of a percentage of
the amount invested. The respective bonus percentages for First Bank and Second
Bank are q
i 1
and q
i 2
for year i. Bonuses are paid at the end of the year in which the
investment is made and may be reinvested in either bank in the immediately suc-
ceeding year. This means that only bonuses and fresh new money may be invested in
either bank. However, once an investment is deposited, it must remain in the bank
until the end of year n.
The elements of the DP model are as follows:
i
and I
i
, the amounts invested in First Bank and
Second Bank, respectively.
i
, at stage i is the amount of capital available for investment at the start
of year i.
We note that I
i
= x
i
i
by definition. Thus
x
1
= P
1
x
i
= P
i
i - 1, 1
I
i - 1
i - 1, 2
1 x
i - 1
i - 1
2
= P
i
i - 1, 1
i - 1, 2
2 I
i - 1
i - 1, 2
x
i - 1
, i = 2, 3, c, n
The reinvestment amount x
i
includes only new money plus any bonus from invest-
ments made in year i - 1.
Define
f
i
1 x
i
2 = optimal value of the investments for years i, i + 1, c, and n, given x
i
K (t 5 2) K (t 5 3)
(t 5 3)
(t 5 1) R
R (t 5 1) K (t 5 2) K
Sell
Year 1 Year 2 Year 3 Year 4
Solution of Example 12.3-
Optimum solution
State f
4
(x
4
4
x
4
1.108x
4
3
3
0 … l
3
… x
3
3
4
4
3
2
2
3
2
3
3
3
4
3
3
3
3
0 … I 3
… x 3
3
3
3
3
0 … I
3
… x
3
3
3
Optimum solution
State f
3
(x
3
3
x
3
2216 + 1.1909x
3
2
2
0 … I
2
… x
2
2
3
3
2
3
3
2
3
2
2
2
3
2
2
2
2
0 … I
2
… x
2
2
2
2
2
0 … I 2
… x 2
2
2
Optimum solution
State f
2
(x
2
2
x
2
4597.8 + 1.27996x
2
x
2
1
1
0 … I 1
… x 1
1
2
2
1
4
4
1
4
1
2
1
2
1
1
1
1
0 … I
1
… x
1
1
1
1
1
0 … I 1
… x 1
1
1
Optimum solution
State f
1
(x
1
1
x
1
7157.7 + 1.38349x
1
1
2
2
3
4
1
2
3
4
Year Optimum solution Decision Accumulation
1
= x
1
Invest x 1
= $4000 in First Bank s 1
2
= x
2
Invest x
2
= $2072 in First Bank s
2
3
Invest x
3
= $2035.22 in Second Bank s
3
4
= 0
Invest x
4
= $2052.92 in Second Bank s
4
Total accumulation = f 1
1 x 1
2 = 7157.7 + 1.38349 140002 = $12,691.66 1 = s 1
s 2
s 3
s 4
12.3.5 iPvGPVQr[MQdGls
DP has important applications in the area of inventory control. Chapters 13 and 16
present some of these applications. The models in Chapter 13 are deterministic, and
those in Chapter 16 are probabilistic. Other probabilistic DP applications are given in
Chapter 24 on the website.
In all the DP models presented in this chapter, the state at any stage is represented by
a single element. For example, in the knapsack model (Section 12.3.1), the only restric-
tion is the weight of the item. More realistically in this case, the volume of the knapsack