Docsity

Wayne Winston, .... Edition, 2003 - 19 probabilistic dynamic programming, Manuais, Projetos, Pesquisas de Engenharia de Produção

Toggle sidebar
bg1
Probabilistic Dynamic Programming
Recall from our study of deterministic dynamic programming that many recursions were of the
following form:
f
t
(current state) min
all feasible
(or max){costs during current stage f
t1
(new state)}
decisions
For all the examples in Chapter 18, a specification of the current state and current decision
was enough to tell us with certainty the new state and the costs during the current stage. In
many practical problems, these factors may not be known with certainty, even if the current
state and decision are known. For example, in the inventory model of Section 18.3, we as-
sumed that each period’s demand was known at the beginning of the problem. In most situa-
tions, it would be more realistic to assume that period t’s demand is a random variable whose
value is not known until after period t’s production decision is made. Even if we know the cur-
rent period’s state (beginning inventory level) and decision (production during the current pe-
riod), the next period’s state and the current period’s cost will be random variables whose val-
ues are not known until the value of period t’s demand is known. The Chapter 18 discussion
simply does not apply to this problem.
In this chapter, we explain how to use dynamic programming to solve problems in which
the current period’s cost or the next period’s state are random. We call these problems prob-
abilistic dynamic programming problems (or PDPs). In a PDP, the decision maker’s goal is
usually to minimize expected (or expected discounted) cost incurred or to maximize expected
(or expected discounted) reward earned over a given time horizon. Chapter 19 concludes with
a brief study of Markov decision processes. A Markov decision process is just a probabilistic
dynamic programming problem in which the decision maker faces an infinite horizon.
19.1 When Current Stage Costs Are Uncertain,
but the Next Period’s State Is Certain
For problems in this section, the next period’s state is known with certainty, but the re-
ward earned during the current stage is not known with certainty (given the current state
and decision).
EXAMPLE 1
For a price of $1/gallon, the Safeco Supermarket chain has purchased 6 gallons of milk
from a local dairy. Each gallon of milk is sold in the chain’s three stores for $2/gallon.
The dairy must buy back for 50¢/gallon any milk that is left at the end of the day. Un-
fortunately for Safeco, demand for each of the chain’s three stores is uncertain. Past data
indicate that the daily demand at each store is as shown in Table 1. Safeco wants to allo-
Milk Distribution
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Pré-visualização parcial do texto

Baixe Wayne Winston, .... Edition, 2003 - 19 probabilistic dynamic programming e outras Manuais, Projetos, Pesquisas em PDF para Engenharia de Produção, somente na Docsity!

Probabilistic Dynamic Programming

Recall from our study of deterministic dynamic programming that many recursions were of the following form: ft (current state)  min all feasible

(or max){costs during current stage  ft 1 (new state)} decisions For all the examples in Chapter 18, a specification of the current state and current decision was enough to tell us with certainty the new state and the costs during the current stage. In many practical problems, these factors may not be known with certainty, even if the current state and decision are known. For example, in the inventory model of Section 18.3, we as- sumed that each period’s demand was known at the beginning of the problem. In most situa- tions, it would be more realistic to assume that period t’s demand is a random variable whose value is not known until after period t’s production decision is made. Even if we know the cur- rent period’s state (beginning inventory level) and decision (production during the current pe- riod), the next period’s state and the current period’s cost will be random variables whose val- ues are not known until the value of period t’s demand is known. The Chapter 18 discussion simply does not apply to this problem. In this chapter, we explain how to use dynamic programming to solve problems in which the current period’s cost or the next period’s state are random. We call these problems prob- abilistic dynamic programming problems (or PDPs). In a PDP, the decision maker’s goal is usually to minimize expected (or expected discounted) cost incurred or to maximize expected (or expected discounted) reward earned over a given time horizon. Chapter 19 concludes with a brief study of Markov decision processes. A Markov decision process is just a probabilistic dynamic programming problem in which the decision maker faces an infinite horizon.

19.1 When Current Stage Costs Are Uncertain, but the Next Period’s State Is Certain

For problems in this section, the next period’s state is known with certainty, but the re- ward earned during the current stage is not known with certainty (given the current state and decision).

E X A M P L E 1

For a price of $1/gallon, the Safeco Supermarket chain has purchased 6 gallons of milk from a local dairy. Each gallon of milk is sold in the chain’s three stores for $2/gallon. The dairy must buy back for 50¢/gallon any milk that is left at the end of the day. Un- fortunately for Safeco, demand for each of the chain’s three stores is uncertain. Past data indicate that the daily demand at each store is as shown in Table 1. Safeco wants to allo-

Milk Distribution

1 9. 1 When Current Stage Costs Are Uncertain, but the Next Period’s State Is Certain 1017

cate the 6 gallons of milk to the three stores so as to maximize the expected net daily profit (revenues less costs) earned from milk. Use dynamic programming to determine how Safeco should allocate the 6 gallons of milk among the three stores.

Solution With the exception of the fact that the demand (and therefore the revenue) is uncertain, this problem is very similar to the resource allocation problems studied in Section 18.4. Observe that since Safeco’s daily purchase costs are always $6, we may concentrate our attention on the problem of allocating the milk to maximize daily expected revenue earned from the 6 gallons. Define rt ( gt )  expected revenue earned from gt gallons assigned to store t ft ( x )  maximum expected revenue earned from x gallons assigned to stores t , t  1,... , 3 Since f 3 ( x ) must by definition be the expected revenue earned from assigning x gallons of milk to store 3, we see that f 3 ( x )  r 3 ( x ). For t  1, 2, we may write ft ( x )  max gt

