State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Artificial Intelligence
Chapter 4: Informed Heuristic Search
CMSC 471 Fall 2002 Class #5-6 – Monday, September 16 / Wednesday, September 18.
Heuristic Searches. Feedback: Tutorial 1 Describing a state. Entire state space vs. incremental development. Elimination of children. Closed and the solution.
Review: Search problem formulation
Informed Search Algorithms
Heuristic Search techniques
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
State Space Heuristic Search. Three Algorithms  Backtrack  Depth First  Breadth First All work if we have well-defined:  Goal state  Start state.
Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Traveling Salesperson Problem
CSE 390B: Graph Algorithms Based on CSE 373 slides by Jessica Miller, Ruth Anderson 1.
Heuristic Search Chapter 3.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
Chapter 4 Search Methodologies.
Artificial Intelligence (CS 461D)
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.
Heuristic search, page 1 CSI 4106, Winter 2005 Heuristic search Points Definitions Best-first search Hill climbing Problems with hill climbing An example:
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
HEURISTIC SEARCH Heuristics: Rules for choosing the branches in a state space that are most likely to lead to an acceptable problem solution. Used when:
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Informed Search Idea: be smart about what paths to try.
Busby, Dodge, Fleming, and Negrusa. Backtracking Algorithm Is used to solve problems for which a sequence of objects is to be selected from a set such.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
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.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
For Monday Read chapter 4, section 1 No homework..
Search exploring the consequences of possible actions.
Advanced Artificial Intelligence Lecture 2: Search.
Informed Search I (Beginning of AIMA Chapter 4.1)
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search CSE 473 University of Washington.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Searching for Solutions
Breadth First and Depth First
Last time: Problem-Solving
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.
Backtracking And Branch And Bound
Department of Computer Science
Artificial Intelligence (CS 370D)
Backtracking And Branch And Bound
Alyce Brady CS 470: Data Structures CS 510: Computer Algorithms
CS Fall 2016 (Shavlik©), Lecture 8, Week 5
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
Breadth First Search 11/21/ s
EA C461 – Artificial Intelligence
Searching for Solutions
Breadth-First Searches
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
Blay Whitby 2003 Search Blay Whitby 2003
CSE 373: Data Structures and Algorithms
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
CSE 473 University of Washington
Heuristic Search Methods
Breadth First Search s
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
Backtracking And Branch And Bound
Breadth First Search s
HW 1: Warmup Missionaries and Cannibals
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Informed Search Idea: be smart about what paths to try.
Lecture 4: Tree Search Strategies
Presentation transcript:

State Space 3 Chapter 4 Heuristic Search

Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state State transition rules But could take a long time

Heuristic An informed guess that guides search through a state space Can result in a suboptimal solution

Blocks World: A Stack of Blocks StartGoal AD BC CB DA Two rules: clear(X)  on(X, table) clear(X) ^ clear(Y)  on(X,Y) Generate part of the search space BF. We’ll find the answer, but it could take a long time.

Heuristic 1 1. For each block that is resting where it should, subtract 1 2. For each block that is not resting where it should, add 1

Hill Climbing 1. At every level, generate all children 2. Continue down path with lowest score Define three functions: f(n) = g(n) + h(n) Where: h(n) is the heuristic estimate for n--guides the search g(n) is path length from start to current node—ensures that we choose node closest to root when more than 1 have same h value

Problem: heuristic is local Given CandCB BDA A D At level n The f(n) of each structure is the same f(n) = g(n) = ( ) = g(n) But which is actually better

Problem with local heuristics C B A D Must be entirely undone Goal Requires 6 moves CB DA Goal requires only two moves

Global Heuristic Takes the entire structure into account 1. Subtract 1 for each block that has correct support structure 2. Add 1 for each block in an incorrect support structure

Seems to Work Goal:D C B A C f(n) = g(n) + ( ) =g(n) + 6 B A D CB f(n) = g(n) + ( ) = g(n) DA So the heuristic correctly chose the second structure

