artificial
play

Artificial algorithm are widely used in computer science and - PDF document

The Meaning of Search in AI COMP2240 The terms search, search space, search problem, search Artificial algorithm are widely used in computer science and especially in AI. Intelligence In this context the word


  1. The Meaning of Search in AI COMP2240 The terms ‘search’, ‘search space’, ‘search problem’, ‘search Artificial algorithm’ are widely used in computer science and especially in AI. Intelligence In this context the word ‘search’ has a somewhat technical sense, although it is used because of a strong analogy with the meaning of the natural language word ‘search’. But you need to gain a sound understanding of the technical meaning of ‘search’ as an AI problem solving method. Lecture S-1 Introduction to Search A I — Introduction to Search A I — Introduction to Search S-1-1 S-1-2 Mazes — a typical example of search Examples of Search Problems Finding a path through a maze is an excellent example of a problem that both corresponds with our intuitive idea of ‘search’ and also illustrates the essential characteristics of the kind of • Puzzles: ‘search’ that is investigated in AI. click to play To solve the maze we must • route finding, motion control, find a path from an initial location to a goal location. • activity planning, games AI, A path is determined by a • scheduling, sequence of choices. At each choice-point we must • mathematical theorem proving, choose between two or more branches . • design of computer chips, drugs, buildings etc. A I — Introduction to Search A I — Introduction to Search S-1-3 S-1-4 State Spaces State Space of the Robot Vac The state space of a robot vac consists of all the different In the maze example, search takes place within physical space. possibilities of its location and of which locations are dirty: We want to find a path connecting physical locations. But we can apply the general idea of search to more abstract kinds of problem. To do this we replace physical space with a state space . The states in the space can correspond to any kind of configuration. For example, the possible settings of a device, positions in a game or (more abstract still) a set of assignments to variables. Paths in state space correspond to possible sequences of transitions between states. Possible transitions correspond to state changes resulting from the vac’s actions: move left, move right, suck. A I — Introduction to Search A I — Introduction to Search S-1-5 S-1-6

  2. Search Spaces Types of Search Problem A search space is essentially just a state space, in which we have • Type 1) Find a solution: an initial state and one or more goal states . Search for a state or configuration satisfying known conditions. Given a search space, a solution to the search problem is a path E.g. in scheduling we search for a timetable satisfying given consisting of a sequence of connected states, starting at the initial constraints on when events can occur — such as Lecture A state and ending at one of the goal states. cannot be at the same time as Lecture B. Consider the state space of the robot vac as a search space. • Type 2) Find a way to reach a solution: What might be the goal state(s) ? Search for a sequence of steps (actions) that lead from an initial Identify possible paths from the top left state to a goal state? state to a desired goal state (either a specific state or any state Which paths are best? satisfying given conditions). E.g. we want to find a sequence of moving, picking up and placing actions that a robot can execute to lay a table. A I — Introduction to Search A I — Introduction to Search S-1-7 S-1-8 Reducing Type 1 to Type 2 Type 1 search may on first consideration seem simpler than type • Type 3) Find the best way to reach a solution: 2, since we are only interested in finding an actual solution, not in Search for an optimal sequence of steps (actions) that lead from the details of how to get there. an initial state to a goal state. An optimal sequence is one that has the lowest ‘cost’ (i.e. takes the least time or resources). However, if one tries to find a solution without considering how it can be constructed, the only applicable method would be to try all possible configurations and check whether each is indeed a solution (e.g. check all possible schedules to see if they satisfy the given conditions). NOTE: the terminology of type 1-3 search problems is not in general use. I just introduced it to organise my description of the Type 1 problems are normally reduced to Type 2 by considering variety of search problems. that a solution can be constructed by a series of steps. (E.g. a timetable is constructed in stages by a sequence of assignments of time slots to events.) A I — Introduction to Search A I — Introduction to Search S-1-9 S-1-10 Formulating Problems Search Trees as Search Problems A huge variety of problems can be cast into the form of search The state space associated with a problem can in general be an problems. In order to apply a search approach we need to analyse arbitrary graph. Each node is a state and each arc represents a the problem as follows: possible transition between states. However, in devising a search algorithm we normally treat the • Conceptualise possible solutions and intermediate stages search space as if it were a tree . towards solutions as states (and identify an initial state). The root node is the initial state. • Identify transitions that allow a state to be transformed into other The children of each state/node S are all those states/nodes that successor states. are reachable S by a single transition. • Devise an algorithm that will systematically search through (Note that if the graph of the state space contains loops, the possible paths from the initial state in order to find a path that corresponding tree will be infinite.) ends in a goal. A I — Introduction to Search A I — Introduction to Search S-1-11 S-1-12

  3. Explicit vs Generated Search Spaces Characterising Successor States In order to implement a search algorithm, we need a way of For certain problems, we may actually have a tree (or graph) determining the possible successors to any given state. There structure stored as data — i.e. we have an explicit representation are several ways one might do this: of the search space. • Set up a data structure (tree or graph) that explicitly represents But in many cases the search space is not explicitly represented, the successor relation. rather a search tree is generated during the execution of the search algorithm. • Give a set of actions and specify in what kinds of state they can be executed, and how they transform the state to a new state To generate such a tree one needs an algorithm or set of rules (e.g. the actions of a robot, with pre-conditions and effects). which, given any state, can return a list of all possible successor states. • Specify a way of choosing a possible next state and also a set For example, if a robot is in a given state, we need a way to of conditions to determine whether that state is indeed possible. determine all the actions it could execute, and what state it would (e.g. in constructing a timetable, pick the next lecture from a list, end up in after executing each of these. assign a time/room for it and then check that no clashes occur. A I — Introduction to Search A I — Introduction to Search S-1-13 S-1-14 Useless Paths The 8-Queens Problem The 8-queens (more generally n -queens) problem is the problem How do we know whether we are on a path that will lead to a of finding a placement of 8 (or n ) queens on a chess board (or solution? n × n grid), such that no queen can take any other queen. In general we don’t. We may just have to keep going and see if we eventually get to a goal state. However, we may get to a dead end — a state which has no successors. Alternatively, we may come to a state that we have already been in — we are in a loop. See http://www.hbmeyer.de/backtrack/achtdamen/eight.htm Search algorithms are most efficient and easiest to implement if there are simple ways to test if we have reached a dead end or How can one formulate the 8-queens problem as a search are in a loop. problem? A I — Introduction to Search A I — Introduction to Search S-1-15 S-1-16 Search Algorithms Breadth-First Search Considerable research in computer science and AI has addressed Breadth-first search is perhaps the most conceptually simple. the question of what is a good algorithm for (quickly) finding a We start at the root an explore the tree by working our way down solution path in a search tree. level by level. Testing each path to see if we have reached a goal. This is a crucial problem since: The following diagram shows the order in which nodes are tested: • lots of real problems can be formulated as search, search trees even for quite simple problems tend to get get • pretty massive. (If each state has 5 successors and the shortest solution path consists of 12 transitions, then the corresponding search tree contains at least 5 12 = 244 , 140 , 625 states.) Many different search algorithms have been developed. A I — Introduction to Search A I — Introduction to Search S-1-17 S-1-18

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend