Guest User

Untitled

a guest
Oct 11th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function Tree-Search(problem, fringe) return a solution, or failure
  2. fringe <- Insert(Make-Node(Initial-State[problem]), fringe)
  3. loop do
  4. if fringe is empty then return failure
  5. node <- Remove-Front(fringe)
  6. if Goal-Test(problem, State(node)) then return node
  7. fringe <- InsertAll(Expand(node, problem), fringe)
  8.  
  9. function Expand(node, problem) returns a set of nodes
  10. successors <- the empty set
  11. for each action, result in Successor-Fn(problem, State[node]) do
  12. s <- a new Node
  13. Parent-Node[s] <- node
  14. Action[s] <- action
  15. State[s] <- result
  16. Path-Cost[s] <- Path-Cost[node] + Step-Cost(node, action, s)
  17. Depth[s] <- Depth[node] + 1
  18. add s to successors
  19. return successors
Advertisement
Add Comment
Please, Sign In to add comment