{ rt ( gt )  ft  1 ( x  gt )} (1) where gt must be a member of {0, 1,... , x }. Equation (1) follows, because for any choice of gt (the number of gallons assigned to store t ), the expected revenue earned from store t , t  1,... , 3 will be the sum of the expected revenue earned from store t if g (^) t gallons are assigned to store t plus the maximum expected revenue that can be earned from the stores t  1, t  2,... , 3 when x  g (^) t gallons are assigned to these stores. To compute the optimal allocation of milk to the stores, we begin by computing f 3 (0), f 3 (1),... , f 3 (6). Then we use Equation (1) to compute f 2 (0), f 2 (1),... , f 2 (6). Finally we determine f 1 (6). We begin by computing the rt ( gt )’s. Note that it would be foolish to assign more than 3 gallons to any store. For this reason, we compute the r (^) t ( gt )’s only for gt  0, 1, 2, or 3. As an example, we compute r 3 (2), the expected revenue earned if 2 gallons are assigned to store 3. If the demand at store 3 is for 2 or more gallons, both gallons assigned to store 3 will be sold, and $4 in revenue will be earned. If the demand at store 3 is 1 gallon, 1 gallon will be sold for $2, and 1 gallon will be returned for 50¢. Hence, if demand at store 3 is for 1 gallon, a revenue of $2.50 will be earned. Since there is a .60 chance that de- mand at store 3 will be for 2 or more gallons and a .40 chance that store 3 demand will be for 1 gallon, it follows that r 3 (2)  (.30  .30)(4.00)  .40(2.50)  $3.40. Similar computations yield the following results:

T A B L E 1 Probability Distributions for Daily Milk Demand Daily Demand (gallons) Probability Store 1 1. 2 0

Store 2 1.

Store 3 1.

1 9. 2 A Probabilistic Inventory Model 1019

is attained by g 2 (5)  3, we assign 3 gallons to store 2. Then 5  3  2 gallons are avail- able for store 3. Since g 3 (2)  2, we assign 2 gallons to store 3. Note that although this policy obtains the maximum expected revenue, f 1 (6)  $9.75, the total revenue actually received on a given day may be more or less than $9.75. For example, if demand at each store were 1 gallon, total revenue would be 3(2.00)  3(0.50)  $7.50, whereas if de- mand at each store were 3 gallons, all the milk would be sold at $2/gallon, and the total revenue would be 6(2.00)  $12.00.

P R O B L E M S

Group A

1 In Example 1, find another allocation of milk that maximizes expected daily revenue.

2 Suppose that $4 million is available for investment in three projects. The probability distribution of the net present value earned from each project depends on how much is

invested in each project. Let I t be the random variable denoting the net present value earned by project t. The distribution of I t depends on the amount of money invested in project t , as shown in Table 2 (a zero investment in a project always earns a zero NPV). Use dynamic programming to determine an investment allocation that maximizes the

expected NPV obtained from the three investments.

19.2 A Probabilistic Inventory Model

In this section, we modify the inventory model of Section 18.3 to allow for uncertain de- mand. This will illustrate the difficulties involved in solving a PDP for which the state during the next period is uncertain (given the current state and current decision).

E X A M P L E 2 Three-Period Production Policy

T A B L E 2 Investment Probability for Problem 2 Investment (millions) Probability Project 1 $1 P ( I 1  2)  .6 P ( I 1  4)  .3 P ( I 1  5) . $2 P ( I 1  4)  .5 P ( I 1  6)  .3 P ( I 1  8) . $3 P ( I 1  6)  .4 P ( I 1  7)  .5 P ( I 1  10) . $4 P ( I 1  7)  .2 P ( I 1  9)  .4 P ( I 1  10) . Project 2 $1 P ( I 2  1)  .5 P ( I 2  2)  .4 P ( I 2  4) . $2 P ( I 2  3)  .4 P ( I 2  5)  .4 P ( I 2  6) . $3 P ( I 2  4)  .3 P ( I 2  6)  .3 P ( I 2  8) . $4 P ( I 2  3)  .4 P ( I 2  8)  .3 P ( I 2  9) . Project 3 $1 P ( I 3  0)  .2 P ( I 3  4)  .6 P ( I 3  5) . $2 P ( I 3  4)  .4 P ( I 3  6)  .4 P ( I 3  7) . $3 P ( I 3  5)  .3 P ( I 3  7)  .4 P ( I 3  8) . $4 P ( I 3  6)  .1 P ( I 3  8)  .5 P ( I 3  9) .

1020 C H A P T E R 1 9 Probabilistic Dynamic Programming

Consider the following three-period inventory problem. At the beginning of each period, a firm must determine how many units should be produced during the current period. Dur- ing a period in which x units are produced, a production cost c ( x ) is incurred, where c (0)  0, and for x  0, c ( x )  3  2 x. Production during each period is limited to at most 4 units. After production occurs, the period’s random demand is observed. Each period’s de- mand is equally likely to be 1 or 2 units. After meeting the current period’s demand out of current production and inventory, the firm’s end-of-period inventory is evaluated, and a holding cost of $1 per unit is assessed. Because of limited capacity, the inventory at the end of each period cannot exceed 3 units. It is required that all demand be met on time. Any inventory on hand at the end of period 3 can be sold at $2 per unit. At the beginning of period 1, the firm has 1 unit of inventory. Use dynamic programming to determine a production policy that minimizes the expected net cost incurred during the three periods. Solution Define f (^) t ( i ) to be the minimum expected net cost incurred during the periods t , t  1,

... , 3 when the inventory at the beginning of period t is i units. Then f 3 ( i )  min x

