Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Tree-Search(problem, fringe) return a solution, or failure
- fringe <- Insert(Make-Node(Initial-State[problem]), fringe)
- loop do
- if fringe is empty then return failure
- node <- Remove-Front(fringe)
- if Goal-Test(problem, State(node)) then return node
- fringe <- InsertAll(Expand(node, problem), fringe)
- function Expand(node, problem) returns a set of nodes
- successors <- the empty set
- for each action, result in Successor-Fn(problem, State[node]) do
- s <- a new Node
- Parent-Node[s] <- node
- Action[s] <- action
- State[s] <- result
- Path-Cost[s] <- Path-Cost[node] + Step-Cost(node, action, s)
- Depth[s] <- Depth[node] + 1
- add s to successors
- return successors
Advertisement
Add Comment
Please, Sign In to add comment