The GENERAL-SEARCH algorithm consists of three steps: goaltest, generate, and or
ID: 3613438 • Letter: T
Question
The GENERAL-SEARCH algorithm consists of three steps: goaltest, generate, and ordering! function, in that order. It seems a shame to generate a nodethat is in fact a solution, but to fail to| recognize it because the ordering function fails to place itfirst. a. Write a version of GENERAL-SEARCH that tests each node assoon as it is generated and| stops immediately if it has found a goal. b. Show how the GENERAL-SEARCH algorithm can be used unchangedto do this by giving it| the proper ordering function. The GENERAL-SEARCH algorithm consists of three steps: goaltest, generate, and ordering! function, in that order. It seems a shame to generate a nodethat is in fact a solution, but to fail to| recognize it because the ordering function fails to place itfirst. a. Write a version of GENERAL-SEARCH that tests each node assoon as it is generated and| stops immediately if it has found a goal. b. Show how the GENERAL-SEARCH algorithm can be used unchangedto do this by giving it| the proper ordering function. The GENERAL-SEARCH algorithm consists of three steps: goaltest, generate, and ordering! function, in that order. It seems a shame to generate a nodethat is in fact a solution, but to fail to| recognize it because the ordering function fails to place itfirst. a. Write a version of GENERAL-SEARCH that tests each node assoon as it is generated and| stops immediately if it has found a goal. b. Show how the GENERAL-SEARCH algorithm can be used unchangedto do this by giving it| the proper ordering function.Explanation / Answer
Dear.. a)From the flexibility of the search algorithm.
functionGeneral-Search-New(problem, Queuing-FN) returns asolution, or failure nodes ß Make-Queue(MAKE-NODE(INITIAL STATE[problem]) ) loop do if nodes is empty then returnfailure nodeß REMOVE-FRONT(nodes) new-node ß EXPAND(node, OPERATORS[problem]) ifGOAL-TEST[problem] applied to the STATE of any ofnew-nodes succeedsthen return that node nodesß QUEUING-FN-FRONT(nodes, new-nodes) end end (b)
We could just call the original GENERAL-SEARCH with a queuingfunction that includes a call to the goal test function. If a nodepasses the goal test, it is placed at the very front of the queue;otherwise it is placed at the “normal” position.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.