{ c ( x )  (^12 )( i  x  1)  (^12 )( i  x  2) (2)  (^12 )2( i  x  1)  (^12 )2( i  x  2)} where x must be a member of {0, 1, 2, 3, 4} and x must satisfy (2  i )  x  (4  i ). Equation (2) follows, because if x units are produced during period 3, the net cost dur- ing period 3 is (expected production cost)  (expected holding cost)  (expected salvage value). If x units are produced, the expected production cost is c ( x ), and there is a ^12 ^ chance that the period 3 holding cost will be i  x  1 and a ^12 ^ chance that it will be i  x  2. Hence, the period 3 expected holding cost will be (^12 )( i  x  1)  (^12 )( i  x  2)  i  x  ^32 . Similar reasoning shows that the expected salvage value (a negative cost) at the end of period 3 will be (^12 )2( i  x  1)  (^12 )2( i  x  2)  2 i  2 x  3. To en- sure that period 3 demand is met, we must have i  x  2, or x  2  i. Similarly, to ensure that ending period three inventory does not exceed 3 units, we must have i  x  1  3, or x  4  i. For t  1, 2, we can derive the recursive relation for ft ( i ) by noting that for any month t production level x , the expected costs incurred during periods t , t  1,... , 3 are the sum of the expected costs incurred during period t and the expected costs incurred dur- ing periods t  1, t  2,... , 3. As before, if x units are produced during month t , the expected cost during month t will be c ( x )  (^12 )( i  x  1)  (^12 )( i  x  2). (Note that during periods 1 and 2, no salvage value is received.) If x units are produced during month t , the expected cost during periods t  1, t  2,... , 3 is computed as follows. Half of the time, the demand during period t will be 1 unit, and the inventory at the beginning of period t  1 will be i  x  1. In this situation, the expected costs incurred during pe- riods t  1, t  2,... , 3 (assuming we act optimally during these periods) is ft  1 ( i  x  1). Similarly, there is a ^12 ^ chance that the inventory at the beginning of period t  1 will be i  x  2. In this case, the expected cost incurred during periods t  1, t  2,

... , 3 will be ft  1 ( i  x  2). In summary, the expected cost during periods t  1, t  2,... , 3 will be (^12 ) ft  1 ( i  x  1)  (^12 ) ft  1 ( i  x  2). With this in mind, we may write for t  1, 2, ft ( i )  min x

[ c ( x )  (^12 )( i  x  1)  (^12 )( i  x  2) (3)  (^12 ) ft  1 ( i  x  1)  (^12 ) ft  1 ( i  x  2)] where x must be a member of {0, 1, 2, 3, 4} and x must satisfy (2  i )  x  (4  i ). Generalizing the reasoning that led to (3) yields the following important observation concerning the formulation of PDPs. Suppose the possible states during period t  1 are s 1 , s 2 ,... , sn and the probability that the period t  1 state will be si is p (^) i. Then the min- imum expected cost incurred during periods t  1, t  2,... , end of the problem is

1022 C H A P T E R 1 9 Probabilistic Dynamic Programming

period 3’s production level cannot be determined until period 2’s demand is observed. To illustrate the idea, we determine the optimal production schedule if period 1 and period 2 demands are both 2 units. Since x 1 (1)  3, 3 units will be produced during period 1. Then period 2 will begin with an inventory of 1  3  2  2 units, so x 2 (2)  0 units should be produced. After period 2’s demand of 2 units is met, period 3 will begin with 2  2  0 units on hand. Thus, x 3 (0)  2 units will be produced during period 3.

In contrast, suppose that period 1 and period 2 demands are both 1 unit. As before, x 1 (1)  3 units will be produced during period 1. Then period 2 will begin with 1  3  1  3 units, and x 2 (3)  0 units will be produced during period 2. Then period 3 will begin with 3  1  2 units on hand, and x 3 (2)  0 units will be produced during period 3. Note that the optimal production policy has adapted to the low demand by reducing period 3 production. This example illustrates an important aspect of dynamic programming solutions for problems in which future states are not known with certainty at the beginning of the problem: If a random factor (such as random demand) influences transitions from the period t state to the period t  1 state, the optimal action for period t cannot be determined until period t’s state is known.

(s, S) Policies

Consider the following modification of the dynamic lot-size model of Section 18.7, for which there exists an optimal production policy called an ( s , S ) inventory policy: 1 The cost of producing x  0 units during a period consists of a fixed cost K and a per- unit variable production cost c. 2 With a probability p ( x ), the demand during a given period will be x. 3 A holding cost of h per unit is assessed on each period’s ending inventory. If we are short, a per-unit shortage cost of d is incurred. (The case where no shortages are allowed may be obtained by letting d be very large.) 4 The goal is to minimize the total expected cost incurred during periods 1, 2,... , T. 5 All demands must be met by the end of period T. For such an inventory problem, Scarf (1960) used dynamic programming to prove that there exists an optimal production policy of the following form: For each t ( t  1, 2,... , T ) there exists a pair of numbers ( st , St ) such that if it  1 , the entering inventory for period

T A B L E 5 Computations for f 1 (1) Expected Expected Future Cost (^) Total Holding Cost (( ^12^  ) f 2 ( i  x  1) (^) Expected Cost f 1 (1) x c ( x ) ( i  x  ^32  )  ( ^12^  ) f 2 ( i  x  2)) Periods 1–3 x 1 (1)

1 5 ^12  ^223  17 f 1 (1)  ^645  2 7 ^32  ^343  ^647  x 1 (1)  3 3 9 ^52  ^149  ^645 *

1 9. 3 How to Maximize the Probability of a Favorable Event Occurring 1023

t , is less than st , then an amount St  it  1 is produced; if it  1  st , then it is optimal not to produce during period t. Such a policy is called an ( s , S ) policy. For Example 2, our calculations show that s 2  2, S 2  3 or 4, s 3  2, and S 3  2. Thus, if we enter period 2 with 1 or 0 units, we produce enough to bring our stock level (before meeting period 2 demand) up to 3 or 4 units. If we enter period 2 with more than 1 unit, then no production should take place during period 2.

P R O B L E M S

Group A

1 For Example 2, suppose that the period 1 demand is 1 unit, and the period 2 demand is 2 units. What would be the optimal production schedule?

2 Re-solve Example 2 if the end-of-period holding cost is $2 per unit.

3 In Example 2, suppose that shortages are allowed, and each shortage results in a lost sale and a cost incurred of $3. Now re-solve Example 2.

