Flexible control as surrogate reward or dynamic reward maximization