Optimal hibernation theory