dynamic programming approximation