Asymptotic properties of optimal trajectories in dynamic programming