Principles of Dynamic Optimization