Pātuhitia tēnei: Nonlinear and dynamic programming