Group B 4 Chip Bilton sells sweatshirts at State U football games. He is equally likely to sell 200 or 400 sweatshirts at each game. Each time Chip places an order, he pays $500 plus $5 for each sweatshirt he orders. Each sweatshirt sells for $8. A holding cost of $2 per shirt (because of the opportunity cost for capital tied up in sweatshirts as well as storage costs) is assessed against each shirt left at the end of a game. Chip can store at most 400 shirts after each game. Assuming that the number of shirts ordered by Chip must

be a multiple of 100, determine an ordering policy that maximizes expected profits earned during the first three games of the season. Assume that any leftover sweatshirts have a value of $6.

19.3 How to Maximize the Probability of a Favorable Event Occurring

There are many occasions on which the decision maker’s goal is to maximize the proba- bility of a favorable event occurring. For instance, a company may want to maximize its probability of reaching a specified level of annual profits. To solve such a problem, we assign a reward of 1 if the favorable event occurs and a reward of 0 if it does not occur. Then the maximization of expected reward will be equivalent to maximizing the proba- bility that the favorable event will occur. Also, the maximum expected reward will equal the maximum probability of the favorable event occurring. The following two examples illustrate how this idea may be used to solve some fairly complex problems.

E X A M P L E 3

A gambler has $2. She is allowed to play a game of chance four times, and her goal is to maximize her probability of ending up with a least $6. If the gambler bets b dollars on a play of the game, then with probability .40, she wins the game and increases her capital position by b dollars; with probability .60, she loses the game and decreases her capital by b dollars. On any play of the game, the gambler may not bet more money than she has available. Determine a betting strategy that will maximize the gambler’s probability of at- taining a wealth of at least $6 by the end of the fourth game. We assume that bets of zero dollars (that is, not betting) are permissible. Solution Define ft ( d ) to be the probability that by the end of game 4, the gambler will have at least

Gambling Game

†This section covers topics that may be omitted with no loss of continuity.

1 9. 3 How to Maximize the Probability of a Favorable Event Occurring 1025

f 3 (3)  max

Thus, f 3 (3)  .40, and b 3 (3)  $0 or $3.

f 3 (4)  max

Thus, f 3 (4)  .40, and b 3 (4)  $0, $1, $2, $3, or $4.

f 3 (5)  max

Thus, f 3 (5)  .64, and b 3 (5)  $1 or $2. For d  6, f 3 ( d )  1, and b 3 ( d )  $0, $1,... , $( d  6).

Stage 2 Computations

f 2 (0)  0 b 2 (0)  $

f 2 (1)  max (^) 

Thus, f 2 (1)  .064, and b 2 (1)  $1.

f 2 (2)  max

Thus, f 2 (2)  .16, and b 2 (2)  $0, $1, or $2.

f 2 (3)  max

Thus, f 2 (3)  .40, and b 2 (3)  $0 or $3.

f 2 (4)  max

Thus, f 2 (4)  .496, and b 2 (4)  $1 or $2.

.4 f 3 (4)  .6 f 3 (4)  .40 (Bet $0) .4 f 3 (5)  .6 f 3 (3)  .496* (Bet $1) .4 f 3 (6)  .6 f 3 (2)  .496* (Bet $2) .4 f 3 (7)  .6 f 3 (1)  .40 (Bet $3) .4 f 3 (8)  .6 f 3 (0)  .40 (Bet $4)

.4 f 3 (3)  .6 f 3 (3)  .40* (Bet $0) .4 f 3 (4)  .6 f 3 (2)  .256 (Bet $1) .4 f 3 (5)  .6 f 3 (1)  .256 (Bet $2) .4 f 3 (6)  .6 f 3 (0)  .40* (Bet $3)

.4 f 3 (2)  .6 f 3 (2)  .16* (Bet $0) .4 f 3 (3)  .6 f 3 (1)  .16* (Bet $1) .4 f 3 (4)  .6 f 3 (0)  .16* (Bet $2)

.4 f 3 (1)  .6 f 3 (1)  0 (Bet $0) .4 f 3 (2)  .6 f 3 (0)  .064* (Bet $1)

.4 f 4 (5)  .6 f 4 (5)  .40 (Bet $0) .4 f 4 (6)  .6 f 4 (4)  .64* (Bet $1) .4 f 4 (7)  .6 f 4 (3)  .64* (Bet $2) .4 f 4 (8)  .6 f 4 (2)  .40 (Bet $3) .4 f 4 (9)  .6 f 4 (1)  .40 (Bet $4) .4 f 4 (10)  .6 f 4 (0)  .40 (Bet $5)

.4 f 4 (4)  .6 f 4 (4)  .40* (Bet $0) .4 f 4 (5)  .6 f 4 (3)  .40* (Bet $1) .4 f 4 (6)  .6 f 4 (2)  .40* (Bet $2) .4 f 4 (7)  .6 f 4 (1)  .40* (Bet $3) .4 f 4 (8)  .6 f 4 (0)  .40* (Bet $4)

1026 C H A P T E R 1 9 Probabilistic Dynamic Programming

f 2 (5)  max

Thus, f 2 (5)  .64, and b 2 (5)  $0, $1, or $2. For d  6, f 2 ( d )  1 and b 2 ( d )  $0, $1,... , $( d  6). Stage 1 Computations

f 1 (2)  max

Thus, f 1 (2)  .1984, and b 1 (2)  $1 or $2. Hence, the gambler has a .1984 chance of reaching $6. Suppose the gambler begins by betting b 1 (2)  $1. Then Figure 1 indicates the various possibilities that can occur. By following the strategy outlined in the figure, the gambler can reach her goal of $6 in two different ways. First, she can win game 1 and game 3. This will occur with probability (.4)^2  .16. Second, the gambler can win if she loses the first game but wins the next three games. This will occur with probability .6(.4)^3  .0384. Hence, the gambler’s probability of reaching $6 is .16  .0384  .1984  f 1 (2).

E X A M P L E 4

