Pātuhitia tēnei: The Mathematical theory of Optimal processes.