Dynamic programming.pdf

# 2 3 p 4 9 13 1 4 p 2 9 11 14 4 or 3 days to course 3

• 24

This preview shows pages 13–19. Sign up to view the full content.

2 + 3, P = 4 + 9 = 13 1 + 4, P = 2 + 9 = 11 14 , 4 or 3 days to course 3 6 4 + 2, P = 8 + 7 = 15 3 + 3, P = 7 + 9 = 16 2 + 4, P = 4 + 9 = 13 16 , 3 days to course 3 7 4 + 3, P = 8 + 9 = 17 3 + 4, P = 7 + 9 = 16 17 , 4 days to course 3

This preview has intentionally blurred sections. Sign up to view the full version.

Exercise 2: solution For three last stages (course 2, 3 and 4): Courses 3 and 4 2 8 3 10 4 13 5 14 6 16 7 17 Days spent Possibilities (course 2 + rest) The optimal points 3 1 + 2, P = 5 + 8 = 13 13 , 1 day to course 2 4 2 + 2, P = 5 + 8 = 13 1 + 3, P = 5 + 10 = 15 15 , 1 day to course 2 5 3 + 2, P = 6 + 8 = 14 2 + 3, P = 5 + 10 = 15 1 + 4, P = 5 + 13 = 18 18 , 1 day to course 2 6 4 + 2, P = 9 + 8 = 17 3 + 3, P = 6 + 10 = 16 2 + 4, P = 5 + 13 = 18 1 + 5, P = 5 + 14 = 19 19 , 1 day to course 2 7 4 + 3, P = 9 + 10 = 19 3 + 4, P = 6 + 13 = 19 2 + 5, P = 5 + 14 = 19 1 + 6, P = 5 + 16 = 21 21 , 1 day to course 2
Exercise 2: solution The whole problem: Courses 2, 3 and 4 3 13 4 15 5 18 6 19 7 21 Days spent Possibilities (course 2 + rest) The optimal points 7 4 + 3, P = 7 + 13 = 20 3 + 4, P = 6 + 15 = 21 2 + 5, P = 5 + 18 = 23 1 + 6, P = 3 + 19 = 22 23 , 2 days to course 1 The maximum amount of points that can be gained is 23 The optimal time distribution is 2 days to course 1 1 day to course 2 3 days to course 3 1 day to course 4

This preview has intentionally blurred sections. Sign up to view the full version.