Post on 12-Jan-2016
description
Dynamic Programming Solutions 1
1) The owner of a chain of three grocery stores has purchased 5 crates of fresh strawberries. The estimated probability distribution of potential sales of the strawberries before spoilage differs among the three stores. Therefore, the owner wants to know how to allocate 5 crates to the three stores to maximize expected profit.
For administrative reasons, the owner does not wish to split crates between stores. However, he is willing to distribute no crates to any of his stores. The following table gives estimated expected profit at each store when it is allocated various numbers of crates.
Crates 1 2 30 0 0 01 5 6 42 9 11 93 14 15 134 17 19 185 21 22 20
Store
Soln:
Let xn = number crates allocated to a store pn(xn) = expected profit from allocating xn crates to store n sn = number of crates remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
Dynamic Programming Solutions 1
1) Crates 1 2 3
0 0 0 01 5 6 42 9 11 93 14 15 134 17 19 185 21 22 20
Store
Soln:
Let xn = number crates allocated to a store pn(xn) = expected profit from allocating xn crates to store n sn = number of crates remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
Dynamic Programming Solutions 1
1) Crates 1 2 3
0 0 0 01 5 6 42 9 11 93 14 15 134 17 19 185 21 22 20
Store
Soln:
Let xn = number crates allocated to a store pn(xn) = expected profit from allocating xn crates to store n sn = number of crates remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
s3 f3*(s3) x3
*
0 0 01 4 12 9 23 13 34 18 45 20 5
Dynamic Programming Solutions 1
1) Crates 1 2 3
0 0 0 01 5 6 42 9 11 93 14 15 134 17 19 185 21 22 20
Store
Soln:
Let xn = number crates allocated to a store pn(xn) = expected profit from allocating xn crates to store n sn = number of crates remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
s3 f3*(s3) x3
*
0 0 01 4 12 9 23 13 34 18 45 20 5
Dynamic Programming Solutions 1
1)
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
s2 0 1 2 3 4 5 f2*(s2) x2
*
0 0 0 01 4 6+0 6 12 9 6+4 11+0 11 23 13 6+9 11+4 15+0 15 1,2,34 18 6+13 11+9 15+4 19+0 20 25 20 6+18 11+13 15+9 19+4 22+0 24 1,2,3
x2
Dynamic Programming Solutions 1
1)
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
s1 0 1 2 3 4 5 f1*(s1) x1
*
5 0+24 5+20 9+15 14+11 17+6 21+0 25 1,3
x1
Optimal Allocation
5 5
4
3
2
1
0
5
4
3
2
1
0 0
Store 1 Store 2 Store 3
Optimal path
Optimal path from a given state
Dynamic Programming Solutions 1
2) A college student has 7 days remaining before final examinations begin in her four courses and she wants to allocate this study time as effectively as possible. She needs at least 1 day on each course, and she likes to concentrate on just one course each day, so she wants to allocate 1, 2, 3, or 4 days to each course. Having recently taken an O.R. course, she decides to use dynamic programming to make the allocations so as to maximize the total grade points.
Soln:
Let xn = number days allocated to a course pn(xn) = grade points earned from allocating xn days to course n sn = number of days remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
Study Days 1 2 3 41 3 5 2 62 5 5 4 73 6 6 7 94 7 9 8 9
Grade Points per Course
7
6
5
4
3
5
4
3
2
Course 1 Course 2 Course 3
Dynamic Programming Solutions 1
2)
Soln:
Let xn = number days allocated to a course pn(xn) = grade points earned from allocating xn days to course n sn = number of days remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
7
6
5
4
3
5
4
3
2
Course 1 Course 2 Course 3 Course 4
4
3
2
1
0s4 f4
*(s4) x4*
1 6 12 7 23 9 34 9 4
Dynamic Programming Solutions 1
2)
Soln:
Let xn = number days allocated to a course pn(xn) = grade points earned from allocating xn days to course n sn = number of days remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
7
6
5
4
3
5
4
3
2
Course 1 Course 2 Course 3 Course 4
4
3
2
1
0
s3 1 2 3 4 f3*(s3) x3
*
2 8 8 13 9 10 10 24 11 11 13 13 35 11 13 14 14 14 3,4
Dynamic Programming Solutions 1
2)
Soln:
Let xn = number days allocated to a course pn(xn) = grade points earned from allocating xn days to course n sn = number of days remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
7
6
5
4
3
5
4
3
2
Course 1 Course 2 Course 3 Course 4
4
3
2
1
0
s2 1 2 3 4 f2*(s2) x2
*
3 13 13 14 15 13 15 15 18 15 14 18 16 19 18 16 17 19 1
Dynamic Programming Solutions 1
2)
Soln:
Let xn = number days allocated to a course pn(xn) = grade points earned from allocating xn days to course n sn = number of days remaining
fn(sn) = max { pn(xn) + fn+1*(sn-xn) }
7
6
5
4
3
5
4
3
2
Course 1 Course 2 Course 3 Course 4
4
3
2
1
0
s1 1 2 3 4 f1*(s1) x1
*
7 22 23 21 20 23 2
Optimal x1* x2* x3* x4*
1 2 1 3 1
Dynamic Programming Solutions 1
3) Consider an electronic system consisting of four components, each of which must work for the system to function. The reliability of the system can be improved by installing several parallel units in one or more components. The following table gives the probability that the respective components will function if they consist of one, two, or three parallel units:
The probability that the system will function is the product of the probabilities that the respective components will function. The cost (in $100’s) of installing 1, 2, or 3 parallel units in the respective components is given by the following table: (total budget = $1,000).
Soln:
Let xn = number parallel units for component n pn(xn) = probability component will function with xn parallel units cn(xn) = cost of installing xn units sn = number of $ in 100’s remaining
fn(sn) = max { pn(xn) * fn+1*(sn-cn(xn) }
Units Comp 1 Comp 2 Comp 3 Comp 41 0.5 0.6 0.7 0.52 0.6 0.7 0.8 0.73 0.8 0.8 0.9 0.9
Probability of Functioning
Units Comp 1 Comp 2 Comp 3 Comp 41 1 2 1 22 2 4 3 33 3 5 4 4
Cost
Dynamic Programming Solutions 1
3)
Soln:
Let xn = number parallel units for component n pn(xn) = probability component will function with xn parallel units cn(xn) = cost of installing xn units sn = number of $ in 100’s remaining
fn(sn) = max { pn(xn) * fn+1*(sn-cn(xn) }
Units Comp 1 Comp 2 Comp 3 Comp 41 0.5 0.6 0.7 0.52 0.6 0.7 0.8 0.73 0.8 0.8 0.9 0.9
Probability of Functioning
Units Comp 1 Comp 2 Comp 3 Comp 41 1 2 1 22 2 4 3 33 3 5 4 4
Cost
s4 f4*(s4) x4
*
0 0 01 0 02 0.5 13 0.7 2
4-10 0.9 3
Dynamic Programming Solutions 1
3)
Soln:
Units Comp 1 Comp 2 Comp 3 Comp 41 0.5 0.6 0.7 0.52 0.6 0.7 0.8 0.73 0.8 0.8 0.9 0.9
Probability of Functioning
Units Comp 1 Comp 2 Comp 3 Comp 41 1 2 1 22 2 4 3 33 3 5 4 4
Cost
s4 f4*(s4) x4
*
0 0 01 0 02 0.5 13 0.7 2
4-10 0.9 3
s3 1 2 3 f3*(s3) x3
*
0 - 0 01 0 0 0,12 0 0 0,13 0.35 0 0.35 14 0.49 0 0 0.49 15 0.63 0.4 0 0.63 16 0.63 0.56 0.45 0.63 17 0.63 0.72 0.63 0.72 2
8-10 0.63 0.72 0.81 0.81 3
Dynamic Programming Solutions 1
3)
Soln:
Units Comp 1 Comp 2 Comp 3 Comp 41 0.5 0.6 0.7 0.52 0.6 0.7 0.8 0.73 0.8 0.8 0.9 0.9
Probability of Functioning
Units Comp 1 Comp 2 Comp 3 Comp 41 1 2 1 22 2 4 3 33 3 5 4 4
Cost
s2 1 2 3 f2*(s2) x2
*
2 0 0 0,13 0 0 0,14 0 0 0 0,1,25 0.21 0 0 0.21 16 0.294 0 0 0.294 17 0.378 0.245 0 0.378 18 0.378 0.343 0.28 0.378 19 0.432 0.441 0.392 0.441 210 0.486 0.441 0.504 0.504 3
s3 1 2 3 f3*(s3) x3
*
0 - 0 01 0 0 0,12 0 0 0,13 0.35 0 0.35 14 0.49 0 0 0.49 15 0.63 0.4 0 0.63 16 0.63 0.56 0.45 0.63 17 0.63 0.72 0.63 0.72 2
8-10 0.63 0.72 0.81 0.81 3
Dynamic Programming Solutions 1
3)
Soln:
Units Comp 1 Comp 2 Comp 3 Comp 41 0.5 0.6 0.7 0.52 0.6 0.7 0.8 0.73 0.8 0.8 0.9 0.9
Probability of Functioning
Units Comp 1 Comp 2 Comp 3 Comp 41 1 2 1 22 2 4 3 33 3 5 4 4
Cost
s2 1 2 3 f2*(s2) x2
*
2 0 0 0,13 0 0 0,14 0 0 0 0,1,25 0.21 0 0 0.21 16 0.294 0 0 0.294 17 0.378 0.245 0 0.378 18 0.378 0.343 0.28 0.378 19 0.432 0.441 0.392 0.441 210 0.486 0.441 0.504 0.504 3
s1 1 2 3 f1*(s1) x1
*
10 0.22 0.227 0.302 0.302 3
Optimal x1* x2* x3* x4*
1 3 1 1 3