Martina McEnroe has two types of serves: a hard serve ( H ) and a soft serve ( S ).†^ The probability that Martina’s hard serve will land in bounds is pH , and the probability that her soft serve will land in bounds is pS. If Martina’s hard serve lands in bounds, there is a probability w (^) H that Martina will win the point. If Martina’s soft serve lands in bounds, there is a probability wS that Martina will win the point. We assume that pH pS and

Tennis Serves

.4 f 2 (2)  .6 f 2 (2)  .16 (Bet $0) .4 f 2 (3)  .6 f 2 (1)  .1984* (Bet $1) .4 f 2 (4)  .6 f 2 (0)  .1984* (Bet $2)

.4 f 3 (5)  .6 f 3 (5)  .64* (Bet $0) .4 f 3 (6)  .6 f 3 (4)  .64* (Bet $1) .4 f 3 (7)  .6 f 3 (3)  .64* (Bet $2) .4 f 3 (8)  .6 f 3 (2)  .496 (Bet $3) .4 f 3 (9)  .6 f 3 (1)  .40 (Bet $4) .4 f 3 (10)  .6 f 3 (0)  .40 (Bet $5)

†Based on material by E. V. Denardo, personal communication.

Game 1

Bet b 1 (2) = $

Bet b 2 (3) = $

Bet b 3 (3) = $

Bet b 3 (3) = $

Bet b 3 (2) = $

Bet b 4 (4) = $

Done I lose

Done I lose

Done I win

Done I win

Done I lose

Done I lose

Bet b 2 (1) = $

Win

Lose

Win

Lose

Game 2

Win

Lose

Win

Lose

Win

Lose

Win

Lose

Game 3 Game 4

F I G U R E 1 Ways Gambler Can Reach $

1028 C H A P T E R 1 9 Probabilistic Dynamic Programming

From this equation, we see that Martina should serve hard on the first serve if pHwH  (1  pH ) f 2  pSwS  (1  pS ) f 2 (6) (If (6) is not satisfied, Martina should serve soft on the first serve.) Continuing with the assumption that p (^) SwS  w (^) HpH (which implies that f 2  pSwS ), we may substitute f 2  pSwS into (6) to obtain the result that Martina should serve hard on the first serve if p (^) HwH  (1  pH ) pSwS  pSwS  (1  pS ) pSwS or p (^) HwH  pSwS (1  pH  pS ) (7) For example, if pH  .60, p (^) S  .90, w (^) H  .55, and wS  .50, then (5) and (7) are both satisfied, and Martina should serve hard on her first serve and soft on her second serve. On the other hand, if pH  .25, pS  .80, w (^) H  .60, and wS  .45, then both serves should be soft. The reason for this is that in this case, the hard serve’s advantage from the fact that w (^) H exceeds w (^) S is outweighed by the fact that a hard serve on the first serve greatly increases the chances of a double fault. To complete our analysis, we must consider the situation where (5) does not hold. We now show that if pHwH  pSwS (8) Martina should serve hard on both serves. Note that if (8) holds, then f 2  max { p (^) Hw (^) H , pSwS }  p (^) HwH , and Martina should serve hard on the second serve. Now (6) implies that Martina should serve hard on the first serve if pHwH  (1  pH ) pHwH  pSwS  (1  pS ) pHwH Upon rearrangement, the last inequality becomes p (^) HwH (1  pS  pH )  pSwS Dividing both sides of the last inequality by pSwS shows that Martina should serve hard on the first serve if

 p p

H S

w w

H S

 (1  pS  pH )  1

After noting that pHwH  pSwS and (1  pS  pH )  1 (because pS  pH ), we see that the last inequality holds. Thus, we have shown that if p (^) HwH  pSwS , Martina should serve hard on both serves. This is reasonable, because if it is optimal to serve hard on the sec- ond (and this requires p (^) HwH  p (^) SwS ), then it should be optimal to serve hard on the first serve, because the danger of double-faulting (which is the drawback to the hard serve) is less immediate on the first serve. Of course, Example 4 could have been solved using a decision tree; see Problem 10 of Section 13.4.

In our solution to Example 4, we have shown how Mar- tina’s optimal strategy depends on the values of the parame- ters defining the problem. This is a kind of sensitivity analy- sis like the one applied to lin- ear programming problems in

Chapters 5 and 6.

P R O B L E M S Group A 1 Vladimir Ulanowsky is playing Keith Smithson in a two-game chess match. Winning a game scores 1 match

1 9. 4 Further Examples of Probabilistic Dynamic Programming Formulations 1029

point, and drawing a game scores ^12  match point. After the two games are played, the player with more match points is declared the champion. If the two players are tied after two games, they continue playing until someone wins a game (the winner of that game will be the champion). During each game, Ulanowsky can play one of two ways: boldly or conservatively. If he plays boldly, he has a 45% chance of winning the game and a 55% chance of losing the game. If he plays conservatively, he has a 90% chance of drawing the game and a 10% chance of losing the game. Ulanowsky’s goal is to maximize his probability of winning the match. Use dynamic programming to help him accomplish this goal. If this problem is solved correctly, even though Ulanowsky is the inferior player, his chance of winning the

match is over ^12 . Explain this anomalous result. 2 Dickie Hustler has $2 and is going to toss an unfair coin (probability .4 of heads) three times. Before each toss, he can bet any amount of money (up to what he now has). If heads comes up, Dickie wins the number of dollars he bets; if tails comes up, he loses the number of dollars he bets. Use dynamic programming to determine a strategy that maximizes Dickie’s probability of having at least $5 after the third coin toss.

Group B 3 Supppose that Army trails by 14 points in the Army–Navy

football game. Army’s guardian angel has assured the Army coach that his team will have the ball two more times during the game and will score a touchdown (worth 6 points) each time it has the ball. The Army coach has also been assured that Navy will not score any more points. Suppose a win is assigned a value of 1, a tie is .3, and a loss is 0. Army’s problem is to determine whether to go for 1 or 2 points after each touchdown. A 1-point conversion is always successful, and a 2-point conversion is successful only 40% of the time. The Army coach wants to maximize the expected reward earned from the outcome of the game. Use dynamic programming to determine an optimal strategy. Then prove the following result: No matter what value is assigned to a tie, it is never optimal to use the following strategy: Go for a 1-point conversion after the first touchdown and go for a 2- point conversion after the second touchdown. Note that this (suboptimal) strategy is the one most coaches follow!

