Generalized Planning as Heuristic Search