Approximate Dynamic Programming for Stochastic N-Stage Optimization with Application to Optimal Consumption under Uncertainty