1 / 33

Introduction to Artificial Intelligence (G51IAI)

Introduction to Artificial Intelligence (G51IAI). Dr Rong Qu Blind Searches - Introduction. Aim of This Section. Introduce the blind searches on search tree Specifically, the “general search pseudo-code” in Russell/Norvig (AIMA) and in the course notes

matty
Télécharger la présentation

Introduction to Artificial Intelligence (G51IAI)

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. Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction

  2. Aim of This Section • Introduce the blind searches on search tree • Specifically, the “general search pseudo-code” in Russell/Norvig (AIMA) and in the course notes • Understanding these notions is crucial for this section on search • The pseudo-code might be difficult to follow without first having a high-level understanding of what the algorithm is trying to do G51IAI – Blind Searches

  3. F B C E H G A I AI Techniques • Use the relevant knowledge that people have to solve problem • Problem solving techniques • Uninformed algorithms (blind search) • Informed algorithms (heuristic search) • Techniques in this module • Mainly based on tree search G51IAI – Blind Searches

  4. F B C E H G A I Problem Definition - 1 • Initial State • The initial state of the problem, defined in some suitable manner • Operator • A set of actions that moves the problem from one state to another G51IAI – Blind Searches

  5. F B C E H G A I Problem Definition - 1 • Neighbourhood (by Successor Function) • The set of all possible states reachable from a given state • State Space • The set of all states reachable from the initial state G51IAI – Blind Searches

  6. F B C E H G A I Problem Definition - 2 • Goal Test • A test applied to a state which returns if we have reached a state that solves the problem • Path Cost • How much it costs to take a particular path Examples: TSP, nQueen G51IAI – Blind Searches

  7. 5 4 1 2 3 6 1 8 8 4 7 3 2 7 6 5 1 1 2 4 3 7 4 2 5 5 6 8 3 7 8 6 Problem Definition - Example Initial State Goal State G51IAI – Blind Searches

  8. Problem Definition - Example • States • A description of each of the eight tiles in each location that it can occupy. • It is also useful to include the blank • Operators • The blank moves left, right, up or down G51IAI – Blind Searches

  9. Problem Definition - Example • Goal Test • The current state matches a certain state (e.g. one of the goal states shown on previous slide) • Path Cost • Each move of the blank costs 1 G51IAI – Blind Searches

  10. Exercise – state space of 8-queen problem • Initial state • an empty board • Operator • add a queen into a square on the board • States • any arrangement of 0 to 8 queens on the board • Goal state • an arrangement of 8 queens on board without any 2 attacking others G51IAI – Blind Searches

  11. Exercise – state space of 8-queen problem G51IAI – Blind Searches

  12. Exercise – state space of 8-queen problem G51IAI – Blind Searches

  13. F B C E H G A I Search Trees • A tree is a graph that: • is connected but becomes disconnected on removing any edge (branch) • has precisely one path between any two nodes • Unique path • makes them much easier to search • so we will start with search on trees G51IAI – Blind Searches

  14. B A F D C I E G H J Search Trees • Does the following tree contain a node “I”? • Yes. How did you know that? • so why the big deal about search? G51IAI – Blind Searches

  15. Search Trees • Because the graph is not given in a nice picture “on a piece of paper” • Instead the graph/tree is usually • Explicitly known, but “hidden”. You need to discover it “on the fly” i.e. as you do the search • Implicitly known only. You are given a set of rules with which to create the graph “on the fly” G51IAI – Blind Searches

  16. Search Trees • Does the tree under the following root contain a node “G”? • All you get to see at first is the root • and a guarantee that it is a tree • The rest is up to you to discover during the process of search F G51IAI – Blind Searches

  17. Evaluating a Search • Does our search method actually find a solution? • Is it a good solution? • Path Cost • Search Cost (Time and Memory) • Does it find the optimal solution? • But what is optimal? G51IAI – Blind Searches

  18. Evaluating a Search 1. Completeness • Is the strategy guaranteed to find a solution if one exist? 2. Time Complexity • How long does it take to find a solution? We’ll evaluate all the later search techniques w.r.t the below 4 criteria G51IAI – Blind Searches

  19. Evaluating a Search 3. Space Complexity • How much memory does it take to perform the search? 4. Optimality • Does the strategy find the optimal solution where there are several solutions? We’ll evaluate all the later search techniques w.r.t the below 4 criteria G51IAI – Blind Searches

  20. F B C E H G A I Blind Searches G51IAI – Blind Searches

  21. Blind Searches - Characteristics • Simply searches the State Space • Can only distinguish between a goal state and a non-goal state • Sometimes called an uninformed search as it has no knowledge about its domain G51IAI – Blind Searches

  22. Blind Searches- Characteristics • Blind Searches have no preference as to which state (node) that is expanded next • The different types of blind searches are characterised by the order in which they expand the nodes • This can have a dramatic effect on how well the search performs when measured against the four criteria we defined earlier G51IAI – Blind Searches

  23. F B C E H G A I Blind Searches - implementation Fundamental actions (operators): • “Expand” Ask a node for its children • “Test” Test a node to see whether it is a goal G51IAI – Blind Searches

  24. Blind Searches - implementation • Does the tree under the following root contain a node “G”? • Allowed: • Expand • Test F G51IAI – Blind Searches

  25. F B C E H G A I Blind Searches - implementation We’ll have 3 types of nodes during the search • Fringe nodes • have been discovered • have not yet been “processed”: • have not yet discovered their children • (have not yet tested if they are a goal) • Also called • open nodes G51IAI – Blind Searches

  26. F B C E H G A I Blind Searches - implementation We’ll have 3 types of nodes during the search • Visited nodes • have been discovered • have been processed: • have discovered all their children • (have tested whether are a goal) • Also called • closed nodes G51IAI – Blind Searches

  27. F B C E H G A I Blind Searches - implementation We’ll have 3 types of nodes during the search • Undiscovered nodes • The set of nodes that have not yet been discovered as being reachable from the root G51IAI – Blind Searches

  28. Blind Searches - implementation • Fundamental Search Ideas • Maintain the list of fringe nodes • Queue • A method to expand the node • to discover its children • A method to pick a fringe node • to be expanded • Move node • To fringe: once it’s been discovered insert • Out of fringe and into visited: after they have been processed remove G51IAI – Blind Searches

  29. Blind Searches - implementation • Need a data structure to store the fringe • AIMA uses a generic notion of • Queue • A list of nodes - general memory • Need methods to • add nodes : INSERT • remove nodes : REMOVE-FIRST G51IAI – Blind Searches

  30. Blind Searches – ordering of nodes • Does the ordering of nodes matter? • does the completeness depend on the way in which we implement INSERT? • Each node is expanded only once, and then removed from the fringe • Independently of the ordering, all nodes will be expanded, and expanded only once • We assumed (implicitly) that the tree is finite G51IAI – Blind Searches

  31. Blind Searches – ordering of nodes • If search is complete, why ordering of nodes? • different node orderings affect the shape of the fringe • different shapes of the fringe can lead to very different memory usages G51IAI – Blind Searches

  32. Blind Searches – ordering of nodes • If search is complete, why ordering of nodes? • The difference between searches lies in the order in which nodes are selected for expansion • The search always visits the first node in the fringe queue • The only way to control the ordering is to control the INSERT G51IAI – Blind Searches

  33. Blind Searches • Breadth first • Uniform cost • Depth first • Depth limited • Iterative deepening G51IAI – Blind Searches

More Related