0% found this document useful (0 votes)
16 views5 pages

Dynamic Programming

The document contains 4 tables that calculate optimal resource allocations to maximize benefits for 3 users (R1, R2, R3) based on their ratings of resources in Table 1. Table 2 calculates f3(S3) to find the maximum rating for each level of resource S3 allocated to R3. Table 3 similarly calculates f2(S2) to find the maximum for each level of S2 allocated to R2. Table 4 calculates f1(S1) to find the maximum overall benefit by allocating resources S1 to R1, S2 to R2, and S3 to R3. The optimal allocation is found to be X1=2 for R1, X2=0 for
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Dynamic Programming

The document contains 4 tables that calculate optimal resource allocations to maximize benefits for 3 users (R1, R2, R3) based on their ratings of resources in Table 1. Table 2 calculates f3(S3) to find the maximum rating for each level of resource S3 allocated to R3. Table 3 similarly calculates f2(S2) to find the maximum for each level of S2 allocated to R2. Table 4 calculates f1(S1) to find the maximum overall benefit by allocating resources S1 to R1, S2 to R2, and S3 to R3. The optimal allocation is found to be X1=2 for R1, X2=0 for
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Table 1 from the question

Xj R1 (X 1) R2 ( X 2) R3 ( X 3)
0 0 0 0
1 2 1 1
2 5 3 4
3 6 6 5
4 7 7 8

Solution

To complete Table 2, calculation of f 3 (S 3 ) from the equation below


f 3 ( S 3 )=¿ max (R3 ( X 3 ) )
X3
0 ≤ X 3 ≤ S3

When
S3=0⇒ X 3=0
Then X 3 =0
R3 ( X 3 )
R3 ( 0 )=0 from table 1

When
S3=1 ⇒ X 3=0 , 1
Then X 3 =0 X 3 =1
R3 ( X 3 ) R3 ( X 3 )
R3 ( 0 )=0 R3 ( 1 )=1
When
S3=2⇒ X 3=0 , 1 ,2
Then X 3 =0 X 3 =1 X 3 =2
R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 )
R3 ( 0 )=0 R3 ( 1 )=1 R3 ( 2 )=4

When
S3=3 ⇒ X 3=0 , 1 , 2, 3
Then X 3 =0 X 3 =1 X 3 =2 X 3 =3
R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 )
R3 ( 0 )=0 R3 ( 1 )=1 R3 ( 2 )=4 R3 ( 3 )=5

When
S3=3 ⇒ X 3=0 , 1 , 2, 3 , 4
Then X 3 =0 X 3 =1 X 3 =2 X 3 =3 X 3 =4
R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 ) R3 ( X 3 )
R3 ( 0 )=0 R3 ( 1 )=1 R3 ( 2 )=4 R3 ( 3 )=5 R3 ( 4 )=8

Table 2
¿
State R 3 ( X 3) f 3 (S 3 ) (X 3)

S3 X 3: 0 1 2 3 4

0 0 0 0
1 0 1 1 1
2 0 1 4 4 2
3 0 1 4 5 5 3
4 0 1 4 5 8 8 4

To complete Table 3 calculation of f 2 (S 2) from the equation below


f 2 ( S 2) =¿ max (R2 ( X 2 ) + f 3 (S3 ))
X2
0 ≤ X 2 ≤ S2
S3=S 2−X 2

When
S2=0⇒ X 2=0
Then X 2 =0
R2 ( X 2 ) + f 3 (S 3)
R2 ( X 2 ) + f 3 (S 2−X 2)
R2 ( X 2 ) + f 3 (0−0)
R2 ( 0 ) +f 3 (0)
0+ 0=0

When
S2=1 ⇒ X 2=0 , 1
Then X 2 =0 X 2 =1
R2 ( X 2 ) + f 3 (S 3) R2 ( X 2 ) + f 3 (S 3)
R2 ( X 2 ) + f 3 ( S 2−X 2 ) R2 ( X 2 ) + f 3 ( S 2−X 2 )
R2 ( X 2 ) + f 3 (1−0) R2 ( X 2 ) + f 3 (1−1)
R2 ( 0 ) +f 3 (1) R2 ( 1 ) + f 3 (0)
0+1=1 1+0=1

When
S2=2 ⇒ X 2=0 , 1 ,2
Then X 2 =0 X 2 =1 X 2 =2
R2 ( X 2 ) + f 3 (S 3) R2 ( X 2 ) + f 3 (S 3) R2 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3+ 4=7

X 2 =3 X 2 =4
R2 ( X 2 ) + f 3 (S 3) R2 ( X 2 ) + f 3 (S 3)
R2 ( X 2 ) + f 3 ( S 2−X 2 ) R2 ( X 2 ) + f 3 ( S 2−X 2 )
R2 ( X 2 ) + f 3 (4−3) R2 ( X 2 ) + f 3 (4−4)
R2 ( 3 ) + f 3 (1) R2 ( 4 ) + f 3 (0)
6+1=7 7+0=7
Table 3
¿
State R2 ( X 2 ) + f 3 (S 3) f 2 (S 2) (X 2)

S2 X 2: 0 1 2 3 4

0 0 0 0
1 1 1 1 0
2 4 2 3 4 0
3 5 5 4 6 6 3
4 8 6 7 7 7 8 0

To complete Table 4 calculation of f 1 (S 1) from the equation below


f 1 ( S1 ) =¿ max (R1 ( X 1 ) + f 2 (S2 ))
X1
0 ≤ X 1 ≤ S1

S2=S 1−X 1
S1=Q=4

When
S1=4 ⇒ X 1=0 , 1, 2 , 3 , 4
Then X 1 =0 X 1 =1 X 1 =2
R1 ( X 1 ) +f 2(S 2) R1 ( X 1 ) +f 2(S 2) R1 ( X 1 ) +f 2(S 2)
R1 ( X 1 ) +f 2 ( Q−X 1 ) R1 ( X 1 ) +f 2 ( Q−X 1 ) R1 ( X 1 ) +f 2 ( Q−X 1 )
R1 ( X 1 ) +f 2(4−0) R1 ( X 1 ) +f 2(4−1) R1 ( X 1 ) +f 2(4−2)
R1 ( 0 ) + f 2 (4) R1 ( 1 ) + f 2 (3) R1 ( 2 ) + f 2 (2)
0+ 8=8 2+6=8 5+ 4=9

X 1 =3 X 1 =4
R1 ( X 1 ) +f 2(S 2) R1 ( X 1 ) +f 2(S 2)
R1 ( X 1 ) +f 2 ( Q−X 1 ) R1 ( X 1 ) +f 2 ( Q−X 1 )
R1 ( X 1 ) +f 2(4−3) R1 ( X 1 ) +f 2(4−4 )
R1 ( 3 ) + f 2 (1) R1 ( 4 ) + f 2 (0)
6+1=7 7+0=7

Table 4
¿
State R2 ( X 2)+f 2 (Q−X 1 ) f 1 (Q) (X 1)
S2 X 2: 0 1 2 3 4

4 8 8 9 7 7 9 2

From table 4
the maximum net benefit f 1 (Q) = 9
¿
The allocation X 1 that gives max = 2

From table 3
The maximum net benefit f 2 (Q) = 8
¿
The allocation X 2 that gives max = 0

From table 2
The maximum net benefit f 3 (Q) = 8
¿
The allocation X 3 that gives max = 4

Hence for optimal benefit X 1 =2 should be allocated to user 1, X 2 =0 should be allocated to user 2,
X 3 = 4 should be allocated to user 3.

You might also like