// function RECURSIVE-BEST-FIRST-SEARCH(problem) returns a solution, or // failure public List <Action> search(Problem p) { List <Action> actions = new List <Action>(); clearInstrumentation(); // RBFS(problem, MAKE-NODE(INITIAL-STATE[problem]), infinity) Node n = new Node(p.getInitialState()); SearchResult sr = rbfs(p, n, evaluationFunction.f(n), INFINITY, 0); if (sr.getOutcome() == SearchResult.SearchOutcome.SOLUTION_FOUND) { Node s = sr.getSolution(); actions = SearchUtils.actionsFromNodes(s.getPathFromRoot()); setPathCost(s.getPathCost()); } // Empty List can indicate already at Goal // or unable to find valid set of actions return(actions); }