19.4 Further Examples of Probabilistic Dynamic Programming Formulations

Many probabilistic dynamic programming problems can be solved using recursions of the following form (for max problems): ft ( i )  max a 

(expected reward during stage t | i , a )  (^)  j

p ( j | i , a , t ) ft  1 ( j ) (9) In (9), ft ( i ) is the maximum expected reward that can be earned during stages t , t  1,... end of the problem, given that the state at the beginning of stage t is i. The max in (9) is taken over all actions a that are feasible when the state at the beginning of stage t is i. In (9), p ( j | i , a , t ) is the probability that the next period’s state will be j , given that the cur- rent (stage t ) state is i and action a is chosen. Hence, the summation in (9) represents the expected reward from stage t  1 to the end of the problem. By choosing a to maximize the right-hand side of (9), we are choosing a to maximize the expected reward earned from stage t to the end of the problem, and this is what we want to do. The following are six examples of probabilistic dynamic programming formulations.

E X A M P L E 5

Sunco Oil has D dollars to allocate for drilling at sites 1, 2,... , T. If x dollars are allo- cated to site t , the probability is q (^) t ( x ) that oil will be found on site t. Sunco estimates that if site t has any oil, it is worth rt dollars. Formulate a recursion that could be used to en- able Sunco to maximize the expected value of all oil found on sites 1, 2,... , T. Solution This is a typical resource allocation problem (see Example 1). Therefore, the stage should represent the number of sites, the decision for site t is how many dollars to allocate to site t , and the state is the number of dollars available to allocate to sites t , t  1,... , T. We therefore define ft ( d ) to be the maximum expected value of the oil that can be found on sites t , t  1,... , T if d dollars are available to allocate to sites t , t  1,... , T. We make the reasonable assumption that qT ( x ) is a nondecreasing function of x. If this is the case, then at stage T , all the money should be allocated to site T. This yields

Sunco Oil Drilling

1 9. 4 Further Examples of Probabilistic Dynamic Programming Formulations 1031

namic programming to determine a strategy for Sally that will maximize her expected net revenue (reward  waiting costs). Solution When Sally arrives at the bank, she must decide whether to join the line or to give up and leave. At any later time, she may also decide to leave if it is unlikely that she will be served by the end of her lunch break. If 1 minute remained, Sally’s decision would be sim- ple: She should stay in line if and only if her expected reward exceeds the cost of wait- ing for 1 minute ( c ). Then we can work backward to a problem with 2 minutes left, and so on. We define ft ( n ) to be the maximum expected net reward that Sally can receive from time t to the end of her lunch break if at time t , n people are ahead of her. We let t  0 be the present and t  30 be the end of the problem. Since t  29 is the beginning of the last minute of the problem, we write

f 29 ( n )  max (^) 

This follows because if Sally chooses to leave at time 29, she earns no reward and incurs no more costs. On the other hand, if she stays at time 29, she will incur a waiting cost of c (a revenue of  c ) and with probability p ( n | n ) will enter service and receive a reward r. Thus, if Sally stays, her expected net reward is rp ( n | n )  c. For t 29, we write

ft ( n )  max 

The last recursion follows, because if Sally stays, she will earn an expected reward (as in the t  29 case) of rp ( n | n )  c during the current minute, and with probability p ( k | n ), there will be n  k people ahead of her; in this case, her expected net reward from time t  1 to time 30 will be ft  1 ( n  k ). If Sally stays, her overall expected reward received from time t  1, t  2,... , 30 will be

 k n

p ( k | n ) ft  1 ( n  k )

Of course, if n people complete their transactions during the current minute, the problem ends, and Sally’s future net revenue will be zero. To determine Sally’s optimal waiting policy, we work backward until f 0 (20) is com- puted. If f 0 (20) is attained by “stay,” Sally stays and sees how many people are ahead of her at time 1. She continues to stay until a situation arises for which the optimal action is “leave” or she begins to be served. In either case, the problem terminates. Problems in which the decision maker can terminate the problem by choosing a par- ticular action are known as stopping rule problems; they often have a special structure that simplifies the determination of optimal policies. See Ross (1983) for more informa- tion on stopping rule problems.

E X A M P L E 8

E. J. Korvair Department Store is trying to determine an optimal cash management pol- icy. During each day, the demand for cash may be described by a random variable D , where p ( D  d )  p ( d ). At the beginning of each day, the store sends an employee to the bank to deposit or withdraw funds. Each bank transaction costs K dollars. Then E. J.’s de- mand for cash is met by cash left from the previous day plus money withdrawn (or mi- nus money deposited). At the end of the day, the store determines its cash balance at the store. If the cash balance is negative, a shortage cost of s dollars per dollar short is in- curred. If the ending balance is positive, a cost of i dollars per dollar held is incurred (be-

Cash Management Policy

(Leave) (Stay)

rp ( n | n )  c  (^)  k n

p ( k | n ) ft  1 ( n  k )

(Leave) (Stay)

rp ( n | n )  c

1032 C H A P T E R 1 9 Probabilistic Dynamic Programming

cause of loss of interest that could have been earned by depositing cash in the bank). At the beginning of day 1, the store has $10,000 cash on hand and a bank balance of $100,000. Formulate a dynamic programming model that can be used to minimize the ex- pected cost of filling the store’s cash needs for the next 30 days. Solution To determine how much money should be withdrawn or deposited, E. J. needs to know its cash on hand and bank balance at the beginning of the day. As usual, we let time be the stage. At the beginning of each stage (or day), E. J. must decide how much to with- draw from or deposit in the bank. We let ft ( c , b ) be the minimum expected cost incurred by the store during days t , t  1,... , 30, given that at the beginning of day t , the store has c dollars cash at the store and b dollars in the bank. We observe that

