A Dynamic Programming Approach to the Abandonment Decision