Question: The AND-OR-GRAPH-SEARCH algorithm in Figure 4.11 checks for repeated states only on the path from the root to the current state. Suppose that, in addition,
Figure 4.11

Figure 3.11

function AND-OR-GRAPH-SEARCH(problem) returns a conditional plan, or failure OR-SEARCH(problem.INITIAL-STATE, problem, []) function OR-SEARCH(state, problem, path) returns a conditional plan, or failure if problem.GOAL-Test(state) then return the empty plan if state is on path then return failure for each action in problem.ACTIONS(state) do plan - AND-SEARCH(RESULTS(state, action), problem, [state | path]) if plan + failure then return [action | plan] return failure function AND-SEARCH(states, problem, path) returns a conditional plan, or failure for each s; in states do plan; - OR-SEARCH($;, problem, path) if plan; = failure then return failure return [if s1 then plan, else if s2 then plan, else ...if sn-1 then plann-1 else plan,] function BREADTH-FIRST-SEARCH( problem) returns a solution, or failure node - a node with STATE = problem.INITIAL-STATE, PATH-COST = 0 if problem.GOAL-TEST(node.STATE) then return SOLUTION(node) frontier - a FIFO queue with node as the only element explored an empty set loop do if EMPTY?(frontier) then return failure node - POP( frontier) * chooses the shallowest node in frontier */ add node.STATE to erplored for each action in problem.ACTIONS(node.STATE) do child CHILD-NODE(problem, ode, action) if child.STATE is not in explored or frontier then if problem.GOAL-TEST(child.STATE) then return SOLUTION(child) frontier INSERT(child, frontier)
Step by Step Solution
3.48 Rating (171 Votes )
There are 3 Steps involved in it
See Figure S41 for the adapted algorithm For states that ORSEARCH finds a solution for it records th... View full answer
Get step-by-step solutions from verified subject matter experts
