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,

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, the algorithm were to store every visited state and check against that list. (See BREADTH-FIRST-SEARCH in Figure 3.11 for an example.) Determine the information that should be stored and how the algorithm should use that information when a repeated state is found. 


Figure 4.11

function AND-OR-GRAPH-SEARCH(problem) returns a conditional plan, or failure OR-SEARCH(problem.INITIAL-STATE, problem, [


Figure 3.11

function BREADTH-FIRST-SEARCH( problem) returns a solution, or failure node - a node with STATE = problem.INITIAL-STATE,

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

1 Expert Approved Answer
Step: 1 Unlock

See Figure S41 for the adapted algorithm For states that ORSEARCH finds a solution for it records th... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Artificial Intelligence Modern Questions!