Search algorithms (Maze Problem)

14

Transcript of Search algorithms (Maze Problem)

Page 1: Search algorithms (Maze Problem)
Page 2: Search algorithms (Maze Problem)

Uninformed Informed

Breadth-First

Depth-First

Dijkstra

Bidirectional

Best-First

A*

Page 3: Search algorithms (Maze Problem)
Page 4: Search algorithms (Maze Problem)

function findPath(Node start_position, Node goal)add start_position to DataStructurewhile the DataStructure is not emptyChoose a node off the DataStructure, call it "item" Mark item as visited // make sure we don't search it againif “item” is the goal node, end the searchElse generate the 4 successors to itemset the parent of each successor to "item" // this is so we can backtrack our final solution for each successor Add it to the DataStructure // So we can search this nodeendendif we have a goal node, look at its ancestry to find the path (node->parent->parent->parent..., etc) if not, the queue was empty and we didn't find a path :^\end

Page 5: Search algorithms (Maze Problem)

Uninformed Search

Page 6: Search algorithms (Maze Problem)

Breadth-First

Queue DataStructure

Pop a node of a queue (FIFO)

Page 7: Search algorithms (Maze Problem)

Bidirectional

2 X BFS

=

Page 8: Search algorithms (Maze Problem)

Depth-First

Stack DataStructure

Pop a node of a Stack (LIFO)

Page 9: Search algorithms (Maze Problem)

Dijkstra

List DataStructurePriority Queue

Node with Minimum cost

Page 10: Search algorithms (Maze Problem)

Dijkstra = BFS ?

Page 11: Search algorithms (Maze Problem)

Informed Search

Page 12: Search algorithms (Maze Problem)

Best-First (Greedy)

List DataStructure

Node with Minimum Heuristic

Page 13: Search algorithms (Maze Problem)

Wouldn’t it be nice To

combine the best ofDijkstra and Greedy

Page 14: Search algorithms (Maze Problem)

A*

List DataStructure

Node with Minimum F(n)F(n) = g(n) + h(n)