Intelligence Artificial Intelligence Ian Gent Search: 2.

Slides:



Advertisements
Similar presentations
Uninformed Search in Prolog
Advertisements

Artificial Intelligence: Knowledge Representation
Solving problems by searching
Heuristic Search techniques
Intelligence Artificial Intelligence Ian Gent Search: 3.
Intelligence Artificial Intelligence Ian Gent Search: 1.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal.
Traveling Salesperson Problem
Boggle Game: Backtracking Algorithm Implementation
Types of Algorithms.
Intelligence Artificial Intelligence Ian Gent Search: 4 Search Heuristics.
CS 480 Lec 3 Sept 11, 09 Goals: Chapter 3 (uninformed search) project # 1 and # 2 Chapter 4 (heuristic search)
Binary Trees CS 110: Data Structures and Algorithms First Semester,
Artificial Intelligence (CS 461D)
Using Search in Problem Solving
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Artificial Intelligence Methods Rao Vemuri Searching - 2.
1 Algorithm Strategies. 2 Introduction zAlgorithms may be grouped into categories or types. zThis is based upon how they go about finding a solution to.
Search  Exhaustive/Blind Search Methods Depth First Search Breadth First Search  Heuristic Methods Hill Climbing Beam Search Best First Search…
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.
Informed Search Idea: be smart about what paths to try.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Compiled by: Dr. Mohammad Alhawarat BST, Priority Queue, Heaps - Heapsort CHAPTER 07.
1 Trees A tree is a data structure used to represent different kinds of data and help solve a number of algorithmic problems Game trees (i.e., chess ),
Trees – Part 2 CS 367 – Introduction to Data Structures.
Today’s Topics FREE Code that will Write Your PhD Thesis, a Best-Selling Novel, or Your Next Methods for Intelligently/Efficiently Searching a Space.
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.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 02 : Search.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
Search exploring the consequences of possible actions.
G5BAIM Artificial Intelligence Methods Graham Kendall Searching.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
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.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Blind Searches - Introduction.
Union By Rank Ackermann’s Function Graph Algorithms Rajee S Ramanikanthan Kavya Reddy Musani.
Artificial Intelligence Solving problems by searching.
ARTIFICIAL INTELLIGENCE
Traveling Salesperson Problem
Breadth First and Depth First
Backtracking And Branch And Bound
Iterative Deepening Search
Artificial Intelligence (CS 370D)
Types of Algorithms.
CS Fall 2016 (Shavlik©), Lecture 8, Week 5
Lesson Objectives Aims
CSE 4705 Artificial Intelligence
Depth-First Searches Introduction to AI.
Search Exercise Search Tree? Solution (Breadth First Search)?
A General Backtracking Algorithm
Artificial Intelligence
Artificial Intelligence
Artificial Intelligence
Artificial Intelligence
CSE (c) S. Tanimoto, 2002 State-Space Search
More advanced aspects of search
Tree Searching.
Informed Search Idea: be smart about what paths to try.
State-Space Searches.
ARTIFICIAL INTELLIGENCE
State-Space Searches.
CSE (c) S. Tanimoto, 2004 State-Space Search
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Lecture 4: Tree Search Strategies
Supplemental slides for CSE 327 Prof. Jeff Heflin
Depth-First Searches.
Presentation transcript:

Intelligence Artificial Intelligence Ian Gent Search: 2

Intelligence Artificial Intelligence Part I :The Eights Puzzle Part II: Search Algorithms via lists Part II: Best First Search Search 2

3 The Eights Puzzle zSliding blocks puzzle, more usually 15 puzzle yshows you the state of AI in the sixties yhow many moves between these states?

4 Search Reminder zSearch states, Search trees zDon’t store whole search trees, just the frontier

5 Frontiers as lists zOne way to implement search algorithms is via lists yLists fundamental in AI programming xmain data structure in Lisp, Prolog xmakes list processing really easy (no pointers) x zLists can easily store frontier of search zEach element in list is search state zDifferent algorithms manipulate list differently

