1 / 15

AI Algorithms

AI Algorithms. Tam Siu Lung, Alan HKOI 2005 (2005-03-05). Prerequisites. Graph Theory Depth First Search Breadth First Search Dijkstra’s Single Source Shortest Path Algorithm Recursion Exhaustion Stack Queue Priority Queue. Itinerary. State Space Search (SSS) Problems

carr
Download Presentation

AI Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AI Algorithms Tam Siu Lung, Alan HKOI 2005 (2005-03-05)

  2. Prerequisites • Graph Theory • Depth First Search • Breadth First Search • Dijkstra’s Single Source Shortest Path Algorithm • Recursion • Exhaustion • Stack • Queue • Priority Queue

  3. Itinerary • State Space Search (SSS) Problems • DFS/BFS/IDS/BDS • A* Search • Constraint Satisfaction Problems (CSP) • Exhaustion strategies • Local Search (Removed)

  4. State Space Search • Graph is modeled by • V: Number of nodes • E: Number of edges • State Space is modeled by • b: Maximum Breadth • d: Maximum Depth • V=? • E=? • State Space Search • Find a path to a goal state (with minimum path cost)

  5. DFS • Tries to simply visit all states • Not optimal • Very little memory • If we want to find the nearest goal, … add initial state while stack not empty get an element u if u is goal, then return u mark u closed for all neighbors v of u if v not closed, add v

  6. BFS • Stores all states around a given depth • We always find the nearest goal • Promise: all states nearer than the solution are visited add initial state while queue not empty get an element u if u is goal, then return u mark u closed for all neighbors v of u if v not closed, add v

  7. IDS • Trade-off space of BFS using time • Note the number of duplicated searches for depth = 0..infinity if DFS(initial, depth) return it

  8. Revision • BFS • Complete and Optimal • Need much memory • DFS • Not Always Complete and Not Optimal • Use very little memory • IDS • Combines goodness of DFS and BFS • A bit more time consuming

  9. Bidirectional BFS • If we really have to use BFS • We wasted a lot of memory anyway • We can do more with them if we only have a single goal state • Search from both sides • When we found a state marked in another side we found the solution

  10. Improving BFS • In BFS, we need to visit all states nearer than optimal • This is to ensure … • Suppose we have spent cost g to reach state u • We know that it is at least cost h from a goal • And we know a goal state v withg < cost < g + h • Can we claim that this is nearest goal without expanding state u?

  11. Really there • Suppose for all nodes not expanded • We know they are at least f away from nearest goal • And we found a goal with cost <= f • What we features of f we need? • f >= g • f < g + real cost to goal (no over-estimation) • What will happen if over-estimated?

  12. A* Search • Use a heuristic to estimate the remaining path cost • h(x) >= 0 for all x • h(x) = 0 for all goal x • Choose the state with minimum total cost f(x) = g(x) + h(x) • Terminate if the selected (not those found) state x has h(x) = 0 • Optimal and Complete • Cost = number of states with f(x) < g(goal)

  13. The Algorithm add initial state while priority queue not empty get an element u with minimum f if u is goal, then return u mark u closed for all neighbors v of u if v not closed, add v

  14. Search Algorithm Hierarchy • Best first search: choose the node with minimum f(x) = g(x) + h(x) • A search: h(x) >= 0 and h(x) = 0 at goal • A* search: h(x) <= h(x) • Uniform cost search: h(x) ≡ 0, e.g. Dijkstra • Breadth first search: g(x) = d(x) • Depth first search: h(x) = –g(x)

  15. Variants • RBFS • IDA* • MA* • SMA*

More Related