0% found this document useful (0 votes)
4 views9 pages

1527250826E textofChapter8Module2

This document discusses dynamic programming, focusing on models and solutions for discrete problems such as product allocation and cargo load optimization. It provides examples illustrating the application of Bellman's principle of optimality and recursive equations for maximizing profits under constraints. The document also includes detailed computations and optimal policies for specific scenarios.

Uploaded by

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

1527250826E textofChapter8Module2

This document discusses dynamic programming, focusing on models and solutions for discrete problems such as product allocation and cargo load optimization. It provides examples illustrating the application of Bellman's principle of optimality and recursive equations for maximizing profits under constraints. The document also includes detailed computations and optimal policies for specific scenarios.

Uploaded by

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

OPERATIONS RESEARCH

Chapter 8
Dynamic Programming

Prof. Bibhas C. Giri

Department of Mathematics
Jadavpur University
Kolkata, India
Email: [email protected]
MODULE - 2: DP Model III, Solution of
Discrete DP Problem and Solution of LPP
by DP

2.1 Dynamic Programming Model III

Single multiplicative constraint and additively separable return


Consider the following problem:

Minimize z = f1 (y1 ) + f2 (y2 ) + · · · + fn (yn )


subject to y1 y2 · · · yn ≥ p, p ≥ 0
yj ≥ 0, for all j.

We define the state variables as follows:

sn = yn yn−1 · · · y2 y1 ≥ p
sn−1 = sn /yn = yn−1 yn−2 · · · y2 y1
··· ······ ··· ··· ··· ··· ···
s2 = s3 /y3 = y2 y1
s1 = s2 /y2 = y1

These state variables are stage transformation of the type sj−1 = Tj (sj , yj ).
Let F(sn ) be the minimum value of the objective function for any feasible sn . Thus,
proceeding as earlier, we obtain the recursion formula

Fj (sj ) = min [fj (yj ) + Fj−1 (sj−1 )], 2 ≤ j ≤ n.


yj

which will lead to the required situation.

2
Example 2.1: Use Bellman’s principle of optimality to minimize z = y1 + y2 + · · · + yn ,
subject to y1 y2 · · · yn = d, yj ≥ 0 for j = 1, 2, · · · , n

Solution: Let fn (d) denote the minimum attainable sum y1 + y2 + y3 + · · · + yn when the
quantity d is factorized into n factors.
For n = 1, d is factorized into one factor only. So f1 (d) = min {y1 } = d.
y1 =d
For n = 2, d is factorized into two factors y1 and y2 .
If y1 = x and y2 = d/x, then

f2 (d) = min{y1 + y2 } = min {x + d/x} = min {x + f1 (d/x)} [since f1 (d/x) = d/x]


0<x≤d 0<x≤d

For n = 3, d is factorized into three factors y1 , y2 and y3 .


If y1 = x and y2 y3 = d/x, then

f3 (d) = min{y1 + y2 + y3 } = min {x + f2 (d/x)}


0<x≤d

Proceeding likewise, the recurrence relation for n = i becomes

fi (d) = min {x + fi−1 (d/x)}


0<x≤d

Now, we proceed to solve this function equation as follows:


√ √ √
f1 (d) = d, f2 (d) = min {x + d/x} = d + d/ d = 2 d (using calculus)
0<x≤d

√ {
} √
f3 (d) = min {x + f2 (d/x)} = min x + 2 d/x = d + 2 (d/d 1/3 ) = 3d 1/3
1/3
0<x≤d 0<x≤d

By induction hypothesis, for n = m we get fm (d) = md 1/m .


This result can be proved for n = m + 1 as follows :
{ }
fm+1 (d) = min {x + fm (d/x)} = min x + m(d/x)1/m = (m + 1)d 1/(m+1)
0<x≤d 0<x≤d

Therefore, the result which is assumed to be true for n = m is found to be true for
n = m + 1. Hence the result is true for all values of n. Thus the required optimal policy
is
(d 1/n , d 1/n , · · · , d 1/n ) with fn (d) = nd 1/n .

2.2 Solution of Discrete DP Problem

Many problems such as production allocation, long-term planning, equipment re-


placement, multistage chemical process, etc. can be solved by Dynamic Programming,
using tabular computations. We illustrate the solution procedure by taking examples.
Example 2.2: (Product Allocation Problem) The owner of a chain of four grocery
stores has purchased six crates of fresh strawberries. The estimated probability dis-
tribution of potential sales of the strawberries before spoilage differ among the four
stores. The following table gives the estimated total expected profit at each store,
when it is allocated various numbers of crates :

Store
1 2 3 4
0 0 0 0 0
1 4 2 6 2
2 6 4 8 3
Number of boxes 3 7 6 8 4
4 7 8 8 4
5 7 9 8 4
6 7 10 8 4

For administrative reasons, the owner does not wish to split crates between stores.
However, he is willing to distribute zero crates to any of his stores. Find the allocation
of six crates to your stores so as to maximize the expected profit.

