Stochastic Dynamic Programming Illuminates the Link Between Environment, Physiology, and Evolution