Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 1.35 KB

Hierarchical-Search.md

File metadata and controls

18 lines (16 loc) · 1.35 KB

HIERARCHICAL-SEARCH

AIMA3e

function HIERARCHICAL-SEARCH(problem, hierarchy) returns a solution, or failure
frontier ← a FIFO queue with [Act] as the only element
loop do
   if EMPTY?(frontier) then return failure
   plan ← POP(frontier) /* chooses the shallowest plan in frontier */
   hla ← the first HLA in plan, or null if none
   prefix,suffix ← the action subsequences before and after hla in plan
   outcome ← RESULT(problem.INITIAL-STATE, prefix)
   if hla is null then /* so plan is primitive and outcome is its result */
     if outcome satisfies problem.GOAL then return plan
   else for each sequence in REFINEMENTS(hla, outcome, hierarchy) do
     frontier ← INSERT(APPEND(prefix, sequence, suffix), frontier)


Figure ?? A breadth-first implementation of hierarchical forward planning search. The initial plan supplied to the algorithm is [Act]. The REFINEMENTS function returns a set of action sequences, one for each refinement of the HLA whose preconditions are satisfied by the specified state, outcome.