probabilistic dynammic...

41
Carles Sitompul Probabilistic Dynamic Programming

Upload: others

Post on 26-Jan-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Carles Sitompul

Probabilistic Dynamic Programming

Page 2: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

1. Current stage costs uncertain, next period’s state certain (21.1)

2. A probabilistic Inventory model (21.2)3. Examples of probabilistic DP formulations : examples 5, 6,

7, 8, 9, 10 (21.4)

Page 3: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

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

Page 4: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 1: Milk Distribution 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. Unfortunately 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 allocate 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

Page 5: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture
Page 6: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Since daily purchase costs are always $6 concentrate to maximize daily expected revenue.

Define:

)()( 33 xrxf =

{ }xgt ,...,2,1,0∈

Page 7: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Note: it would be foolish to assign more than 3 to a store.

3.42.40.10.3)(4)0.3(0.5)0.4(2 revenue Expected

=+=+++=

Page 8: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 3

Page 9: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 2

Page 10: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

We need not compute f3(4), f3(5), and f3(6), because an optimal allocation will never have more than 3 gallons to allocate to a single store

Page 11: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 1

Thus, optimal decision: g1(6) =1 (or 2) g2(5)=3 g3(2)=2

Page 12: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

A Probabilistic Inventory Model

Page 13: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 2: Three-period production policy. Consider the following three-period inventory problem. At the

beginning of each period, a firm must determine how many units shouldbe produced during the current period. During a period in which xunits are produced, a production cost c(x) is incurred, where c(0) = 0,and for x> 0, c(x) = 3 + 2x. Production during each period is limitedto at most 4 units. After production occurs, the period’s randomdemand is observed. Each period’s demand is equally likely to be 1 or 2units. After meeting the current period’s demand out of currentproduction and inventory, the firm’s end-of-period inventory isevaluated, and a holding cost of $1 per unit is assessed. Because oflimited capacity, the inventory at the end of each period cannot exceed 3units. It is required that all demand be met on time. Any inventory onhand at the end of period 3 can be sold at $2 per unit. At the beginningof period 1, the firm has 1 unit of inventory. Use dynamic programmingto determine a production policy that minimizes the expected net costincurred during the three periods.

Page 14: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Define:

)(iftThe minimum expected net cost incurred during the periods t, t+1,..,3 when inventory at the beggining of period t is i units.

}4,3,2,1,0{∈x

)4()2( ixi −≤≤−

Expected holding cost

Expected salvage value

Page 15: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t<3

}4,3,2,1,0{∈x

)4()2( ixi −≤≤−

Page 16: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Generalization Suppose that possible states during period t+1 are: s1,s2,...,sn

The probability of t+1 states: p1,p2,...pn

Then the minimum expected cost incurred during period t+1,t+2,...:

ft+1(si) is the minimum expected cost incurred from period t +1 to the end of the problem, given that the state during period t + 1 is si.

Page 17: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 3

Page 18: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 2

Page 19: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage 1

Page 20: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Further Examples of Probabilistic Dynamic Programming Formulations

Page 21: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Many probabilistic dynamic programming problems can be solved using recursions:

)(iftthe maximum expected reward that can be earned during stages t, t+ 1, . . ., given that the state at the beginning of stage t is i.

),,\( taijp the probability that the next period’s state will be j, given that the current (stage t) state is i and action ais chosen.

Page 22: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 5: Sunco oil drilling Sunco Oil has D dollars to allocate for drilling at sites 1, 2, . . .

, T. If x dollars are allocated to site t, the probability is qt (x)that oil will be found on site t. Sunco estimates that if site thas any oil, it is worth rt dollars. Formulate a recursion that could be used to enable Sunco to maximize the expected value of all oil found on sites 1, 2, . . . , T.

Page 23: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage: the number of sites Decision: how many dollars to allocate to site t

State : the number of dollars available to allocate to sites t, t+1, . . . , T.

)(dft 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

Page 24: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Assume that: qT(x) is a nondecreasing function of x At stage T, all money should be allocated for site T.

for t<T

Work back until f1(D) is found.

dx ≤≤0

Page 25: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 6: Bass fishing Each year, the owner of a lake must determine how many

bass to capture and sell. During year t, a price pt will be received for each bass that is caught. If the lake contains bbass at the beginning of year t, the cost of capturing x bass is ct (x|b). Between the time that year t’s bass are caught and year t +1 begins, the bass in the lake multiply by a randomfactor D, where P(D = d) = q(d).

Formulate a dynamic programming recursion that can be used to determine a bass catching strategy that will maximize the owner’s net profit over the next ten years. At present, the lake contains 10,000 bass.

Page 26: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage: Year State: The number of bass at the beginning of the year Decision: How many bass to catch during each year.

)(bft the maximum expected net profit that can be earning during year t, t+ 1, . . .10, if b bass are in the lake at the beginning of year t.

Page 27: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t=10

For t<10

Work back until f1(10,000) is computed

bx ≤≤0

bx ≤≤0

new state

Page 28: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 7: Waiting in line When Sally Mutton arrives at the bank, 30 minutes remain

on her lunch break. If Sally makes it to the head of the line and enters service before the end of her lunch break, sheearns reward r. However, Sally does not enjoy waiting in lines, so to reflect her dislike for waiting in line, she incurs a cost c for each minute she waits. During a minute in which npeople are ahead of Sally, there is a probability p(x|n) that xpeople will complete their transactions. Suppose that when Sally arrives, 20 people are ahead of her in line. Use dynamicprogramming to determine a strategy for Sally that will maximize her expected net revenue (reward - waiting costs).

Page 29: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

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 simple: She should stay in line if and only if her expected reward exceeds the cost of waiting for 1 minute (c)

Work backward to a problem with 2 minutes left, and so on.

Page 30: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Define

0 3029t

)(nft the maximum net reward that Sally can receive from time t ,...,lunch break, if at time t, n people are ahead of her.

The beginning of the last minute of the problem

Now

Page 31: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t<29

To determine Sally’s optimal waiting policy, we work backward until f0(20) is computed.

n people leave service Sally is serviced.

k people leave service new state = n-k

Page 32: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 8: Cash management policy E. J. Korvair Department Store is trying to determine an optimal cash

management policy. 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 demand for cash is met by cash left from the previous day plus money withdrawn (or minus 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 incurred. If the ending balance is positive, a cost of i dollars per dollar held is incurred (because 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 expected cost of filling the store’s cash needs for the next 30 days.

Page 33: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage: time

),( cbft : 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 and b dollars in the bank.

x : The amount of money transferred from the bank to the store (x<0 money transferred from the store to the bank).

bxc ≤≤−

≠=

=0 if ,10 if , 0

)(xx

Page 34: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t<30

work backward until f1(10,000, 100,000) has been computed.

new state

interest

shortage

Page 35: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 9: Parking Spaces Robert Blue is trying to find a parking place near his favorite

restaurant. He is approaching the restaurant from the west, and hisgoal is to park as nearby as possible. The available parking placesare pictured in Figure 2. Robert is nearsighted and cannot seeahead; he can only see whether the space he is at now is empty.When Robert arrives at an empty space, he must decide whetherto park there or to continue to look for a closer space. Once hepasses a space, he cannot return to it. Robert estimates that theprobability that space t is empty is pt. If he does not end up with aparking space, he is embarrassed and incurs a cost M (M is a bigpositive number). If he does park in space t, he incurs a cost |t|.Show how Robert can use dynamic programming to develop aparking strategy that minimizes his expected cost.

Page 36: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

If Robert is at space T, his problem is easy to solve: park in space T if it is empty; otherwise, incur a cost of M.

Stage: Space State: Whether the space is empty or not Decision: If a the space is empty, wheter to take the space or

continue.

Page 37: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Define:

If Robert is at space T:

MofT =)(TefT =)(

Page 38: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t<T

Work back until f-T(o) and f-T(e) are computed.

Cost for next stage

Cost in stage t.

Page 39: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Example 10: Safecracker During month t(t 1, 2, . . . , 60), expert safecracker Dirk Stack

knows that he will be offered a role in a bank job that will pay him dt dollars. There is, however, a probability pt that month t’s job will result in his capture. If Dirk is captured, all his money will be lost. Dirk’s goal is to maximize his expected asset position at the end of month 60. Formulate a dynamic programming recursion that will help Dirk accomplish his goal. At the beginning of month 1, Dirk has $50,000.

Page 40: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

Stage: Time Decision: Whether or not to take the current month’s job

offer. State: Amount of money at the beginning of a month

For t=60

)(nft Dirk’s maximum expected asset position at the end of month 60, given that at the beginning of month t, Dirk has d dollars

Page 41: Probabilistic Dynammic Programmingd20uo2axdbh83k.cloudfront.net/20141209/8bf98591e3507a823de4a3e27168e… · Each year, the owner of a lake must determine how many bass to capture

For t<60

Work back untuk f1(50,000) is computed

Captured

Go to next stage