1 / 60

ISC 4322/6300 – GAM 4322 Artificial Intelligence

ISC 4322/6300 – GAM 4322 Artificial Intelligence. Lecture 2 Solving Problems by Searching Instructor: Alireza Tavakkoli September 3, 2009. University Of Houston- Victoria Computer Science Department. Intelligent Agents. Vacuum-Cleaner World. Performance Measure

ojal
Download Presentation

ISC 4322/6300 – GAM 4322 Artificial Intelligence

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. ISC 4322/6300 – GAM 4322Artificial Intelligence Lecture 2 Solving Problems by Searching Instructor: Alireza Tavakkoli September 3, 2009 University Of Houston- Victoria Computer Science Department

  2. Intelligent Agents

  3. Vacuum-Cleaner World • Performance Measure • Award One Point per Clean Cell Over 1000 Time Step • Environment • Two Cell World • Actions • Left, Right, Suck, NoOp • Percepts • Location and Contents, e.g., [A, Dirty]

  4. Reflex Vacuum Agent Program Sensing input: [Cell Id, Dirty or Not Dirty] Actions: [Clean, move Left, move Right, NoOp] • Advantages • Small Table • Cutting Down the Table Size by Eliminating Percept History • Action Does Not Depend on the Location

  5. Types of Agents

  6. Uninformed Search • Problem Solving Agents • A sequence of actions • Desirable state • Definition • Problem • Solution • Approach • Uninformed search mechanisms • Analysis of algorithms concepts • Asymptotic complexity • NP-completeness

  7. Complexity Analysis • Benchmarking • Run the algorithm and measure • Speed • Memory consumption • Disadvantages • Platform dependent • Need to write the program on a specific machine • Asymptotic analysis • Analysis of the algorithm • Abstract • The input • The implementation • Measure the speed and memory

  8. Example • Consider this • The sequence size = n • The total number of steps • T( n ) = ? • T( n ) = 2n + 2

  9. Analysis of Algorithms • Two difficulties in analyzing algorithms • Hard to find a number to describe the complexity alone • Tworst ( n ) • Tavg( n ) • Algorithm resist exact analysis • Big-O notation • Previous exmaple’s complexity : O ( n ) • Formal definition • Orders

  10. NP-Completeness • O() • Approximation of the complexity of a particular algorithm • Is there a better algorithm for a particular problem? • Complexity analysis • Satisfiablity problems are NP-Complete!

  11. Back to AI • Intelligent agents • Maximize the performance measure • Adopt a goal and aim to achieve it. • Example • Starting in Arad • Goal • Go to Bucharest • The first step in problem solving • Goal formulation

  12. Problem Solving • What is a goal? • A set of world states • What actions to take? • Level of detail • Problem formulation • In our example • Driving to a particular town • States are being in a particular town • Goal • Driving to Bucharest

  13. How to Get to Bucharest? • Get out of Arad • Without more knowledge • Pick randomly • With a map • Compare hypothetical journeys • Solution • Examine different sequences • Lead to states of known values • Pick the best sequence • Search • Input: a problem • Output: action sequences

  14. Formulate, Search, Execute! Static, Observable, Discrete, and Determinist Environment While searching ignores the percepts!

  15. Problem and Solution Definition • Problem Definition • Initial state • Actions • Successor functions • Goal test • Path cost • Step cost • State space • Initial state + Successor function • Path • Sequence of states connected by sequence of actions • Solution • Optimal Solution Romania state space

  16. Problem Formulation • Abstraction • Removing irrelevant details • Valid abstraction

  17. Example Toy Problems • Vacuum world • States • Initial state • Successor function • Goal test • Path cost Vacuum world state space

  18. Example Toy Problems • 8 – Puzzle • States • Initial state • Successor function • Goal test • Path cost • NP-Complete • 9! States • Half unsolvable! 9x8x7x6x5x4x3x2x1 = 9! 9 8 7 6 5 4 3 2 1 Some 8 – Puzzle states

  19. Example Toy Problems • 8 – Queen problem • Incremental formulation • States • Naïve: ~1014 states • Better: 2057 states • Initial state • Successor function • Goal test • Path cost • Complete formulations Almost a solution to 8 – Queen problem

  20. Searching for Solutions • Search tree • Search nodes • Root • Initial state search node • Expansion of states • Applying the successor function Search Strategy

  21. Searching for Solutions • Node representation • State • Parent • Action • Path cost • Depth Fringe Nodes

  22. Queue Implementation • Queue operations • MAKE-QUEUE • EMPTY? • FIRST • REMOVE-FIRST • INSERT • INSERT-ALL • Check the general tree search code • Book p. 72 Queue

  23. Performance Measurement • Performance • Completeness • Optimality • Complexity • Time • Space • Complexity in AI • b • d • m • Search cost • Time it takes to find the solution • Total cost • Search cost + Path cost • Generally convert to the path cost format • What really agent cares about.

  24. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Implementation: • Fringe is a FIFO queue

  25. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Implementation: • Fringe is a FIFO queue

  26. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Implementation: • Fringe is a FIFO queue

  27. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Implementation: • Fringe is a FIFO queue

  28. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Implementation: • Fringe is a FIFO queue

  29. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Performance • Complete? • Yes (if b is finite) • Optimal? • Yes (if cost = 1per step) • Time cost • Space cost

  30. Uninformed Search Strategies • Breath-First Search • Expand shallowest unexpanded node • Space requirements (b=10, 1000 nodes/sec, byte/node)

  31. Uninformed Search Strategies • Uniform-Cost Search • Expand least-cost unexpanded node • Implementation: • Fringe is a FIFO queue ordered by path cost • Equivalent to BFS if cost is equal for all nodes. • Performance • Complete? • Yes (if cost ≠ 0 per step) • Time and space cost • If C* is the optimum cost and is the minimum cost then • Can be much higher than BFS!

  32. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  33. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  34. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  35. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  36. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  37. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  38. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  39. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  40. Uninformed Search Strategies • Depth-First Search • Expand deepest unexpanded node • Implementation: • Fringe is a LIFO queue

  41. Uninformed Search Strategies • Depth-First Search • Expand shallowest unexpanded node • Performance • Complete? • No (in infinite-depth spaces or spaces w/ loops) • Optimal? • No • Time cost • Terrible if m is larger than d ! • Space cost • Linear Space!

  42. Uninformed Search Strategies • Depth-Limited Search • Expand deepest unexpanded node but stop at limit • Properties: • Optimal? • No if limit > d • Complete? • No if limit < d • More knowledge! Cut off limit

  43. Uninformed Search Strategies • Iterative Deepening Search • Depth limited search • Iteratively increase the depth limit; 0, 1, 2, …

  44. Iterative Deepening Search l =0

  45. Iterative Deepening Search l =1

  46. Iterative Deepening Search l =2

  47. Iterative Deepening Search l =3

  48. Iterative Deepening Search • Number of nodes generated in a • depth-limited search to depth d with branching factor b: NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd • iterative deepening search to depth d with branching factor b: NIDS = (d+1)b0 + d b^1 + (d-1)b^2 + … + 3bd-2 +2bd-1 + 1bd • Breath first search to depth d with branching factor b: NBFS = b + b2 + b3 + … + bd +bd+1 – b • For b = 10, d = 5, • NDLS = 1 + 10 + 100 + 1,000 + 10,000 + 100,000 = 111,111 NIDS = 6 + 50 + 400 + 3,000 + 20,000 + 100,000 = 123,456 • NBFS = 10+100+1,000+10,000+100,000+999,990 = 1,111,100 • Overhead • IDS/DLS = (123,456 - 111,111)/111,111 = 11% • IDS/BFS = (1,111,100-123,456)/123,456 = 800%

  49. Iterative Deepening Search Properties • Complete? • Yes • Time? • (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd) • Space? • O(bd) • Optimal? • Yes, if path cost is non-decreasing

  50. Bidirectional Search • Run two searches – one from the initial state • and one backward from the goal. • We stop when the two searches meet. • Motivation: • Time complexity: (b d/2 + b d/2 ) < b d Searching backwards not easy.

More Related