f 30 ( c , b )  min x 

Kd ( x )  (^)  d  c  x

p ( d )( c  x  d ) i  (^)  d  c  x

p ( d )( d  c  x ) s  (10)

Here, x is the amount of money transferred from the bank to the store (if x 0 money is transferred from the store to the bank). Since the store cannot withdraw more than b dollars from the bank or deposit more than c dollars in the bank, x must satisfy b  x   c. Also, in (10), d (0)  0 and d ( x )  1 for x 0. In short, Kd ( x ) picks up the transac- tion cost (if there is a transaction). If d  c  x , the store will end the day with c  x  d dollars, so a cost of i ( c  x  d ) is incurred (because of lost interest). Since this oc- curs with probability p ( d ), the first sum in (10) represents the expected interest costs in- curred during day 30. Also note that if d  c  x , the store will be d  c  x dollars short, and a shortage cost of s ( d  c  x ) will be incurred. Again, this cost is incurred with probability p ( d ). Hence, the second sum in (10) is the expected shortage cost in- curred during day 30. For t 30, we write

ft ( c , b )  min x 

Kd ( x )  (^)  d  c  x

p ( d )( c  x  d ) i (11)

 (^)  d  c  x

p ( d )( d  c  x ) s  (^)  d

p ( d ) ft  1 ( c  x  d , b  x )

As in (10), x must satisfy b  x   c. Also, the term Kd ( x ) and the first two summa- tions yield the expected cost incurred during day t. If day t demand is d , then at the be- ginning of day t  1, the store will have c  x  d dollars cash on hand and a bank bal- ance of b  x. Thus, with probability p ( d ), the store’s expected cost during days t  1, t  2,... , 30 will be ft  1 ( c  x  d , b  x ). Weighting ft  1 ( c  x  d , b  x ) by the probability that day t demand will be d , we see that the last sum in (11) is the expected cost incurred during days t  1, t  2,... , 30. Hence, (11) is correct. To determine the optimal cash management policy, we would use (10) and (11) to work backward until f 1 (10,000, 100,000) has been computed.

E X A M P L E 9

Robert Blue is trying to find a parking place near his favorite restaurant. He is approach- ing the restaurant from the west, and his goal is to park as nearby as possible. The avail- able parking places are pictured in Figure 2. Robert is nearsighted and cannot see ahead; he can only see whether the space he is at now is empty. When Robert arrives at an empty space, he must decide whether to park there or to continue to look for a closer space. Once he passes a space, he cannot return to it. Robert estimates that the probability that space t is empty is pt. If he does not end up with a parking space, he is embarrassed and incurs a cost M ( M is a big positive number). If he does park in space t , he incurs a cost | t |. Show how Robert can use dynamic programming to develop a parking strategy that minimizes

Parking Spaces

1034 C H A P T E R 1 9 Probabilistic Dynamic Programming

cide whether or not to take the current month’s job offer. In order to make this decision, Dirk must know how much money he has at the beginning of the month. We define ft ( d ) to be Dirk’s maximum expected asset position at the end of month 60, given that at the beginning of month t , Dirk has d dollars. Then

f 60 ( d )  max (^) 

This result follows, because if Dirk takes the job during month 60, there is a probability p 60 that he will be caught and end up with zero dollars and a probability (1  p 60 ) that he will not be caught and end up with d  d 60 dollars. Of course, if Dirk does not take the month 60 job, he ends month 60 with d dollars. Extending this reasoning yields, for t 60,

ft ( d )  max (^) 

Note that if Dirk accepts month t ’s job, there is a probability p (^) t that he will be caught (and end up with zero) and a probability (1  p (^) t ) that he will successfully complete month t ’s job and earn d (^) t dollars. In this case, Dirk will begin month t  1 with d  dt dollars, and his expected final cash position will be ft  1 ( d  dt ). Of course, if Dirk rejects the month t job, he begins month t  1 with d dollars, and his expected final cash position will be ft  1 ( d ). Since Dirk wants to maximize his expected cash position at the end of month 60, the recursion follows. By using the recursion, Dirk can work backward to compute f 1 (50,000). Then he can decide whether to accept the month 1 job. Assuming he has not been caught, he can then determine whether to accept the month 2 job, and so on.

As described in Section 18.8, spreadsheets can be used to solve dynamic programming

(Accept month t job) (Reject month t job)

p (^) t (0)  (1  pt ) ft  1 ( d  dt ) ft  1 ( d )

(Accept month 60 job) (Reject month 60 job)

p 60 (0)  (1  p 60 )( d  d 60 ) d

recursions. See Problems 14 and 15 for some examples of how spreadsheets can be used to solve PDPs.

P R O B L E M S Group A 1 The space shuttle is about to go up on another flight. With probability pt ( z ), it will use z type t fuel cells during the flight. The shuttle has room for at most W fuel cells. If at any time during the flight, all the type t fuel cells burn out, a cost c (^) t will be incurred. Assuming the goal is to minimize the expected cost due to fuel cell shortages, set up a dynamic programming model that could be used to determine how to stock the space shuttle with fuel cells. There are T different types of fuel cells. 2 At the beginning of each year, a firm observes its asset position (call it d ) and may invest any amount x (0  x  d ) in a risky investment. During each year, the money invested doubles with probability p and is completely lost with probability 1  p. Independently of this investment, the firm’s asset position increases by an amount y with