Solution: Let the four stores be considered as four stages in a dynamic programming
formulation. The decision variables xj (j = 1, 2, 3, 4) denote the number of crates allo-
cated at the jth stage.
Now, let Pj (xj ) be the expected profit from allocation of xj crates to store j. Then, the
problem can be formulated as an L.P.P as follows :

Maximize z = P1 (x1 ) + P2 (x2 ) + P3 (x3 ) + P4 (x4 )


subject to x1 + x2 + x3 + x4 = 6
x1 , x2 , x3 , x4 ≥ 0

When xj is allocated at stage j, let s be the number of crates still available at this
stage. Define fj (xj ) as the value of the optimal allocation for stores 1 to 4. If fj (s, xj )
be the profit associated with the optimum solution fj∗ (s) (j = 1, 2, 3, 4) then f4∗ (s) =
max0<x4 ≤s f4 (s, x4 ) = max0<x4 ≤s P4 (x4 ). We have the recurrence relation


fj (s, xj ) = Pj (xj ) + fj+1 (s − xj ) for j = 3, 2, 1
and fj∗ (s) = ∗
max {Pj (xj ) + fj+1 (s − xj )}
0<xj ≤s
The solution to this problem starts with f4∗ (s) and is completed when f1∗ (s) is obtained.
The computations for the first stage (i.e., for j = 4) are as follows :

s f4∗ (s) x4∗


0 0 0
1 2 1
2 3 2
3 4 3
4 4 3, 4
5 4 3, 4, 5
6 4 3, 4, 5, 6

The computations for the second stage (i.e. for j = 3) are as follows :

f3 (s, x3 ) = P3 (x3 ) + f4∗ (s − x3 ) Optimum solution


x3 0 1 2 3 4 5 6 f3∗ (s) x3∗
s
0 0+0 0 0
1 0+2 6+0 6 1
2 0+3 6+2 8+0 8 1, 2
3 0+4 6+3 8+2 8+0 10 2
4 0+4 6+4 8+3 8+2 8+0 11 2
5 0+4 6+4 8+4 8+3 8+2 8+0 12 2
6 0+4 6+4 8+4 8+4 8+3 8+2 8+0 12 2, 3

Computations for the third stage (i.e. for j = 2) are as follows:

f2 (s, x2 ) = P2 (x2 ) + f3∗ (s − x2 ) Optimum solution


x2 0 1 2 3 4 5 6 f2∗ (s) x2∗
s
0 0+0 0 0
1 0+6 2+0 6 0
2 0+8 2+6 4+0 8 0, 1
3 0+10 2+8 4+6 6+0 10 0, 1, 2
4 0+11 2+10 4+8 6+6 8+0 12 1, 2, 3
5 0+12 2+11 4+10 6+8 8+6 9+0 14 2, 3, 4
6 0+12 2+12 4+11 6+10 8+8 9+6 10+0 16 3, 4
Computations for the fourth stage (i.e. for j = 1) are as follows:

f1 (s, x1 ) = P1 (x1 ) + f2∗ (s − x1 ) Optimum solution


x1 0 1 2 3 4 5 6 f1∗ (s) x1∗
s
6 0+16 4+14 6+12 7+10 7+8 7+6 7+0 18 1, 2

From the above computations, it is observed that the maximum profit of Rs. 18 can be
obtained by choosing the following eight alternative solutions:

Store 1 Store 2 Store 3 Store 4


x1∗ x2∗ x3∗ x4∗
1 2 2 1
1 3 1 1
1 3 2 0
1 4 1 0
2 1 2 1
2 2 1 1
2 2 2 0
2 3 1 0

Example 2.3 (Cargo Load Problem): A vessel is to be loaded with stocks of 3 items.
Each unit of item i has a weight wi and value ri . The maximum cargo weight the vessel
can take is 5 and the details of the three items are as follows:

i wi ri
1 1 30
2 3 80
3 2 65

Develop the recursive equation for the above case and find the most valuable cargo
load without exceeding the maximum cargo weight by using dynamic programming.

Solution: The given problem is a three-stage problem. Let xj (j = 1, 2, 3) denote the


number of units to be loaded at stage j and s be the number of units still to load at this
stage. Let fj (xj ) denote the value of the optimal allocation for the three types of items.
If fj (s, xj ) be the value associated with the optimum solution fj∗ (s), j = 1, 2, 3, then
we have

f1∗ (s) = max f1 (s, x1 )


0<x1 ≤s
fj∗ (s) = ∗
max {pj (xj ) + fj−1 (s − xj )} j = 2, 3
0<xj ≤s

where pj (xj ) denotes the expected value obtained from allocation of xj units of weight
to the item j.
Now, for one-stage problem, we have f1∗ = maxx1 {30x1 }, where the largest value of x1
is [5/1] = 5. We then have the following tabular computations:

Value of 30x1 Optimum solution


