Intelligence Artificial Intelligence Ian Gent Search: 3.

Slides:



Advertisements
Similar presentations
Artificial Intelligence: Knowledge Representation
Advertisements

Chapter 4: Informed Heuristic Search
Heuristics, and what to do if you dont know what to do Carl Hultquist.
Informed Search CS 171/271 (Chapter 4)
Review: Search problem formulation
Heuristic Search techniques
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
Intelligence Artificial Intelligence Ian Gent Search: 2.
Intelligence Artificial Intelligence Ian Gent Games 1: Game Tree Search.
Intelligence Artificial Intelligence Ian Gent Search: 1.
Intelligence Artificial Intelligence Ian Gent Constraint Programming 1.
An Introduction to Artificial Intelligence
Informed Search Strategies
18-Dec-14 Pruning. 2 Exponential growth How many leaves are there in a complete binary tree of depth N? This is easy to demonstrate: Count “going left”
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
Introduction to Recursion and Recursive Algorithms
Traveling Salesperson Problem
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 4 Jim Martin.
Intelligence Artificial Intelligence Ian Gent Search: 4 Search Heuristics.
ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.
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.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
Search in AI.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
State Space Search Algorithms CSE 472 Introduction to Artificial Intelligence Autumn 2003.
CPSC 322, Lecture 9Slide 1 Search: Advanced Topics Computer Science cpsc322, Lecture 9 (Textbook Chpt 3.6) January, 23, 2009.
CPSC 322 Introduction to Artificial Intelligence October 27, 2004.
1 Greedy Algorithms. 2 2 A short list of categories Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
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?
Lecture 3 Informed Search CSE 573 Artificial Intelligence I Henry Kautz Fall 2001.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
Search in Artificial Intelligence zFind the next move in chess, checkers. zScheduling: finding a good class schedule. zTheorem proving: given a set of.
Problem Solving and Search in AI Heuristic Search
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.
Backtracking.
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
CS420 lecture eight Greedy Algorithms. Going from A to G Starting with a full tank, we can drive 350 miles before we need to gas up, minimize the number.
State-Space Searches.
Exact methods for ALB ALB problem can be considered as a shortest path problem The complete graph need not be developed since one can stop as soon as in.
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.
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
COMP261 Lecture 7 A* Search. A* search Can we do better than Dijkstra's algorithm? Yes! –want to explore more promising paths, not just shortest so far.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Intelligence Artificial Intelligence Ian Gent Games 2: Alpha Beta.
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.
SPANNING TREES Lecture 21 CS2110 – Fall Nate Foster is out of town. NO 3-4pm office hours today!
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
CSE 326: Data Structures Lecture #17 Heuristic Graph Search Henry Kautz Winter Quarter 2002.
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Spanning Trees Lecture 21 CS2110 – Fall 2016.
Artificial Intelligence Problem solving by searching CSC 361
2 TSP algorithms: (1) AP+B&B, (2) min spanning tree.
Heuristics Definition – a heuristic is an inexact algorithm that is based on intuitive and plausible arguments which are “likely” to lead to reasonable.
Informed search algorithms
Informed search algorithms
Artificial Intelligence
Artificial Intelligence
Artificial Intelligence
Backtracking and Branch-and-Bound
State-Space Searches.
Spanning Trees Lecture 20 CS2110 – Spring 2015.
State-Space Searches.
State-Space Searches.
Presentation transcript:

Intelligence Artificial Intelligence Ian Gent Search: 3

Intelligence Artificial Intelligence Part I :Best First Search Part II: Heuristics for 8s Puzzle Part III:A* Search 3

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

4 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

5 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

6 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

7 Search in the Eights Puzzle zAre the hard wired methods effective? yBreadth-first very poor except for very easy problems yDepth-first useless 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?

8 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

9 Manhattan distance heuristic zThere is an easy lower bound on #moves required zJust calculate how far each piece is from its goal yadd up this for each piece ysum is minimum number of moves possible zThis is Manhattan distance ybecause pieces move according to Manhattan geometry zManhattan is not exact yWhy not? zCan use it as heuristic as estimate of distance to solution ymakes sense to explore apparently nearest first

10 The Eights Puzzle zInaccuracy of Manhattan yManhattan distance = ? yoptimal solution = 18

11 Using Heuristics zTake the Manhattan distance as an example zIn Best first, order all states in list by Manhattan zIn Depth first, order only new states by Manhattan ystill hope to explore most promising first zIn Breadth first, similarly zHeuristics important to all search algorithms yAlmost all problems solved by search solved by good heuristics yExcepting small problems like 8’s puzzle

12 Manhattan Distance in 8’s zManhattan distance in 8’s puzzle is NOT a good heuristic zIt can be misled ySuppose we have a small Manhattan distance for move A ybut any solution for move A must reverse move A eventually (e.g. to allow a vital move B) yWe have in reality made the solution 2 moves longer xmoving piece A and then putting it back again yHeuristic thinks we are closer to a solution zInfinite loops can occur in Best First + Manhattan

13 Total distance Heuristic zCan use Manhattan as basis of excellent heuristic zThe result will in fact be the A* algorithm ysorry about the name ypronounced “A star” zTotal distance heuristic takes account of moves so far yManhattan distance + moves to reach this position z This must be a lower bound on #moves from start state to goal state via the current state

14 A-ghastly name-* zActually the name is just A* zThe Total distance heuristic has a guarantee y1. heuristic score is guaranteed lower bound on true path cost via the current state y2. heuristic score of solution is the true cost of solution zA* = Best First + heuristic with this guarantee zA* guarantees that first solution found is optimal zHelpful because we can stop searching immediately yotherwise must continue to find possible better solutions ye.g. in Depth First for 8s puzzle.

15 The A* Guarantee zA* guarantees to find optimal solution zProof: suppose not, and we derive a contradiction yThen there is a solution with higher cost found first xmust be earlier in list than precursor of optimal solution yheuristic cost = true cost (by guarantee 2) ytrue cost of worse solution > true cost of optimal ytrue cost of optimal  heuristic cost of precursor (guar. 1) y  true cost of worse solution > heuristic cost of precursor y  precursor of optimal earlier in list than worse solution yContradiction, w 5 (which was what was wanted)

16 Branch and Bound zBnB is not always bed and breakfast zBranch and bound is similarly inspired to A* zUnlike A* may not guarantee optimal solution first zAs in A*, look for a bound which is guaranteed lower than the true cost zSearch the branching tree in any way you like ye.g. depth first (no guarantee), best first zCut off search if cost + bound > best solution found zIf heuristic is cost + bound, search = best first ythen BnB = A*

17 BnB example: TSP zConsider the Travelling Salesperson Problem zBranch and Bound might use depth-first search zCost so far is sum of costs of chosen edges zBound might be cost of following minimum spanning tree of remaining nodes MST: tree connected to all nodes of min cost among all such trees yall routes have to visit all remaining nodes ycan’t possibly beat cost of MST zBounds often much more sophisticated ye.g. using mathematical programming optimisations

18 Summary and Next Lecture zSummary yBest first tries to explore most promising node first yIn 8s puzzle, Manhattan distance is one heuristic yTotal distance is much better and has guarantees yBest First + Guarantees = A* yBranch and Bound also uses guaranteed bounds zNext Lecture: Heuristics in decision problems yso far looked at heuristics for optimisation ywhat about when just want any old solution, e.g. SAT yLook at heuristics in these situations