probability q (^) y ( y may be negative). If the firm’s asset position is negative at the beginning of a year, it cannot invest any money during that year. The firm initially has $10,000 in assets and wants to maximize its expected asset position ten years from now. Formulate a dynamic programming recursion that will help accomplish this goal. 3 Consider a machine that may be in any one of the states 0, 1, 2,.... At the beginning of each month, the state of the machine is observed, and it is decided whether to replace or keep the machine. If the machine is replaced, a new state 0 machine arrives instantaneously. It costs R dollars to replace a machine. Each month that a state i machine is in operation, a maintenance cost of c ( i ) is incurred. If a machine is in state i at the beginning of a month, then with probability p (^) ij , the machine will begin the next month in state j. At the beginning of the first month, we own a state i 0 machine. Assuming that the interest rate is 12% per year, formulate a dynamic programming recursion that could be used to minimize the expected discounted cost incurred during the next T months. Note that if we replace a machine at the beginning of a month, we incur a maintenance cost of c (0) during the month, and with probability p 0 i , we begin the next month with a state i machine. 4 In the time interval between t and t  1 seconds before the departure of Braneast Airlines Flight 313, there is a probability pt that the airline will receive a reservation for

1 9. 4 Further Examples of Probabilistic Dynamic Programming Formulations 1035

the flight and a probability 1  p (^) t that the airline will receive no reservation. The flight can seat up to 100 passengers. At departure time, if r reservations have been accepted by the airline, there is a probability q ( y | r ) that y passengers will show up for the flight. Each passenger who boards the flight adds $500 to Braneast’s revenues, but each passenger who shows up for the flight and cannot be seated receives $ in compensation. Formulate a dynamic programming recursion to enable the airline to maximize its expected revenue from Flight 313. Assume that no reservations are received more than 100,000 seconds before flight time.

5 At the beginning of each week, a machine is either running or broken down. If the machine runs throughout the week, it earns revenues of $100. If the machine breaks down during a week, it earns no revenue for that week. If the machine is running at the beginning of the week, we may perform maintenance on it to lessen the chance of a breakdown. If the maintenance is performed, a running machine has a .4 chance of breaking down during the week; if maintenance is not performed, a running machine has a. chance of breaking down during the week. Maintenance costs $20 per week. If the machine is broken down at the beginning of the week, it must be replaced or repaired. Both repair and replacement occur instantaneously. Repairing a machine costs $40, and there is a .4 chance that the repaired machine will break down during the week. Replacing a broken machine costs $90, but the new machine is guaranteed to run throughout the next week of operation. Use dynamic programming to determine a repair, replacement, and maintenance policy that maximizes the expected net profit earned over a four-week period. Assume that the machine is running at the beginning of the first week.

6 I own a single share of Wivco stock. I must sell my share at the beginning of one of the next 30 days. Each day, the price of the stock changes. With probability q ( x ), the price tomorrow will increase by x % over today’s stock price ( x can be negative). For example, with probability q (5), tomorrow’s stock price will be 5% higher than today’s. Show how dynamic programming can be used to determine a strategy that maximizes the expected revenue earned from selling the share of Wivco stock. Assume that at the beginning of the first day, the stock sells for $10 per share.

Group B

7 The National Cat Foundling Home encourages people to adopt its cats, but (because of limited funds) it allows each prospective owner to inspect only four cats before choosing one of them to take home. Ten-year-old Sara is eager to adopt a cat and agrees to abide by the following rules. A randomly selected cat is brought for Sara to see, and then Sara must either choose the cat or reject it. If the first cat is rejected, Sara sees another randomly selected cat and must accept or reject it. This procedure continues until Sara has selected her cat. Once Sara rejects a cat, she cannot go back later and choose it as her pet. Determine a strategy for Sara that will maximize her probability of ending up with the cat she actually prefers.

8 Consider the following probabilistic inventory model: a At the beginning of each period, a firm observes its inventory position.

b Then the firm decides how many units to produce during the current period. It costs c ( x ) dollars to produce x units during a period. c With probability q ( d ), d units are demanded during the period. From units on hand (including the current period’s production), the firm satisfies as much of the demand as possible. The firm receives r dollars for each unit sold. For each unit of demand that is unsatisfied, a penalty cost p is incurred. All unsatisfied demand is as- sumed to be lost. For example, if the firm has 20 units available and current demand is 30, a revenue of 20 r would be received, and a penalty of 10 p would be incurred. d If ending inventory is positive, a holding cost of $ per unit is incurred. e The next period now begins. The firm’s inital inventory is zero, and its goal is to minimize the expected cost over a 100-period horizon. Formulate a dynamic programming recursion that will help the firm accomplish its goal. 9 Martha and Ken Allen want to sell their house. At the beginning of each day, they receive an offer. We assume that from day to day, the sizes of the offers are independent random variables and that the probability that a given day’s offer is for j dollars is p (^) j. An offer may be accepted during the day it is made or at any later date. For each day the house remains unsold, a maintenance cost of c dollars is incurred. The house must be sold within 30 days. Formulate a dynamic programming recursion that Martha and Ken can use to maximize their expected net profit (selling price  maintenance cost). Assume that the maintenance cost for a day is incurred before the current day’s offer is received and that each offer is for an integer number of dollars. 10 An advertising firm has D dollars to spend on reaching customers in T separate markets. Market t consists of k (^) t people. If x dollars are spent on advertising in market t , the probability that a given person in market t will be reached is pt ( x ). Each person in market t who is reached will buy ct units of the product. A person who is not reached will not buy any of the product. Formulate a dynamic programming recursion that could be used to maximize the expected number of units sold in T markets. 11 Georgia Stein is the new owner of the New York Yankees. Each season, Georgia must decide how much money to spend on the free agent draft. During each season, Georgia can spend any amount of money on free agents up to the team’s capital position at the beginning of the season. If the Yankees finish in i th place during the season, their capital position increases by R ( i ) dollars less the amount of money spent in the free agent draft. If the Yankees finished in i th place last season and spend d dollars on free agents during the off-season, the probability that the Yankees will finish in place j during the next season is p (^) ij ( d )( j  1, 2,

... , 7). Last season, the Yankees finished in first place, and at the end of the season, they had a capital position of D dollars. Formulate a dynamic programming recursion that will enable the Yankees to maximize their expected cash position at the end of T seasons. 12 Bailey Bliss is the campaign manager for Walter