An Efficient Algorithm for Dynamic Programming in Partially Observable Markov Decision Processes