Dynamic Programming Foundations and Principles