KU NLP Artificial Intelligence1 Ch 3. Structures and Strategies for State Space Search q Introduction q Graph Theory  Structures for state space search.

Slides:



Advertisements
Similar presentations
Artificial Intelligence (AI)
Advertisements

Problem Solving Well-formed predicate calculus expressions provide a means of describing objects and relations in a problem domain and inference rule.
Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
CSC411Artificial Intelligence 1 Chapter 3 Structures and Strategies For Space State Search Contents Graph Theory Strategies for Space State Search Using.
Traveling Salesperson Problem
PROBLEM SOLVING AND SEARCH
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
State Space Search Classic AI.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Part2 AI as Representation and Search
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
EIE426-AICV 1 Blind and Informed Search Methods Filename: eie426-search-methods-0809.ppt.
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.
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
State Space Search 2 Chapter 3 Three Algorithms. Backtracking Suppose We are searching depth-first No further progress is possible (i.e., we can only.
Search: Representation and General Search Procedure Jim Little UBC CS 322 – Search 1 September 10, 2014 Textbook § 3.0 –
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.
CPSC 322 Introduction to Artificial Intelligence October 27, 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
Structures and Strategies for State Space Search
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
Dr Eleni Mangina – COURSE: LOGIC PROGRAMMING (during a joint degree with Fudan University in Software Engineering) DEPT. OF COMPUTER SCIENCE UCD Problem.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Using Search in Problem Solving
Structures and Strategies For Space State Search
Solving problems by searching
1 Structures and Strategies for State Space Search 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
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.
Artificial Intelligence Introduction (2). What is Artificial Intelligence ?  making computers that think?  the automation of activities we associate.
Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called.
Artificial Intelligence LECTURE 3 ARTIFICIAL INTELLIGENCE LECTURES BY ENGR. QAZI ZIA 1.
KU NLP Structures and Strategies for State Space Search Depth-First and Breadth-First Search q A search algorithm must determine the order in which.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
1 CS 385 Fall 2006 Chapter 3 Structures and Strategies for State Space Search.
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.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
1 Solving problems by searching 171, Class 2 Chapter 3.
Algorithms April-May 2013 Dr. Youn-Hee Han The Project for the Establishing the Korea ㅡ Vietnam College of Technology in Bac Giang.
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
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.
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.
Knowledge Search CPTR 314.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
George F Luger ARTIFICIAL INTELLIGENCE 5th edition Structures and Strategies for Complex Problem Solving Structures and Strategies For Space State Search.
Union By Rank Ackermann’s Function Graph Algorithms Rajee S Ramanikanthan Kavya Reddy Musani.
Introduction to State Space Search
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.
STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH 3 3.0Introduction 3.1Graph Theory 3.2Strategies for State Space Search 3.3Using the State Space to Represent.
Chapter 13 Backtracking Introduction The 3-coloring problem
Solving problems by searching A I C h a p t e r 3.
State space search Represented by a four-tuple [N,A,S,GD], where: N is the problem space A is the set of arcs (or links) between nodes. These correspond.
G5AIAI Introduction to AI
STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Biointelligence Lab School of Computer Sci. & Eng. Seoul National University Artificial Intelligence Chapter 8 Uninformed Search.
Breadth First and Depth First
Artificial Intelligence Lecture No. 6
Artificial Intelligence
Artificial Intelligence
Blay Whitby 2003 Search Blay Whitby 2003
Chap 4: Searching Techniques
Presentation transcript:

KU NLP Artificial Intelligence1 Ch 3. Structures and Strategies for State Space Search q Introduction q Graph Theory  Structures for state space search  state space representation of problems q Strategies for state space search  Data-Driven and Goal-Driven Search  Implementing Graph Search  Depth-First and Breadth-First Search  Depth-First Search with Iterative Deepening q Using the State Space to Represent Reasoning with the Predicate Calculus  State Space Description of a Logical System  AND/OR graphs  Examples and Applications

KU NLP Artificial Intelligence2 Introduction(1) q Questions for designing search algorithms  Is the problem solver guaranteed to find a solution?  Will the problem solver always terminate?  When a solution is found, is it guaranteed to be optimal?  What is the complexity of the search process?  How can the interpreter most effectively reduce search complexity?  How can the interpreter effectively utilize a representation language? q State space search is the tool for answering these questions.

KU NLP Artificial Intelligence3 Introduction(2) q A graph consists of nodes and a set of arcs or links connecting pairs of nodes. q Nodes are used to represent discrete states.  A configuration of a game board. (tic-tac-toe, p43, tp4) q Arcs are used to represent transitions between states.  Legal moves of a game  Leonhard Euler invented graph theory to solve the “bridge of K ö nigsberg problem”  Is there a walk around the city that crosses each bridge exactly once. (Fig. 3.1, P82, tp5)

KU NLP Artificial Intelligence4 State space representation of Tic-tac-toe (p 43)

KU NLP Artificial Intelligence5 K ö nigsberg Bridge System (p82)

KU NLP Artificial Intelligence6 K ö nigsberg Bridge System q Euler focused on the degree of the nodes of the graph  Even degree node has an even number of arcs joining it to neighboring nodes.  Odd degree node has an odd number of arcs. q Unless a graph contained either exactly zero or two nodes of odd degree, the walk was impossible.  No odd dgree node: the walk start at the first and end at the same node  Two odd degree nodes: the walk could start at the first and end at the second

KU NLP Artificial Intelligence7 Definition of Graph(1)  A graph consists of nodes and arcs(Fig. 3.3, p85)  A set of nodes N1, N2, …, Nn … need not be finite.  A set of arcs connects pairs of nodes.  A directed graph has an indicated direction for traversing each arc(Fig. 3.3, p85)  If a directed arc connects Nj and Nk, then Nj is called the parent of Nk and Nk is called the child of Nj.  A rooted graph has a unique node Ns from which all paths in the graph originate (Fig. 3.4, p86)  A tip or leaf node is a node without children.  An ordered sequence of nodes [N1, N2, N3, … Nn] is called a path of length n-1 in the graph

KU NLP Artificial Intelligence8 Definition of Graph (2) q On a path in a rooted graph, a node is said to be an ancestor of all nodes positioned after it (to its right) as well as a descendant of all nodes before it (to its left). q A path that contains any node more than once is said to contain a cycle or loop. q A tree is a graph in which there is a unique path between every pair of nodes q Two nodes in a graph are said to be connected if a path exists that includes them both.

KU NLP Artificial Intelligence9 State Space Representation of Problems(1) q In the state space representation of a problem, the nodes of a graph corresponds to partial problem solution states, the arcs corresponds to steps in a problem-solving process. q State space search characterize problem solving as the process of finding a solution path from the start state to a goal.

KU NLP Artificial Intelligence10 State Space Representation of Problems(2) q Definition : STATE SPACE SEARCH A state space is represented by a four tuple [N, A, S, GD] where  N is the set of states.  A is the set of steps between states  S is the start state(S) of the problem.  GD is the goal state(S) of the problem. The states in GD are described: 1. A measurable property of the states. (winning board in tic- tac-toe) 2. A property of the path.(shortest path in traveling sales man problem) A solution path is a path through this graph from S to GD.

KU NLP Artificial Intelligence11 Tic-tac-toe (1) q The set of states are all different configurations of Xs and Os that the game can have. [N]  3 9 ways to arrange {blank, X, O} in nine spaces. q Arcs(steps) are generated by legal moves of the game, alternating between placing an X and an O in an unused location [A] q The start state is an empty board. [S] q The goal state is a board state having three Xs in a row, column, or diagonal. [GD] q Fig II.5 (p 43, tp12)

KU NLP Artificial Intelligence12 Tic-tac-toe (2)

KU NLP Artificial Intelligence13 Tic-tac-toe (3) q There are no cycles in the state space because the directed arcs of the graph do not allow a move to be undone. q The complexity of the problem : 9!(362,880) different path can be generated.  Need heuristics to reduce the search complexity. e.g. My possible winning lines – Opponent’s possible wining lines (Fig 4.16, p149, tp14)  Chess has possible game paths

KU NLP Artificial Intelligence14 Possible Heuristic for Tic-tac-toe

KU NLP Artificial Intelligence15 The 8-puzzle (1)  The set of states are all different configurations of 9 tiles (9!).  The legal moves are : move the blank tile up(  ), right(  ), down(  ), and the left(  ).  make sure that it does not move the blank off the board.  All four moves are not applicable at all times.  The start state (e.g. Fig. 3.6, p90, tp16)  The goal state (e.g. Fig. 3.5, p89)  unlike tic-tac-toe, cycles are possible in the 8-puzzle.  Applicable heuristics (Fig. 4.8, p132, tp17)

KU NLP Artificial Intelligence16 The 8 puzzle (2)

KU NLP Artificial Intelligence17 Possible Heuristic for 8-puzzle

KU NLP Artificial Intelligence18 The Traveling Salesperson(1) q The goal of the problem is to find the shortest path for the salesperson to travel, visiting each city, and then returning to the starting city. q The goal description requires a complete circuit with minimum cost. q The complexity of exhaustive search is (N-1)!, where N is the number of cities(Fig 3.8, p93) q Techniques for reducing the search complexity.  Branch and Bound, The Nearest neighbor.

KU NLP Artificial Intelligence19 The Traveling Salesperson(2)

KU NLP Artificial Intelligence20 The Traveling Salesperson(3) q Branch and Bound technique 1. Generate paths while keeping track of the best path found so far. 2. Use this value as a bound 3. As paths are constructed one city at a time, examine each partially completed path by guessing the best possible extension of the path (the branch). 4. If the branch has greater cost than the bound, it eliminates the partial path and all of its possible extensions. q The “Nearest Neighbor” technique  Go to the closest unvisited city. (A E D B C A) is not the shortest path (Fig. 3.9, p93, tp21) q Other examples of State Space representation  Blocks world (p 289), FWGC problem (p 622)

KU NLP Artificial Intelligence21 The Traveling Salesperson(4)

KU NLP Artificial Intelligence Data-Driven and Goal-Driven Search (1)  Data-driven search(forward chaining) takes the facts of the problem and applies the rules and legal moves to produce new facts that lead to a goal.  Goal-driven search (backward chaining) focused on the goal, finds the rules that could produce the goal, and chains backward through successive rules and subgoals to the given facts of the problem.  Both problem solvers search the same state space graph. The search order and the actual number of states searched can differ.

KU NLP Artificial Intelligence Data-Driven and Goal-Driven Search (2) q The preferred strategy is determined by the properties of the problem: complexity of the rules, “shape” of the state space, the nature and availability of the problem data. q Confirming or denying the statement “I am a descendant of 임꺽정.”  Assume that 임꺽정 was born about 250 years ago and that 25 years per generation and that 3 children per family  I -> 임꺽정 (backward) 2 10 ancestors  임꺽정 -> I (forward) 3 10 nodes of family

KU NLP Artificial Intelligence24 Goal-Driven Search is Suggested(1) q A goal or hypothesis is given in the problem statement or can easily be formulated.  Mathematics theorem prover, diagnostic systems q Early selection of a goal can eliminate most branches, making goal-driven search more effective in pruning the space. (Fig.3.10 p95, tp25)  Mathematics theorem prover: total # of rules to produce a given theorem is much smaller than # of rules that may be applied to the entire set of axioms q Problem data are not given but must be acquired.  A medical diagnosis program: Doctor order only diagnostic tests that are necessary to confirm or deny a hypothesis

KU NLP Artificial Intelligence25 Goal-Driven Search is Suggested(2)

KU NLP Artificial Intelligence26 Data-driven Search is Appropriate  All or most of the data are given in the initial problem statement.  PROSPECTOR interpreting geological data.  There are only a few ways to use the facts and given information.  DENDRAL finding the molecular structure of organic compounds. For any organic compound, enormous number of possible structures. The mass spectrographic data on a compound allow DENDRAL to eliminate most of possible structures.  Branching factor, availability of data, and ease of determining potential goals are carefully analyzed to determine the direction of search.

KU NLP Artificial Intelligence27 Backtracking Search Algorithm q Backtracking is a technique for systematically trying all paths through a state space. q Search begins at the start state and pursues a path until it reaches either a goal or a “dead end”. If it finds a goal, returns the solution path. If it reaches a dead end, it backtracks to the most recent node on the path q Figure 3.12 (p 98, tp28) ABEHIFJCGABEHIFJCG

KU NLP Artificial Intelligence28 Backtracking Search Example

KU NLP Artificial Intelligence29 Function Backtrack (1) Begin path SL:=[start]; % state list (the states in the current path) NSL:=[start]; % new state list(Nodes awaiting evaluation) % nodes whose children are not yet been generated DE:=[ ]; % dead ends (states whose descendants have failed to % contain a goal node) CS:=start; % current state while NSL is not [ ] % while there are states to be tried do begin if CS=goal then return (SL) % on success, return list of states in path if CS has no children (except nodes already on DE, SL, NSL) then begin while SL is not empty and CS=the first element of SL do begin

KU NLP Artificial Intelligence30 Function Backtrack (2) do begin add CS to DE; remove first element from SL; % backtrack remove first element from NSL; CS:=first element of NSL; end add CS to SL; end else begin % when CS has children % the first child becomes new current state % and the rest are placed on NSL for future. place children of CS (except nodes on DE) on NSL; CS:=first element of NSL; add CS to SL; end return FAIL; end

KU NLP Artificial Intelligence31 Function Backtrack (3)

KU NLP Artificial Intelligence32 Ideas used in Backtrack algorithm q The list NSL is used to allow the algorithm to backtrack to any of these states. q The list DE is used to prevent the algorithm from retrying useless paths. q The list SL is used to keep track of the current solution path. q Explicit checks for membership of new states in these lists to prevent looping.