Instructor: Kris Hauser

Slides:



Advertisements
Similar presentations
CS B551: E LEMENTS OF A RTIFICIAL I NTELLIGENCE Instructor: Kris Hauser 1.
Advertisements

Problem Solving by Searching Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 3 Spring 2007.
Solving Problem by Searching
Artificial Intelligence Problem Solving Eriq Muhammad Adams
1 Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3–5.
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.
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.
1 Search Problems (Where reasoning consists of exploring alternatives) R&N: Chap. 3, Sect. 3.1–
Artificial Intelligence Chapter 3: Solving Problems by Searching
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?
Solving problems by searching
1 Midterm Review cmsc421 Fall Outline Review the material covered by the midterm Questions?
Solving Problems by Searching
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.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
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.
1 Solving problems by searching This Lecture Chapters 3.1 to 3.4 Next Lecture Chapter 3.5 to 3.7 (Please read lecture topic material before and after each.
CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #3 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
1 Solving Problems by Searching (Blindly) R&N: Chap. 3 (many of these slides borrowed from Stanford’s AI Class)
AI in game (II) 권태경 Fall, outline Problem-solving agent Search.
1 Solving problems by searching 171, Class 2 Chapter 3.
Advanced Artificial Intelligence Lecture 2: Search.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
Introduction to State Space Search
G5AIAI Introduction to AI
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
Blind Search Russell and Norvig: Chapter 3, Sections 3.4 – 3.6 CS121 – Winter 2003.
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
Search Problems Russell and Norvig: Chapter 3, Sections 3.1 – 3.3 CS121 – Winter 2003.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
1 Search Problems (Where we see problems as the exploration of alternatives) R&N: Chap. 3, Sect. 3.1–
Lecture 3: Uninformed Search
Solving problems by searching
BackTracking CS255.
Constraint satisfaction
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Introduction to Artificial Intelligence
Artificial Intelligence Lecture No. 6
Introduction to Artificial Intelligence
Problem Solving by Searching
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
Motion Planning for a Point Robot (2/2)
Russell and Norvig: Chapter 3, Sections 3.4 – 3.6
Lecture 1B: Search.
Problem Solving and Searching
EA C461 – Artificial Intelligence
Searching for Solutions
Problem Solving and Searching
Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap
Russell and Norvig: Chapter 3, Sections 3.1 – 3.3
CPSC 322 Introduction to Artificial Intelligence
Solving problems by searching
Solving problems by searching
CSE (c) S. Tanimoto, 2002 State-Space Search
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
CSE (c) S. Tanimoto, 2004 State-Space Search
Solving problems by searching
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Informed Search Idea: be smart about what paths to try.
Solving Problems by Searching
Unit II Game Playing.
Solving problems by searching
Presentation transcript:

Instructor: Kris Hauser http://cs.indiana.edu/~hauserk Search Instructor: Kris Hauser http://cs.indiana.edu/~hauserk

Recap http://www.cs.indiana.edu/classes/b351 Brief history and philosophy of AI What is intelligence? Can a machine act/think intelligently? Turing machine, Chinese room

Agenda Problem Solving using Search Search Algorithms

Exploring Alternatives Problems that seem to require intelligence usually require exploring multiple alternatives Search: a systematic way of exploring alternatives

Across history, puzzles and games requiring the exploration of alternatives have been considered a challenge for human intelligence: Chess originated in Persia and India about 4000 years ago Checkers appear in 3600-year-old Egyptian paintings Go originated in China over 3000 years ago So, it’s not surprising that AI uses games to design and test algorithms

Example: 8-Puzzle 8 2 1 2 3 3 4 7 4 5 6 5 1 6 7 8 Initial state Goal state State: Any arrangement of 8 numbered tiles and an empty tile on a 3x3 board

Successor Function: 8-Puzzle 2 7 SUCC(state)  subset of states The successor function is knowledge about the 8-puzzle game, but it does not tell us which outcome to use, nor to which state of the board to apply it. 3 4 5 1 6 8 2 8 2 7 8 2 7 3 4 7 3 4 6 3 4 5 1 6 5 1 5 1 6

Defining a Search Problem State space S Successor function: x  S  SUCC(x)  2S Initial state s0 Goal test: xS  GOAL?(x) =T or F Arc cost

8-Queens Problem State repr. 1 State repr. 2 Any non-conflicting placement of 0-8 queens State repr. 2 Any placement of 8 queens

State Graph Each state is represented by a distinct node An arc (or edge) connects a node s to a node s’ if s’  SUCC(s) The state graph may contain more than one connected component

Solution to the Search Problem A solution is a path connecting the initial node to a goal node (any one) The cost of a path is the sum of the arc costs along this path An optimal solution is a solution path of minimum cost There might be no solution ! I G

Pathless Problems Sometimes the path doesn’t matter A solution is any goal node Arcs represent potential state transformations E.g. 8-queens, Simplex for LPs, Map coloring G I

Representation 1 State: any placement of 0-8 queens Initial state: 0 queens Successor function: Place queen in empty square Goal test: Non-conflicting placement of 8 queens # of states ~ 64x63x…x57 ~ 3x1014

Representation 2 State: any placement of non- conflicting 0-8 queens in columns starting from left Initial state: 0 queens Successor function: A queen placed in leftmost empty column such that it causes no conflicts Goal test: Any state with 8 queens # of states = 2057

Path Planning What is the state space?

Formulation #1 Cost of one horizontal/vertical step = 1 Cost of one diagonal step = 2

Optimal Solution This path is the shortest in the discretized state space, but not in the original continuous space

Formulation #2 Cost of one step: length of segment

Formulation #2 Cost of one step: length of segment Visibility graph

Solution Path The shortest path in this state space is also the shortest in the original continuous space

What is a State? A state does: A state DOES NOT: Represent all information meaningful to the problem at a given “instant in time” – past, present, or future Exist in an abstract, mathematical sense A state DOES NOT: Necessarily exist in the computer’s memory Tell the computer how it arrived at the state Tell the computer how to choose the next state Need to be a unique representation

What is a State Space? An abstract mathematical object E.g., the set of all permutations of (1,…,8,empty) Membership should be trivially testable E.g., S = { s | s is reachable from the start state through transformations of the successor function } is not easily testable Arcs should be easily generated Again: the state space does NOT contain information about which arc to take (or not to take) in a given state

Example: 8-Puzzle 8 2 1 2 3 3 4 7 4 5 6 5 1 6 7 8 Initial state Goal state State: Any arrangement of 8 numbered tiles and an empty tile on a 3x3 board

15-Puzzle Introduced (?) in 1878 by Sam Loyd, who dubbed himself “America’s greatest puzzle- expert”

15-Puzzle Sam Loyd offered $1,000 of his own money to the first person who would solve the following problem: 12 15 11 14 10 13 9 5 6 7 8 4 3 2 1 ? 12 14 11 15 10 13 9 5 6 7 8 4 3 2 1

But no one ever won the prize !!

How big is the state space of the (n2-1)-puzzle? 8-puzzle  ?? states

How big is the state space of the (n2-1)-puzzle? 8-puzzle  9! = 362,880 states 15-puzzle  16! ~ 2.09 x 1013 states 24-puzzle  25! ~ 1025 states But only half of these states are reachable from any given state (but you may not know that in advance)

Permutation Inversions Wlg, let the goal be: A tile j appears after a tile i if either j appears on the same row as i to the right of i, or on another row below the row of i. For every i = 1, 2, ..., 15, let ni be the number of tiles j < i that appear after tile i (permutation inversions) N = n2 + n3 +  + n15 + row number of empty tile 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 n2 = 0 n3 = 0 n4 = 0 n5 = 0 n6 = 0 n7 = 1 n8 = 1 n9 = 1 n10 = 4 n11 = 0 n12 = 0 n13 = 0 n14 = 0 n15 = 0 5 10 7 8  N = 7 + 4 9 6 11 12 13 14 15

Proposition: (N mod 2) is invariant under any legal move of the empty tile Proof: Any horizontal move of the empty tile leaves N unchanged A vertical move of the empty tile changes N by an even increment ( 1  1  1  1) 12 15 11 14 10 13 9 5 6 7 8 4 3 2 1 12 15 11 14 10 13 9 5 6 7 8 4 3 2 1 s’ = s = N(s’) = N(s) + 3 + 1

Proposition: (N mod 2) is invariant under any legal move of the empty tile  For a goal state g to be reachable from a state s, a necessary condition is that N(g) and N(s) have the same parity It can be shown that this is also a sufficient condition  The state graph consists of two connected components of equal size

Searching the State Space It is often not feasible (or too expensive) to build a complete representation of the state graph

8-, 15-, 24-Puzzles 8-puzzle  362,880 states 15-puzzle  2.09 x 1013 states 24-puzzle  1025 states 0.036 sec ~ 55 hours > 109 years 100 millions states/sec

Intractability Constructing the full state graph is intractable for most interesting problems n-puzzle: (n+1)! states k-queens: kk states Tractability of search hinges on the ability to explore only a tiny portion of the state graph!

Searching

Searching the State Space Search tree

Searching the State Space Search tree

Searching the State Space Search tree

Searching the State Space Search tree

Searching the State Space Search tree

Searching the State Space Search tree

Search Nodes and States 8 3 5 2 4 7 1 6 8 3 5 2 4 7 1 6 8 3 5 2 4 7 1 6 If states are allowed to be revisited, the search tree may be infinite even when the state space is finite

Data Structure of a Node PARENT-NODE 8 3 5 2 4 7 1 6 STATE BOOKKEEPING 5 Path-Cost Depth Right Action Expanded yes ... CHILDREN Depth of a node N = length of path from root to N (depth of the root = 0)

Node expansion 1 2 3 4 5 6 7 8 The expansion of a node N of the search tree consists of: Evaluating the successor function on STATE(N) Generating a child of N for each state returned by the function node generation  node expansion N 1 3 5 6 8 4 7 2

Fringe of Search Tree The fringe is the set of all search nodes that haven’t been expanded yet 8 2 3 4 7 5 1 6 8 2 7 3 4 5 1 6 8 2 8 2 8 3 5 2 4 7 1 6 3 4 7 3 4 7 5 1 6 5 1 6

Is it identical to the set of leaves?

Search Strategy The fringe is the set of all search nodes that haven’t been expanded yet The fringe is implemented as a priority queue FRINGE INSERT(node,FRINGE) REMOVE(FRINGE) The ordering of the nodes in FRINGE defines the search strategy

Search Algorithm #1 SEARCH#1 1. If GOAL?(initial-state) then return initial-state 2. INSERT(initial-node,FRINGE) 3. Repeat: 4. If empty(FRINGE) then return failure 5. N  REMOVE(FRINGE) 6. s  STATE(N) 7. For every state s’ in SUCCESSORS(s) 8. Create a new node N’ as a child of N 9. If GOAL?(s’) then return path or goal state 10. INSERT(N’,FRINGE) Expansion of N

Performance Measures Completeness A search algorithm is complete if it finds a solution whenever one exists [What about the case when no solution exists?] Optimality A search algorithm is optimal if it returns a minimum-cost path whenever a solution exists Complexity It measures the time and amount of memory required by the algorithm

Topics of Next 3-4 Classes Blind (uninformed) Search Little or no knowledge about how to search Heuristic (informed) Search How to use extra knowledge about the problem Local Search With knowledge about goal distribution

Recap General problem solving framework State space Successor function Goal test => State graph Search is a methodical way of exploring alternatives

Homework Readings: R&N Ch. 3.4-3.5 HW1 On OnCourse Writing and programming Due date: 9/12