Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Heuristic Search techniques
BackTracking Algorithms
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
Part2 AI as Representation and Search
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
CSC 423 ARTIFICIAL INTELLIGENCE
Graphs Graphs are the most general data structures we will study in this course. A graph is a more general version of connected nodes than the tree. Both.
September 26, 2012Introduction to Artificial Intelligence Lecture 7: Search in State Spaces I 1 After our “Haskell in a Nutshell” excursion, let us move.
Artificial Intelligence Lecture No. 7 Dr. Asad Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Discrete Structures Lecture 13: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
Problem Solving and Search in AI Part I Search and Intelligence Search is one of the most powerful approaches to problem solving in AI Search is a universal.
This time: Outline Game playing The minimax algorithm
Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2004.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Structures and Strategies for State Space Search
Artificial Intelligence Chapter 3: Solving Problems by Searching
Using Search in Problem Solving
Using Search in Problem Solving
Ch 13 – Backtracking + Branch-and-Bound
Backtracking.
CSE (c) S. Tanimoto, 2007 Search 1: State Spaces 1 State-Space Search Outline: Demonstration with T* State spaces, operators, moves A Puzzle: The.
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
Copyright R. Weber Search in Problem Solving Search in Problem Solving INFO 629 Dr. R. Weber.
3.0 State Space Representation of Problems 3.1 Graphs 3.2 Formulating Search Problems 3.3 The 8-Puzzle as an example 3.4 State Space Representation using.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Graph Theory Topics to be covered:
Backtracking. N-Queens The object is to place queens on a chess board in such a way as no queen can capture another one in a single move –Recall that.
Lecture 5: Backtracking Depth-First Search N-Queens Problem Hamiltonian Circuits.
Decision Trees and Association Rules Prof. Sin-Min Lee Department of Computer Science.
Artificial Intelligence Lecture 10. Outline Problem Solving using Search Search consists of –state space –operators –start state –goal states A Search.
Design and Analysis of Algorithms - Chapter 111 How to tackle those difficult problems... There are two principal approaches to tackling NP-hard problems.
Chapter 12 Coping with the Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Artificial Intelligence
Algorithms April-May 2013 Dr. Youn-Hee Han The Project for the Establishing the Korea ㅡ Vietnam College of Technology in Bac Giang.
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Artificial Intelligence Lecture No. 6 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
COSC 2007 Data Structures II
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Introduction to State Space Search
Chapter 13 Backtracking Introduction The 3-coloring problem
February 11, 2016Introduction to Artificial Intelligence Lecture 6: Search in State Spaces II 1 State-Space Graphs There are various methods for searching.
February 9, 2016Introduction to Artificial Intelligence Lecture 5: Perception & Action 1 Frege Notes In order to use many of the Java math functions in.
February 18, 2016Introduction to Artificial Intelligence Lecture 8: Search in State Spaces III 1 A General Backtracking Algorithm Sanity check function.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Artificial Intelligence Chapter 7 Agents That Plan Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
Plan Agents Chapter 7..
Artificial Intelligence Lecture No. 6
Haskell Tips You can turn any function that takes two inputs into an infix operator: mod 7 3 is the same as 7 `mod` 3 takeWhile returns all initial.
Backtracking and Branch-and-Bound
Artificial Intelligence Chapter 7 Agents That Plan
The N-Queens Problem Search The N-Queens Problem Most slides from Milos Hauskrecht.
Unit II Game Playing.
Presentation transcript:

Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way to represent a search There are a variety of specific search techniques, including –Depth-First, Breadth-First, Best-first search –Others which use heuristic knowledge

Chapter 7 modeling search state space, graph notation, explicit search Chapter 8 standard search techniques – DFS, BFS. Chapter 9 heuristic search best-first, iterative-deepening, A* algorithm Chapter 12 adversarial search two-player and multiplayer games

What do these problems have in common? Find the layout of chips on a circuit board which minimize the total length of interconnecting wires Schedule which airplanes and crew fly to which cities for American, United, British Airways, etc Write a program which can play chess against a human

Build a system which can find human faces in an arbitrary digital image Program a tablet-driven portable computer to recognize your handwriting Decrypt data which has been encrypted but you do not have the key Answer –they can all be formulated as search problems

Search in State Spaces Many problems in Artificial Intelligence can be mapped onto searches in particular state spaces. This concept is especially useful if the system (our “world”) can be defined as having a finite number of states, including an initial state and one or more goal states. Optimally, there are a finite number of actions that we can take, and there are well-defined state transitions that only depend on our current state and current action.

Search in State Spaces Let us consider an easy task in a very simple world with our robot being the only actor in it: The world contains a floor and three toy blocks labeled A, B, and C. The robot can move a block (with no other block on top of it) onto the floor or on top of another block. These actions are modeled by instances of a schema, move(x, y). Instances of the schema are called operators.