x1 0 1 2 3 4 5 f1∗ (s) x1∗
s
0 0 0 0
1 0 30 30 1
2 0 30 60 60 2
3 0 30 60 90 90 3
4 0 30 60 90 120 120 4
5 0 30 60 90 120 150 150 5

For 2-stage problem, the largest value of x2 is [5/3] = 1 and f2∗ = maxx2 {80x2 +f1 (s−3x2 )}

Value of 80x2 + f1∗ (s − 3x2 ) Optimum solution


x2 0 1 f2∗ (s) x2∗
s
0 0 + 0 =0 0 0
1 0 +30 =30 30 0
2 0 +60 =60 60 0
3 0 +90 =90 80+0 =80 90 0
4 0 +120=120 80+30=110 120 0
5 0 +150=150 80+60=140 150 0

For 3-stage problem, the largest value of x3 is [5/2] = 2 and f3∗ (s) = maxx3 {65x3 + f2∗ (s −
2x3 )}
Value of 65x3 + f2∗ (s − 2x3 ) Optimum solution
x3 0 1 2 f3∗ (s) x3∗
s
0 0 + 0 =0 0 0
1 0 +30 =30 30 0
2 0 +60 =60 65+0 =65 65 1
3 0 +90 =90 65+30 =95 95 1
4 0 +120=120 65+60=125 130+0=130 130 2
5 0 +150=150 65+90=155 130+30=160 160 2

From the above table, we see that x3∗ = 2. Then we have s = 1. Therefore, from the
previous table, we get x2∗ = 0 and finally for s = 1 we get from the first table x1∗ = 1.
Thus the required solution is x3∗ = 2, x2∗ = 0, x1∗ = 1 with the maximum value of load =
160.

2.3 Solution of LPP by Dynamic Programming

Consider the general linear programming problem (LPP) :

Maximize z = c1 x1 + c2 x2 + ... + cn xn
subject to ai1 x1 + ai2 x2 + ... + ain xn ≤ bi , i = 1, 2, ..., m
xj ≥ 0, j = 1, 2, ..., n (2.1)

This problem can be formulated as a dynamic programming problem as given below:

Let the above general LPP be considered as a multi-stage problem with each ac-
tivity j (j = 1, 2, ..., n) as individual stage. Then, this is an n−stage problem and the
decision variables are the levels of activities xj (≥ 0) at stage j.
Here the constraints represent the limitations of different resources. Therefore, the
state must be represented by an m−component vector s = (b1 , b2 , ..., bm ).

Let fn (b1 , b2 , ..., bm ) be the maximum value of the general LPP defined above for
stages x1 , x2 , ..., xm for states b1 , b2 , ..., bm .
Using forward computational procedure, the recursive equation is given by

fj (b1 , b2 , ..., bm ) = max {cj xj + fj−1 (b1 − a1j xj , b2 − a2j xj , ..., bm − amj xj )}
0≤xj ≤b
The maximum value of b that xj can assume is

b1 b2 b
b = Min{ , ,··· , m }
a1j a2j amj

Example 2.4: Use dynamic programming to solve the following LPP:

Maximize z = 3x1 + 5x2


subject to x1 ≤ 4
x2 ≤ 6
3x1 + 2x2 ≤ 18
x1 , x2 ≥ 0.

Solution: The problem consists of three resources and two decision variables. There-
fore, the states of the equivalent dynamic programming problem are b1 = 4, b2 = 6, b3 =
18.
For the first stage, we have f1 (b1 , b2 , b3 ) = max0≤x1 ≤b {3x1 }, where maximum value of b
3 } = 4.
that x1 can assume is b = min{ 41 , 60 , 18
Therefore, f1 (4, 6, 18) = max0≤x1 ≤4 {3x1 } = 3Min.{4, 18−2x
3 }
2

For the two-stage problem, we have f2 (b1 , b2 , b3 ) = max0≤x2 ≤b {5x2 + 3x1 }, where maxi-
2 } = 6.
mum value of b that x2 can assume is b = min{ 40 , 61 , 18
Therefore, f2 (4, 6, 18) = max0≤x2 ≤6 {5x2 + 3Min(4, 18−2x 2
3 )}

( 18−2x )  
 4, if 0 ≤ x2 ≤ 3
Now, min 4, 3 2 =  
 18−2x2 , if 3 < x2 ≤ 6
3 
( 18−2x )  
 5x2 + 12, if 0 ≤ x2 ≤ 3
Therefore, 5x2 + 3 min 4, 3 2 =  
 18 + 3x2 , if 3 < x2 ≤ 6

Hence the maximum value of 5x2 +12 is 27 at x2 = 3 and the maximum value of 18+3x2
is 36 which occurs at x2 = 6. Thus the optimal value of f2 (4, 6, 18) is 36.
Hence, the required solution is max z = 36 with x2∗ = 6, x1∗ = Min{4, 18−2x
3 } = 2.
2

You might also like