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.

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

BackTracking Algorithms
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.
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.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
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.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
Using Search in Problem Solving
Backtracking.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
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.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Lecture 5: Backtracking Depth-First Search N-Queens Problem Hamiltonian Circuits.
Decision Trees and Association Rules Prof. Sin-Min Lee Department of Computer Science.
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
CS 312: Algorithm Analysis Lecture #32: Intro. to State-Space Search This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
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.
Artificial Intelligence Lecture No. 6 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
Ricochet Robots Mitch Powell Daniel Tilgner. Abstract Ricochet robots is a board game created in Germany in A player is given 30 seconds to find.
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.
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.
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
Data Structures and Algorithms Lists, Stacks, Queues, and Graphs Sorting and searching algorithms.
Artificial Intelligence Chapter 7 Agents That Plan Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
CSG3F3/ Desain dan Analisis Algoritma
ARTIFICIAL INTELLIGENCE
Decision Trees DEFINITION: DECISION TREE A decision tree is a tree in which the internal nodes represent actions, the arcs represent outcomes of an action,
BackTracking CS255.
Last time: search strategies
Depth-First Search N-Queens Problem Hamiltonian Circuits
CSSE 230 Day 25 Skip Lists.
Breadth First and Depth First
Iterative Deepening A*
Intro to Computer Science II
Plan Agents Chapter 7..
Discrete Mathematicsq
Introduction to Artificial Intelligence
Artificial Intelligence Lecture No. 6
Introduction Defining the Problem as a State Space Search.
Problem Solving by Searching
Artificial Intelligence Problem solving by searching CSC 361
Applied Combinatorics, 4th Ed. Alan Tucker
Artificial Intelligence
Artificial Intelligence
Applied Combinatorics, 4th Ed. Alan Tucker
Back Tracking.
Brute Force Approaches
Lectures on Graph Algorithms: searching, testing and sorting
Artificial Intelligence
Artificial Intelligence
adapted from Recursive Backtracking by Mike Scott, UT Austin
The Alpha-Beta Procedure
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
CSE (c) S. Tanimoto, 2001 Search-Introduction
A General Backtracking Algorithm
A General Backtracking Algorithm
Backtracking and Branch-and-Bound
Artificial Intelligence Chapter 7 Agents That Plan
CSE (c) S. Tanimoto, 2002 State-Space Search
The N-Queens Problem Search The N-Queens Problem Most slides from Milos Hauskrecht.
CSE (c) S. Tanimoto, 2004 State-Space Search
Chapter 2 Problems, Problem Spaces, and Search?
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Solving Problems by Searching
Unit II Game Playing.
Presentation transcript:

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 elements of a given list, as long as a given condition is met, and then it stops: takeWhile even [2, 6, 4, 7, 2, 8] [2,6,4] September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

Search in State Spaces September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

Search in State Spaces To some extent, it is also possible to account for state changes that the algorithm itself does not initiate. For example, a chess playing program can consider its opponent’s future moves. However, it is necessary that the set of such actions and their consequences are well-defined. While computers are able to play chess at a very high level, it is impossible these days to build a robot that, for instance, is capable of reliably carrying out everyday tasks such as going to a supermarket to buy groceries. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

Search in State Spaces Effects of moving a block (illustration and list-structure iconic model notation) September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

State-Space Graphs September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. Q x Q September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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. This way, “only” 256 configurations need to be tested. September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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 leaf 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 with “sanity checks”). September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

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). September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I

Backtracking in Decision Trees empty board Q Q place 1st queen Q Q Q place 2nd queen Q Q place 3rd queen Q place 4th queen September 18, 2018 Introduction to Artificial Intelligence Lecture 5: Search in State Spaces I