DYNAMIC
PROGRAMMING
Prototype example
Stagecoach problem
Stagecoach problem
Fortune seeker that wants to go from Missouri to
California in the mid-19th century.
Possible routes shown in the figure of next page.
Travel has 4 stages. A is Missouri and J is California.
Cost is the life insurance of a specific route; lowest
cost is equivalent to a safest trip.
229
Costs
230
228
231
232
Formulation
Formulation
where
fn (s , x n ) = immediate cost (stage n) + minimum future cost (stages n+1 onward)
= c sxn + fn+ 1 ( x n )
xn
233
Solution procedure
234
Stage n = 3
Needs a few calculations. If fortune seeker is in state F,
he can go to either H or I with costs cF,H = 6 or cF,I = 3.
Choosing H, the minimum additional cost is f4*(H) = 3.
Total cost is 6 + 3 = 9.
Choosing I, the total cost is 3 + 4 = 7. This is smaller,
and it is the optimal choice for state F.
f4*(s)
x4*
F
3
235
Stage n = 3
x3
f3*(s)
x3*
237
7
2
C
4
236
Stage n = 2
F
G
6
238
Stage n = 2
Stage n = 1
x2
f2*(s)
x2*
11
11
12
11
E or F
10
11
E or F
239
Optimal solution
x1
A
f1*(s)
11
x1*
C or D
240
Characteristics of DP
241
Characteristics of DP
242
Characteristics of DP
243
244
Characteristics of DP
Characteristics of DP
245
Characteristics of DP
7.
xn
246
xn
f ( sn ) = fn ( sn , x )
Joo Miguel da Costa Sousa / Alexandra Moutinho
247
Characteristics of DP
248
xn
N = number of stages.
n = label for current stage (n = 1,2, , N ).
sn
Characteristics of DP
(cont.) Notation:
*
n
fn(sn, xn)
fn* (sn )
x n*
250
0
50
45
20
70
45
70
90
75
80
105
110
100
120
150
130
251
States to be considered
Overall problem
pi(xi): measure of performance from allocating xi
medical teams to country i.
Thousands of additional
person-years of life
Country
Medical
teams
45
20
50
70
45
70
90
75
80
105
110
100
120
150
130
252
Maximize
p ( x ),
i
i =1
subject to
3
= 5,
i =1
253
Policy
fn* ( sn ) = max
xn =0,1 ,,sn
*
3
254
{p ( x ) + f
n
*
n +1
( sn x n )} , for n = 1,2
Country
f (s3 ) = max p3 ( x 3 )
x n =0,1,,s3
Thousands of additional
person-years of life
255
Medical
teams
0
50
n = 3:
s3
f3*(s3)
x3*
50
70
45
20
70
45
70
80
90
75
80
100
130
105
110
100
120
150
130
256
Stage n = 2
Stage n = 2
Country
Medical
teams
45
20
50
70
45
70
90
75
80
105
110
100
120
150
130
n=2:
50
20
State: 2
s1
x1
5
50
20
70
70
45
80
90
95
75
100
100
115
125
110
130
120
125
145
160
150
f2*(s2)
x2*
50
70
0 or 1
95
125
160
258
...
125
45
20
50
70
45
70
90
75
80
160
n=1:
257
Stage n = 1
45
x2
70
State: 5
s2
45
120
105
110
100
120
150
130
f1*(s1)
x1*
160
170
165
160
155
120
170
259
260
261
State:
sn
n+1
xn
sn xn
262
Example
Distributing scientists to research teams
3 teams are solving engineering problem to safely fly
people to Mars.
2 extra scientists reduce the probability of failure.
Probability of failure
Team
New scientists
0.40
0.60
0.80
0.20
0.40
0.50
0.15
0.20
0.30
263