Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Question:

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 OR course, she decides to use dynamic programming to
make these allocations to maximize the total grade points to be
obtained from the four courses. She estimates that the alternative
allocations for each course would yield the number of grade points
shown in the following table:

Solve this problem by dynamic programming.

Answer :

The decision variables are the number of study days


to allocate to stages (courses) n. is the number of days still
available for allocation to remaining course . So, at stage-1 that
is course 1, however at stage 2 or 3 (course 2 or 3) the value
will be 7 minus the number of days allocated to course-1. So, the
sequence of states is
Therefore

Beginning with the last stage (course 4), it is known that the values of
are provided in the last column of above table. So and as
shown in the table for below:

n = 4 S 4 f* 4 (s 4 ) X 4 *

0 0 0

1 6 1

2 7 2

3 9 3

4 9 4

5 0 0

6 0 0

7 0 0
Now moved backward to stage , the formula for this stage computation is:

In the above formula, the second term is obtained from above table of while
the first term is the value in the provided table against each variable at provided
stage-3 (course 4).

Proceeding in a similar way for all possible values of yields following table:

n = 3 s 3 / x 3 f 3 (s 3, x 3 ) f* 3 (s 3 ,x 3 ) x 3 *

0 1 2 3 4 5 6 7

0 0 Â Â Â Â Â Â Â 0 0

1 6 2 Â Â Â Â Â Â 6 1

2 7 8 4 Â Â Â Â Â 8 1

3 9 9 10 7 Â Â Â Â 10 2

4 9 11 11 13 8 Â Â Â 13 3

5 0 11 13 14 14 0 Â Â 14 3 or 4

6 0 2 13 16 15 6 0 Â 16 3

7 0 2 4 16 17 7 6 0 17 4

Now for stage , the formula for this stage computation is:
In the above formula, the second term is obtained from above table of while
the

First term is the value in the provided table against each variable at provided stage-
2 (course 2).

Proceeding in a similar way for all possible values of yields following table:

n = 2 s 2 / x 2 f 2 (s 2, x 2 ) f* 2 (s 2 ,x 2 ) x 2 *

0 1 2 3 4 5 6 7

0 0 Â Â Â Â Â Â Â 0 0

1 6 5 Â Â Â Â Â Â 6 0

2 8 11 5 Â Â Â Â Â 11 1

3 10 13 11 6 Â Â Â Â 13 1

4 13 15 13 12 9 Â Â Â 15 1

5 14 18 15 14 15 0 Â Â 18 1

6 16 19 18 16 17 6 0 Â 19 1

7 17 21 19 19 19 8 6 0 21 1

Similarly, at stage , the formula for this stage computation is:


In the above formula, the second term is obtained from above table of while
the first term is the value in the provided table against each variable at provided
stage-1 (store 1).

Proceeding in a similar way for all possible values of yields following table:

n = 1 s 1 / x 1 f 1 (s 1, x 1 ) f* 1 (s 1 ,x 1 ) x 1 *

0 1 2 3 4 5 67Â Â

7 21 22 23 21 20 11 6 0 23 2

So, the possible allocation to the first course is 2. So allocate 2 days to course-1
then there are 5 days remaining for allocation. Now check the value against
in the table and get the value so assign 1 day to second course. So,
there are left with 4 days to be assigned. Check the value against in the table
and get the value so assign 3 days to third course. Now there are left
with 1 day. Since implies that finally assign remaining 1 day to the
fourth course.

You might also like