Generalized best-first search strategies and the optimality of A*