Search in State Spaces The robot’s task is to stack the toy blocks so that A is on top of B, B is on top of C, and C is on the floor. For us it is clear what steps have to be taken to solve the task. The robot has to use its world model to find a solution. Let us take a look at the effects that the robot’s actions exert on its world.

Setting Up a State Space Model State-space Model is a Model for The Search Problem –usually a finite set of states X e.g., in driving, the states in the model could be towns/cities in games, board positions Start State - a state from X where the search starts

Goal State(s) a goal is defined as a target state – For now: all goal states have utility 1, and all non-goals have utility 0 – there may be many states which satisfy the goal e.g., drive to a town with an airport – or just one state which satisfies the goal e.g., drive to Las Vegas Operators – operators are mappings from X to X e.g. moves from one city to another that are legal (connected by a road)

Example There are three blocks named A, B and C on a table. You can take any (one) block and move it on top of any other stack or to the table. Goal is to get the stack A, B, C. Start: Final:

Search in State Spaces Effects of moving a block (illustration and list-structure iconic model notation)

Search in State Spaces In order to solve the task efficiently, the robot should “look ahead”, that is simulate possible actions and their outcomes. Then, the robot can carry out a sequence of actions that, according to the robot’s prediction, solves the problem. A useful structure for such a simulation of alternative sequences of action is a directed graph. Such a graph is called a state-space graph.

State-Space Graphs

To solve a particular problem, the robot has to find a path in the graph from a start node (representing the initial state) to a goal node (representing a goal state). The resulting path indicates a sequence of actions that solves the problem. The sequence of operators along a path to a goal is called a plan. Searching for such a sequence is called planning. Predicting a sequence of world states from a sequence of actions is called projecting.

State-Space Graphs There are various methods for searching state spaces. One possibility is breadth-first search: –Mark the start node with a 0. –Mark all adjacent nodes with 1. –Mark all unmarked nodes adjacent to nodes with a 1 with the number 2, and so on, until you arrive at a goal node. –Finally, trace a path back from the goal to the start along a sequence of decreasing numbers.

Decision Trees A decision tree is a special case of a state-space graph. It is a rooted tree in which each internal node corresponds to a decision, with a subtree at these nodes for each possible outcome of the decision. Decision trees can be used to model problems in which a series of decisions leads to a solution. The possible solutions of the problem correspond to the paths from the root to the leaves of the decision tree. Example: There are 12 coins of which one is heavier or lighter than the rest. Find the odd coin using a balance with 3 weighings.

Decision Trees Example: The n-queens problem How can we place n queens on an n  n chessboard so that no two queens can capture each other? A queen can move any number of squares horizontally, vertically, and diagonally. Here, the possible target squares of the queen Q are marked with an x.

Decision Trees Let us consider the 4-queens problem. Question: How many possible configurations of 4  4 chessboards containing 4 queens are there? Answer: There are 16!/(12!  4!) = (13  14  15  16)/(2  3  4) = 13  7  5  4 = 1820 possible configurations. Shall we simply try them out one by one until we encounter a solution? No, it is generally useful to think about a search problem more carefully and discover constraints on the problem’s solutions. Such constraints can dramatically reduce the size of the relevant state space.

Decision Trees Obviously, in any solution of the n-queens problem, there must be exactly one queen in each column of the board. Otherwise, the two queens in the same column could capture each other. Therefore, we can describe the solution of this problem as a sequence of n decisions: Decision 1: Place a queen in the first column. Decision 2: Place a queen in the second column... Decision n: Place a queen in the n-th column.

Backtracking in Decision Trees There are problems that require us to perform an exhaustive search of all possible sequences of decisions in order to find the solution. We can solve such problems by constructing the complete decision tree and then find a path from its root to a leave that corresponds to a solution of the problem (breadth-first search often requires the construction of an almost complete decision tree). In many cases, the efficiency of this procedure can be dramatically increased by a technique called backtracking (depth-first search).

Backtracking in Decision Trees Idea: Start at the root of the decision tree and move downwards, that is, make a sequence of decisions, until you either reach a solution or you enter a situation from where no solution can be reached by any further sequence of decisions. In the latter case, backtrack to the parent of the current node and take a different path downwards from there. If all paths from this node have already been explored, backtrack to its parent. Continue this procedure until you find a solution or establish that no solution exists (there are no more paths to try out).

Backtracking in Decision Trees Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q place 1 st queen place 2 nd queen place 3 rd queen place 4 th queen empty board

Summary: Defining Search Problems A statement of a Search problem has 4 components –1. A set of states –2. A set of “operators” which allow one to get from one state to another –3. A start state S –4. A set of possible goal states, or ways to test for goal states Search solution consists of –a sequence of operators which transform S into a a unique goal state G. (often, we may want the shortest path to the goal.)