Search Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001
Administration <ul><li>Short written homeworks each week </li></ul><ul><li>First one today </li></ul><ul><li>Web page is u...
What’s AI? (to me) <ul><li>Computers making decisions in real-world problems </li></ul>apply formulate solve
Search Problems <ul><li>Let  S  be the set of states (strings) </li></ul><ul><li>Input: </li></ul><ul><li>Initial state: s...
Search Answer <ul><li>s 1 ,…,s n  such that: </li></ul><ul><li>s 1 ,…,s n     S </li></ul><ul><li>for all 1  i  n, s i ...
Examples <ul><li>We’re very impressed.  Meaning? </li></ul><ul><li>Rush Hour </li></ul><ul><li>8-puzzle </li></ul><ul><li>...
Rush Hour <ul><li>Move cars forward and backward to “escape” </li></ul>
Search Version <ul><li>States: configurations of cars </li></ul><ul><li>N(s): reachable </li></ul><ul><li>states </li></ul...
8-puzzle <ul><li>Slide tiles into order </li></ul><ul><li>States: </li></ul><ul><li>N(s): </li></ul><ul><li>G(s): </li></u...
Logistics <ul><li>Very sophisticated.  What goes where when? </li></ul><ul><li>Desert Storm logistics “paid for AI researc...
8 Queens Puzzle <ul><li>No captures </li></ul><ul><li>States: </li></ul><ul><li>N(s): </li></ul><ul><li>G(s): </li></ul>
Logic Puzzles <ul><li>Jody, who is an ape, wasn’t the ape who returned immediately after Tom and immediately before the an...
Job-Shop Scheduling <ul><li>Industrial problem: </li></ul><ul><li>Allocate machines and machinists to time slots </li></ul...
Search Template <ul><li>fringe = {(s 0 , 0)};  /* initial cost */ </li></ul><ul><li>markvisited(s 0 ); </li></ul><ul><li>W...
Data Structures <ul><li>How implement this efficiently? </li></ul><ul><li>removemincost-U-empty? </li></ul><ul><li>markvis...
Vary Cost <ul><li>How does search behavior change with cost? </li></ul><ul><li>cost(s’) = c + 1 </li></ul><ul><li>cost(s’)...
Grid Example: BFS s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G
Grid Example: DFS s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G
How Evaluate? <ul><li>What makes one search scheme better than another? </li></ul><ul><ul><li>Completeness: Find solution?...
Depth vs. Breadth-first <ul><li>Let |T(s)|    b (branching factor), goal at depth d </li></ul><ul><li>How implement prior...
BFS <ul><li>Completeness? </li></ul><ul><ul><li>Yes </li></ul></ul><ul><li>Time complexity? </li></ul><ul><ul><li>O(b d ) ...
DFS <ul><li>Completeness? </li></ul><ul><ul><li>Yes, assuming state space finite </li></ul></ul><ul><li>Time complexity? <...
Depth-limited Search <ul><li>DFS, only expand nodes depth    l.  </li></ul><ul><li>Completeness? </li></ul><ul><ul><li>No...
Iterative Deepening <ul><li>Depth limited, increasing l.  </li></ul><ul><li>Completeness? </li></ul><ul><ul><li>Yes.   </...
Bidirectional Search <ul><li>BFS in both directions </li></ul><ul><li>Need N -1 </li></ul><ul><li>How could this help? </l...
Which do you choose? <ul><li>8-queens, neighbors of s add one queen to board </li></ul>
Which do you choose? <ul><li>Big grid, goal nearby </li></ul>
What to Learn <ul><li>How to express problems in the search framework </li></ul><ul><li>The basic algorithms for search </...
Homework 1 (due 9/26) <ul><li>1. Send your email address (right away) to  littman@ cs . </li></ul><ul><li>2. Let BFS’ and ...
Upcoming SlideShare
Loading in …5
×

Search

383 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
383
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Search

  1. 1. Search Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001
  2. 2. Administration <ul><li>Short written homeworks each week </li></ul><ul><li>First one today </li></ul><ul><li>Web page is up with first lecture </li></ul><ul><li>Send me ( [email_address] ) your email address so I can make a mailing list </li></ul><ul><li>Office hours… </li></ul>
  3. 3. What’s AI? (to me) <ul><li>Computers making decisions in real-world problems </li></ul>apply formulate solve
  4. 4. Search Problems <ul><li>Let S be the set of states (strings) </li></ul><ul><li>Input: </li></ul><ul><li>Initial state: s 0 </li></ul><ul><li>Neighbor generator, N: S  2 S </li></ul><ul><li>Goal function, G: S  {0,1} </li></ul>
  5. 5. Search Answer <ul><li>s 1 ,…,s n such that: </li></ul><ul><li>s 1 ,…,s n  S </li></ul><ul><li>for all 1  i  n, s i  N(s i-1 ) </li></ul><ul><li>G(s n )  1 </li></ul>
  6. 6. Examples <ul><li>We’re very impressed. Meaning? </li></ul><ul><li>Rush Hour </li></ul><ul><li>8-puzzle </li></ul><ul><li>Logistics </li></ul><ul><li>8-queens problem </li></ul><ul><li>Logic puzzles </li></ul><ul><li>Job-shop scheduling </li></ul>
  7. 7. Rush Hour <ul><li>Move cars forward and backward to “escape” </li></ul>
  8. 8. Search Version <ul><li>States: configurations of cars </li></ul><ul><li>N(s): reachable </li></ul><ul><li>states </li></ul><ul><li>G(s): 1 if red </li></ul><ul><li>car at gate </li></ul>
  9. 9. 8-puzzle <ul><li>Slide tiles into order </li></ul><ul><li>States: </li></ul><ul><li>N(s): </li></ul><ul><li>G(s): </li></ul>6 4 2 7 8 1 3 5 6 4 2 7 8 1 3 5 6 4 2 7 8 1 3 5 6 2 7 8 1 3 5 6 4 2 7 8 1 3 1 2 3 5 6 8 7
  10. 10. Logistics <ul><li>Very sophisticated. What goes where when? </li></ul><ul><li>Desert Storm logistics “paid for AI research” </li></ul>
  11. 11. 8 Queens Puzzle <ul><li>No captures </li></ul><ul><li>States: </li></ul><ul><li>N(s): </li></ul><ul><li>G(s): </li></ul>
  12. 12. Logic Puzzles <ul><li>Jody, who is an ape, wasn’t the ape who returned immediately after Tom and immediately before the animal who appeared in the movie with no rating. </li></ul><ul><li>The only lions that were used in the movies were the one who was the third to return, the one who appeared in the R movie, and the one who appeared in “Luck”. … </li></ul>
  13. 13. Job-Shop Scheduling <ul><li>Industrial problem: </li></ul><ul><li>Allocate machines and machinists to time slots </li></ul><ul><li>Constraints on orders in which parts are serviced </li></ul>
  14. 14. Search Template <ul><li>fringe = {(s 0 , 0)}; /* initial cost */ </li></ul><ul><li>markvisited(s 0 ); </li></ul><ul><li>While (1) { </li></ul><ul><ul><li>If empty(fringe), return failure; </li></ul></ul><ul><ul><li>(s, c) = removemincost(fringe); </li></ul></ul><ul><ul><li>If G(s) return s; </li></ul></ul><ul><ul><li>Foreach s’ in N(s) </li></ul></ul><ul><ul><li>if unvisited(s’) </li></ul></ul><ul><ul><li>fringe = fringe U {(s’, cost(s’)}; </li></ul></ul><ul><ul><li>markvisited(s 0 ); </li></ul></ul><ul><li>} </li></ul>
  15. 15. Data Structures <ul><li>How implement this efficiently? </li></ul><ul><li>removemincost-U-empty? </li></ul><ul><li>markvisited-unvisited? </li></ul>
  16. 16. Vary Cost <ul><li>How does search behavior change with cost? </li></ul><ul><li>cost(s’) = c + 1 </li></ul><ul><li>cost(s’) = c - 1 </li></ul>
  17. 17. Grid Example: BFS s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G
  18. 18. Grid Example: DFS s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G s 0 G
  19. 19. How Evaluate? <ul><li>What makes one search scheme better than another? </li></ul><ul><ul><li>Completeness: Find solution? </li></ul></ul><ul><ul><li>Time complexity: How long? </li></ul></ul><ul><ul><li>Space complexity: Memory? </li></ul></ul><ul><ul><li>Optimality: Find shortest path? </li></ul></ul>
  20. 20. Depth vs. Breadth-first <ul><li>Let |T(s)|  b (branching factor), goal at depth d </li></ul><ul><li>How implement priority queue? </li></ul><ul><li>Completeness? </li></ul><ul><li>Time complexity? </li></ul><ul><li>Space complexity? </li></ul><ul><li>Optimality? </li></ul>
  21. 21. BFS <ul><li>Completeness? </li></ul><ul><ul><li>Yes </li></ul></ul><ul><li>Time complexity? </li></ul><ul><ul><li>O(b d ) </li></ul></ul><ul><li>Space complexity? </li></ul><ul><ul><li>O(b d )  </li></ul></ul><ul><li>Optimality? </li></ul><ul><ul><li>yes </li></ul></ul>
  22. 22. DFS <ul><li>Completeness? </li></ul><ul><ul><li>Yes, assuming state space finite </li></ul></ul><ul><li>Time complexity? </li></ul><ul><ul><li>O(| S |), can do well if lots of goals </li></ul></ul><ul><li>Space complexity? </li></ul><ul><ul><li>O(n), n deepest point of search </li></ul></ul><ul><li>Optimality? </li></ul><ul><ul><li>No  </li></ul></ul>
  23. 23. Depth-limited Search <ul><li>DFS, only expand nodes depth  l. </li></ul><ul><li>Completeness? </li></ul><ul><ul><li>No, if l  d.  </li></ul></ul><ul><li>Time complexity? </li></ul><ul><ul><li>O(b l ) </li></ul></ul><ul><li>Space complexity? </li></ul><ul><ul><li>O(l) </li></ul></ul><ul><li>Optimality? </li></ul><ul><ul><li>No  </li></ul></ul>
  24. 24. Iterative Deepening <ul><li>Depth limited, increasing l. </li></ul><ul><li>Completeness? </li></ul><ul><ul><li>Yes.  </li></ul></ul><ul><li>Time complexity? </li></ul><ul><ul><li>O(b d ), even with repeated work!  </li></ul></ul><ul><li>Space complexity? </li></ul><ul><ul><li>O(d)  </li></ul></ul><ul><li>Optimality? </li></ul><ul><ul><li>Yes  </li></ul></ul>
  25. 25. Bidirectional Search <ul><li>BFS in both directions </li></ul><ul><li>Need N -1 </li></ul><ul><li>How could this help? </li></ul><ul><ul><li>b l vs 2b l/2 </li></ul></ul><ul><li>What makes this hard to implement? </li></ul>
  26. 26. Which do you choose? <ul><li>8-queens, neighbors of s add one queen to board </li></ul>
  27. 27. Which do you choose? <ul><li>Big grid, goal nearby </li></ul>
  28. 28. What to Learn <ul><li>How to express problems in the search framework </li></ul><ul><li>The basic algorithms for search </li></ul><ul><li>Strengths and weaknesses of the basic algorithms </li></ul>
  29. 29. Homework 1 (due 9/26) <ul><li>1. Send your email address (right away) to littman@ cs . </li></ul><ul><li>2. Let BFS’ and DFS’ be versions of BFS and DFS that don’t check whether a state has been previously visited. Evaluate BFS’ and DFS’ on the four comparison criteria we discussed. </li></ul><ul><li>3. Consider the Rush Hour board from these notes. Assume a single move consists of sliding a car forward or backward some number of spaces. (a) Give an upper bound on the branching factor. (b) Assuming the solution is at depth 20, how many nodes will be searched? (c) Ignoring the search, how many states are in the search space? Give as tight an upper bound as you can. </li></ul>

×