Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.

Similar presentations


Presentation on theme: "Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning."— Presentation transcript:

1 Introduction to search Chapter 3

2 Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning algorithms, e.g., can be seen as searching some space of hypothesis

3 Intelligence as search §“The solutions to problems are represented as symbol structures. A physical-symbol system exercises its intelligence in problem- solving by search -- that is, by generating & progressively modifying symbol structures until it produces a solution structure.”

4 The search task §Given l a description of the initial state l list of legal actions preconditions effects l goal test -- tells you if a goal has been reached §Find l an ordered list of actions to perform in order to go from the initial state to the goal

5 Search as a graph §Nodes l search-space states §Directed arcs l legal actions from each state to another §Example §Rather than being given, however, we often build the graph (implicitly) as we go; we aren’t given the graph explicitly

6 Trip as search §State: geographical location (city, street, etc.) §Actions: following a road §Initial state: Madison §Goal state: Minneapolis

7 §The following is the basic outline for the various search algorithms (some steps are modified depending on the specifics of the search, e.g. if doing hill climbing, iterative deepening, or beam search). General Pseudocode for Searching

8 OPEN = { startNode } // Nodes under consideration. CLOSED = { } // Nodes we're done with. while OPEN is not empty { remove an item from OPEN based on search strategy used - call it X if goalState?(X) return the solution found otherwise // Expand node X. { 1) add X to CLOSED 2) generate the immediate neighbors (ie, children of X) 3) eliminate those children already in OPEN or CLOSED 4) add REMAINING children to OPEN } return FAILURE // Failed if OPEN exhausted without a goal being found

9 “Considering” a node §If goal-state?(node) then done else expand(node) l expand = add previously unvisited neighbors / children (states that be gotten to from node by applying the operators) to the OPEN list

10 §Task: find a route from the start node to the goal node §build a tree (try all/many possible paths) §OPEN list allows backtracking from a path that “dies out”; saves other possible ways l nodes under consideration (to be expanded) §CLOSED list prevents us from repeatedly trying a node & ending up in an infinite loop l nodes that have been processed Search algorithm explained

11 General search methods §Given a set of search-space nodes, which one should we consider next? l Youngest [depth-first search] most recently created node l Oldest [breadth-first search] least-recently created node l Best [best-first search] requires a scoring function l Random simulated annealing

12 Implementing search strategies §Breadth l queue: first in, first out l put new nodes at the back of list §Depth l stack: last in, first out l put new nodes at the front of list §Best l priority queue l add new nodes then sort list §The next node to consider is popped off the front of the OPEN list

13 Example of search strategies

14 Search danger: infinite spaces §We must be careful that our search doesn’t go forever l the goal we are looking for may not be in the search space but because the space is infinite we might not know this l the goal may be in the search space but we go down an infinite branch l example

15 BFS tradeoffs §pros l guaranteed to find a solution if it exists l guaranteed to find the shortest solution (in terms of arcs) §cons l OPEN becomes too big [O(b d )] l example

16 DFS tradeoffs §pros l might find solution quickly l needs less space for OPEN [O(b * m)] l example §cons l can get stuck (run forever) in infinite spaces l might not find shortest solution

17 Best-first search tradeoffs §pro l can use domain specific knowledge §con l requires a good heuristic (scoring) function

18 Fixing DFS: iterative deepening §Combines the strengths of breadth- & depth-first search §do DFS but with depth limited to k l if find solution, done (return path, etc.) l else, increment k & start over §don’t save partial solutions from previous iterations; too much memory required §due to exponential growth, most work is at the bottom §guaranteed to find the shortest solution, but OPEN doesn’t get too big (as in BFS)

19 Iterative deepening idea §We do only a little more work overall, but our storage needs are much less l we get the good aspects of BFS -- shortest solution l without the negative aspects -- OPEN list too big

20 Search space examples §Define l state representation (k-rep) l initial state l goal state l operators §Draw search space (if it is small) §Build search Tree


Download ppt "Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning."

Similar presentations


Ads by Google