Chapter 6, Dynamic Programming