Artificial Intelligence

Slides:



Advertisements
Similar presentations
Chapter 4: Informed Heuristic Search
Advertisements

Review: Search problem formulation
Heuristic Search techniques
Intelligence Artificial Intelligence Ian Gent Search: 2.
Intelligence Artificial Intelligence Ian Gent Search: 3.
An Introduction to Artificial Intelligence
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.
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.
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.
Search in AI.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
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.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Lecture 3 Informed Search CSE 573 Artificial Intelligence I Henry Kautz Fall 2001.
Problem Solving and Search in AI Heuristic Search
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.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
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.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
SPANNING TREES Lecture 21 CS2110 – Fall Nate Foster is out of town. NO 3-4pm office hours today!
Fahiem Bacchus © 2005 University of Toronto 1 CSC384: Intro to Artificial Intelligence Search II ● Announcements.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Greedy Algorithms.
BackTracking CS255.
Graphs Representation, BFS, DFS
Heuristic Search Introduction to Artificial Intelligence
Spanning Trees Lecture 21 CS2110 – Fall 2016.
Artificial Intelligence (CS 370D)
Artificial Intelligence Problem solving by searching CSC 361
Algorithms for Exploration
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.
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.
Types of Algorithms.
Informed search algorithms
Heuristic Algorithms via VBA
Advanced Analysis of Algorithms
Informed search algorithms
Applied Combinatorics, 4th Ed. Alan Tucker
A General Backtracking Algorithm
Artificial Intelligence
A General Backtracking Algorithm
Artificial Intelligence
Iterative Deepening CPSC 322 – Search 6 Textbook § 3.7.3
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Backtracking and Branch-and-Bound
CPSC 322 Introduction to Artificial Intelligence
Types of Algorithms.
Efficiently Estimating Travel Time
Heuristic Algorithms via VBA
Heuristic Algorithms via VBA
Graphs.
Graphs.
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
State-Space Searches.
Spanning Trees Lecture 20 CS2110 – Spring 2015.
State-Space Searches.
Graphs.
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
State-Space Searches.
Presentation transcript:

Artificial Intelligence Search: 3 Ian Gent ipg@cs.st-and.ac.uk

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

Search Reminder Search states, Search trees Don’t store whole search trees, just the frontier

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

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

Search in the Eights Puzzle The Eights puzzle is different to (e.g.) SAT can have infinitely long branches if we don’t check for loops bad news for depth-first, still ok for iterative deepening Usually no need to choose variable (e.g. letter in SAT) there is only one piece to move (the blank) we have a choice of places to move it to we might want to minimise length of path in SAT just want satisfying assignment

Search in the Eights Puzzle Are the hard wired methods effective? Breadth-first very poor except for very easy problems Depth-first useless without loop checking not much good with it, either Depth-bounded -- how do we choose depth bound? Iterative deepening ok and we can use increment = 2 (why?) still need good heuristics for move choice Will Best-First be ok?

Search in the Eights Puzzle How can we use Best-First for the Eights puzzle? We need good heuristic for rating states Ideally want to find guaranteed shortest solution Therefore need to take account of moves so far And some way of guaranteeing no better solution elsewhere

Manhattan distance heuristic There is an easy lower bound on #moves required Just calculate how far each piece is from its goal add up this for each piece sum is minimum number of moves possible This is Manhattan distance because pieces move according to Manhattan geometry Manhattan is not exact Why not? Can use it as heuristic as estimate of distance to solution makes sense to explore apparently nearest first

The Eights Puzzle Inaccuracy of Manhattan Manhattan distance = ? optimal solution = 18

Using Heuristics Take the Manhattan distance as an example In Best first, order all states in list by Manhattan In Depth first, order only new states by Manhattan still hope to explore most promising first In Breadth first, similarly Heuristics important to all search algorithms Almost all problems solved by search solved by good heuristics Excepting small problems like 8’s puzzle

Manhattan Distance in 8’s Manhattan distance in 8’s puzzle is NOT a good heuristic It can be misled Suppose we have a small Manhattan distance for move A but any solution for move A must reverse move A eventually (e.g. to allow a vital move B) We have in reality made the solution 2 moves longer moving piece A and then putting it back again Heuristic thinks we are closer to a solution Infinite loops can occur in Best First + Manhattan

Total distance Heuristic Can use Manhattan as basis of excellent heuristic The result will in fact be the A* algorithm sorry about the name pronounced “A star” Total distance heuristic takes account of moves so far Manhattan distance + moves to reach this position This must be a lower bound on #moves from start state to goal state via the current state

A-ghastly name-* Actually the name is just A* The Total distance heuristic has a guarantee 1. heuristic score is guaranteed lower bound on true path cost via the current state 2. heuristic score of solution is the true cost of solution A* = Best First + heuristic with this guarantee A* guarantees that first solution found is optimal Helpful because we can stop searching immediately otherwise must continue to find possible better solutions e.g. in Depth First for 8s puzzle.

The A* Guarantee A* guarantees to find optimal solution Proof: suppose not, and we derive a contradiction Then there is a solution with higher cost found first must be earlier in list than precursor of optimal solution heuristic cost = true cost (by guarantee 2) true cost of worse solution > true cost of optimal true cost of optimal  heuristic cost of precursor (guar. 1)  true cost of worse solution > heuristic cost of precursor  precursor of optimal earlier in list than worse solution Contradiction, w5 (which was what was wanted)

Branch and Bound BnB is not always bed and breakfast Branch and bound is similarly inspired to A* Unlike A* may not guarantee optimal solution first As in A*, look for a bound which is guaranteed lower than the true cost Search the branching tree in any way you like e.g. depth first (no guarantee), best first Cut off search if cost + bound > best solution found If heuristic is cost + bound, search = best first then BnB = A*

BnB example: TSP Consider the Travelling Salesperson Problem Branch and Bound might use depth-first search Cost so far is sum of costs of chosen edges Bound might be cost of following minimum spanning tree of remaining nodes MST: tree connected to all nodes of min cost among all such trees all routes have to visit all remaining nodes can’t possibly beat cost of MST Bounds often much more sophisticated e.g. using mathematical programming optimisations

Summary and Next Lecture Best first tries to explore most promising node first In 8s puzzle, Manhattan distance is one heuristic Total distance is much better and has guarantees Best First + Guarantees = A* Branch and Bound also uses guaranteed bounds Next Lecture: Heuristics in decision problems so far looked at heuristics for optimisation what about when just want any old solution, e.g. SAT Look at heuristics in these situations