State Space 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
Lights Out Issues Questions? Comment from me.
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 Ref: Chapter 4.
CMSC 671 Fall 2005 Class #5 – Thursday, September 15.
Informed search algorithms
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
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
Informed search algorithms
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.
Heuristic Search Chapter 3.
Solving Problem by Searching
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.
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.
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Using Search in Problem Solving
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:
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Brute Force Search Depth-first or Breadth-first search
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.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed Search Strategies
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.
CS 415 – A.I. Slide Set 6. Chapter 4 – Heuristic Search Heuristic – the study of the methods and rules of discovery and invention State Space Heuristics.
For Monday Read chapter 4, section 1 No homework..
Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search CSE 473 University of Washington.
Knowledge Search CPTR 314.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Ch. 3 – Search Supplemental slides for CSE 327 Prof. Jeff Heflin.
Review: Tree search Initialize the frontier using the starting state
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
Backtracking And Branch And Bound
Algorithms for Exploration
CS Fall 2016 (Shavlik©), Lecture 8, Week 5
Breadth-First Searches
BEST FIRST SEARCH -OR Graph -A* Search -Agenda Search CSE 402
Warm-up: DFS Graph Search
(1) Breadth-First Search  S Queue S
CSE 473 University of Washington
Heuristic Search Methods
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
Backtracking And Branch And Bound
Heuristic Search Generate and Test Hill Climbing Best First Search
HW 1: Warmup Missionaries and Cannibals
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Tree Searching Strategies
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
Depth-First Searches.
Presentation transcript:

State Space 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)

All Three Algorithms will find a solution Partial Look At Search Space ABCDBCDA CBC CBC B A DAD B A DAD Etc.

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 AD At level n The f(n) of each structure is the same f(n) = g(n) = ( ) = g(n) But which is actually better

The vertical structure must be undone entirely C B B A A A D C DCB ABCD BC D ACDB ADDCBA For a total of 6 moves

But CBCD DABC ADB A 2 moves

Task Design a global heuristic that 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

f(n) = g(n) + ( ) =g(n) + 6 CB Agoal D DC BA CB f(n) = g(n) + ( ) = g(n) DA So the heuristic correctly chose the second structure

Leads to a New Algorithm: Best First The Road Not Taken The Road Not Taken Best first  Keeps nodes on open in a priority queue ordered by h(n) so that if it goes down a bad path that at first looks good, it can retry a new path  Contains algorithm for generating h(n)  Nodes could contain backward pointers so that path back to root can be recovered

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

State Space of a Hypothetical Search Next Slide  Goal: P  States with attached evaluations are those generated by best-first  States expanded by best-first are indicated in bold  Just before evaluating O, closed contains HCBA  Just before evaluating O, open contains OPGEFD

Admissibility  A search algorithm is admissible if it finds the optimal path whenever one exists  BF is admissible  DF is not admissible  Suppose on the previous slide Node S were replaced by a P  The optimal path is ACHP  But DF discovers ABEKP

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

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)  We can’t know it unless exhaustive search is possible and we’ve already searched the state space  But we can know sometimes if a given h-1(n) is bounded above by some h-2(n)

8-puzzle Example > h-1(n)  number of tiles not in goal position = 5 (1,2,6,8, B) H-2(n)  number of moves required to move them to goal (T1 = 1, T2 = 1, T6 = 1, T8 = 2, TB = 1) = 6 So h-1(n) <= h-2(n)

h-2(n) cannot exceed h*(n) because each tile has to be moved a certain distance to reach goal no matter what. h-2(n) could equal h*(n) h-1(n) is certainly <= h-2(n) which requires moving each incorrect tile at least as far as h-1(n) So, h-1(n) <= h-2(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*

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 If g(n) is the actual cost to n, f(n) becomes BF 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, h-a, h-b If h-a(n) <= h-b(n), h-b(n) is more informed.

Comparison  h-a is BF  h-b is the # of tiles out of place  Since h-a is 0, h-b is better informed than h-a

P. 149 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