Best First The Road Not Taken Open contains current fringe of the search Open: priority queue ordered by f(n) Closed: queue of states already visited Nodes could contain backward pointers so that path back to root can be recovered

path best_first(Start) { open = [start], closed = []; while (!open.isEmpty()) { cs = open.serve(); if (cs == goal) return path; generate children of cs; for each child { case: { child is on open;//node has been reached by a shorter path if (g(child) < g(child) on open) g(child on open) = g(child); break; child is on closed; if (g(child < g(child on closed)) { //node has been reached by a shorter path and is more attractive remove state from closed; open.enqueue(child); } break; default: { f(child) = g(child) + h(child);//child has been examined yet open.enqueue(child); } closed.enqueue(cs);//all cs’ children have been examined. open.reorder();//reorder queue because case statement may have affected ordering } return([]); //failure }

Admissibility Admissible Search Algorithms ◦Find the optimal path to the goal if a path to the goal exists Breadth-First: Admissible Depth-First: Not admissible

Algorithm A Uses Best First f(n) = g(n) + h(n)

f* f*(n) = g*(n) + h*(n) Where g*(n) is the cost of the shortest path from start to n h*(n) is the cost of the shortest path from n to goal So, f*(n) is the actual cost of the optimal path Can we know f*(n)?

The Oracle Not without having exhaustively searched the graph Goal: Approximate f*(n)

Consider g*(n) g(n) – actual cost to n g*(n) – shortest path from start to n So g(n) >= g*(n) When g*(n) = g(n), the search has discovered the optimal path to n

Consider h*(n) Often we can know ◦If h(n) is bounded above by h*(n) ◦(This sometimes means finding a function h2(n) such that h(n) <= h2(n) <= h*(n)) Meaning: the optimal path is more expensive than the one suggested by the heuristic Turns out this is a good thing (within bounds)

An 8-puzzle Intuition > Invent two heuristics: h1 and h2 h1(n): number of tiles not in goal position h1(n) = 5 (1,2,6,8,B) h2(n): number of moves required to move out-of-place tiles to goal T1 = 1, T2 = 1, T6 = 1, T8 = 2, TB = 1 h2(n) = 6 h1(n) <= h2(n) ?

h1(n) is bounded above by h*(n) h2(n) <= h*(n) Each out-of-place tile has to be moved a certain distance to reach goal h1(n) <= h2(n) h2(n) requires moving out-of-place tiles at least as far as h1(n) So, h1(n) <= h2(n) <=h*(n)

Leads to a Definition A* If algorithm A uses a heuristic that returns a value h(n) <= h*(n) for all n, then it is called A* What does this property mean?

It means that the heuristic estimate chosen never thinks a path is better than it is goal Suppose: h(rst) = 96 But we know it is really 1 (i.e. h*(rst) = 1) because we’re the oracle Suppose: h(lst) = 42 Left branch looks better than it really is This makes the left branch seem better than it actually is

Claim: All A* Algorithms are admissible Suppose: 1. h(n) = 0 and so <= h*(n) Search will be controlled by g(n) If g(n) = 0, search will be random: given enough time, we’ll find an optimal path to the goal If g(n) is the actual cost to n, f(n) becomes breadth-first because the sole reason for examining a node is its distance from start. We already know that this terminates in an optimal solution

2. h(n) = h*(n) Then the algorithm will go directly to the goal since h*(n) computes the shortest path to the goal Therefore, if our algorithm is between these two extremes, our search will always result in an optimal solution Call h(n) = 0, h’(n) So, for any h such that h’(n) <= h(n) <= h*(n) we will always find an optimal solution The closer our algorithm is to h’(n), the more extraneous nodes we’ll have to examine along the way

Informedness For any two A* heuristics, ha, hb If ha(n) <= hb(n), hb(n) is more informed.

Comparison Comparison of two solutions that discover the optimal path to the goal state: 1. BF: h(n) = 0 2. h(n) = number of tiles out of place The better informed solution examines less extraneous information on its path to the goal