6 A general search algorithm z1. Form a one element list with null state z2. Loop Until (either list empty or we have a solution) yRemove the first state X from the list yChoose the next decision to make e.g. which letter to set in SAT, which city to choose successor in TSP yCreate a new state for each possible choice of decision e.g. upper/lower case, Walla Walla/Oberlin/Ithaca yMERGE the set of new states into the list different algorithms will have different MERGE methods z3. If (solution in list) succeed y else list must be empty, so fail

7 Depth First Search zThe most important AI search algorithm? zMERGE = push ytreat list as a stack ynew search states to explore at front of list, get treated first zWhat about when many new states created? yWe use a heuristic to decide what order to push new states yall new states in front of all old states in the list zWhat about when no new states created? yWe must be at a leaf node in the search tree ywe have to backtrack to higher nodes

8 Breadth First Search zMERGE = add to end ytreat list as a queue ynew search states to explore at end of list, zWhat about when many new states created? yWe use a heuristic to decide what order to add new states zBreadth first considers all states at a given depth in the search tree before going on to the next depth ycompare with depth-first, ydepth-first considers all children of current node before any other nodes in the search tree ylist can be exponential size -- all nodes at given depth

9 Depth-First-Depth-Bounded Search zAs depth-first search zDisallow nodes beyond a certain depth d in tree yto implement, add depth in tree to search state zCompare DFDB with Depth-first yDFDB: always finds solution at depth <= d xDF may find very deep solution before shallow ones yDFDB: never goes down infinite branch xrelevant if search tree contains infinite branches e.g. Eights puzzle yDFDB: we have a resource limit (b^d if b branching rate) yHow do we choose d?

10 Iterative Deepening Search zNo longer a simple instance of general search yd = min-d yLoop Until (solution found) xapply DFDB(d) xd := d + increment zWhy? yGuarantees to find a solution if one exists (cf DFDB) yFinds shallow solutions first (cf DF) yAlways has small frontier (cf Breadth First) ySurprising asymptotic guarantees xsearch time typically no more than d/(d-1) as bad as DF

11 Why is Iterative deepening ok? zSuppose increment = 1, solution at depth d yhow much more work do we expect to do in I.D. vs DF ? zI.d. repeats work from depths 1 to d  d i=1 b i = b d+1 / (b - 1) zRatio to b d = b d+1 / b d (b - 1) = b/(b-1) zSo we only do b/(b-1) times as much work as we need to ye.g. even if b=2, only do twice as much work zVery often worth the overhead for the advantages

12 Comparing Search Algorithms

13 Best First Search zAll the algorithms up to now have been hard wired yI.e. they search the tree in a fixed order yuse heuristics only to choose among a small number of choices xe.g. which letter to set in SAT / whether to be A or a zWould it be a good idea to explore the frontier heuristically? zI.e. use the most promising part of the frontier? zThis is Best First Search

14 Best First Search zBest First Search is still an instance of general algorithm zNeed heuristic score for each search state zMERGE: merge new states in sorted order of score yI.e. list always contains most promising state first ycan be efficiently done if use (e.g.) heap for list no, heaps not done for free in Lisp, Prolog. zSearch can be like depth-first, breadth-first, or in- between ylist can become exponentially long

15 Search in the Eights Puzzle zThe Eights puzzle is different to (e.g.) SAT ycan have infinitely long branches if we don’t check for loops xbad news for depth-first, xstill ok for iterative deepening yUsually no need to choose variable (e.g. letter in SAT) xthere is only one piece to move (the blank) xwe have a choice of places to move it to ywe might want to minimise length of path xin SAT just want satisfying assignment

16 Search in the Eights Puzzle zAre the hard wired methods effective? yBreadth-first very poor except for very easy problems yDepth-first useful without loop checking xnot much good with it, either yDepth-bounded -- how do we choose depth bound? yIterative deepening ok xand we can use increment = 2 (why?) xstill need good heuristics for move choice zWill Best-First be ok?

17 Search in the Eights Puzzle zHow can we use Best-First for the Eights puzzle? zWe need good heuristic for rating states zIdeally want to find guaranteed shortest solution yTherefore need to take account of moves so far yAnd some way of guaranteeing no better solution elsewhere

18 Next week in Search for AI zHeuristics for the Eights Puzzle zthe A* algorithm