Heuristic search, page 1 CSI 4106, Winter 2005 Heuristic search Points Definitions Best-first search Hill climbing Problems with hill climbing An example:

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Informed search algorithms
An Introduction to Artificial Intelligence
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.
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.
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.
Mahgul Gulzai Moomal Umer Rabail Hafeez
Problem Solving by Searching
Review: Search problem formulation
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2005.
Find a Path s A D B E C F G Heuristically Informed Methods  Which node do I expand next?  What information can I use to guide this.
Problem Solving and Search in AI Heuristic Search
Review Best-first search uses an evaluation function f(n) to select the next node for expansion. Greedy best-first search uses f(n) = h(n). Greedy best.
CSC344: AI for Games Lecture 4: Informed search
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:
Informed Search Next time: Search Application Reading: Machine Translation paper under Links Username and password will be mailed to class.
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.
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Informed Search Methods
Informed Search Idea: be smart about what paths to try.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Informed State Space Search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Informed search algorithms
Informed search algorithms
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
1 Shanghai Jiao Tong University Informed Search and Exploration.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed Search Include specific knowledge to efficiently conduct the search and find the solution.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
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.
Lecture 3: Uninformed Search
For Wednesday Read chapter 6, sections 1-3 Homework: –Chapter 4, exercise 1.
For Wednesday Read chapter 5, sections 1-4 Homework: –Chapter 3, exercise 23. Then do the exercise again, but use greedy heuristic search instead of A*
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
Local Search and Optimization Presented by Collin Kanaley.
1 Kuliah 4 : Informed Search. 2 Outline Best-First Search Greedy Search A* Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Informed Search II CIS 391 Fall CIS Intro to AI 2 Outline PART I  Informed = use problem-specific knowledge  Best-first search and its variants.
Heuristic Search Foundations of Artificial Intelligence.
Searching for Solutions
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
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.
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Artificial Intelligence Problem solving by searching CSC 361
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.
The A* Algorithm Héctor Muñoz-Avila.
Heuristic search INT 404.
Heuristics Local Search
More on Search: A* and Optimization
Heuristics Local Search
Lecture 9 Administration Heuristic search, continued
HW 1: Warmup Missionaries and Cannibals
More advanced aspects of search
Informed Search Idea: be smart about what paths to try.
HW 1: Warmup Missionaries and Cannibals
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

Heuristic search, page 1 CSI 4106, Winter 2005 Heuristic search Points Definitions Best-first search Hill climbing Problems with hill climbing An example: local and global heuristic functions Simulated annealing The A* procedure Means-ends analysis

Heuristic search, page 2 CSI 4106, Winter 2005 Definitions Heuristics (Greek heuriskein = find, discover): "the study of the methods and rules of discovery and invention". We use our knowledge of the problem to consider some (not all) successors of the current state (preferably just one, as with an oracle). This means pruning the state space, gaining speed, but perhaps missing the solution! In chess: consider one (apparently best) move, maybe a few -- but not all possible legal moves. In the travelling salesman problem: select one nearest city, give up complete search (the greedy technique). This gives us, in polynomial time, an approximate solution of the inherently exponential problem; it can be proven that the approximation error is bounded.

Heuristic search, page 3 CSI 4106, Winter 2005 Definitions (2) For heuristic search to work, we must be able to rank the children of a node. A heuristic function takes a state and returns a numeric value -- a composite assessment of this state. We then choose a child with the best score (this could be a maximum or minimum). A heuristic function can help gain or lose a lot, but finding the right function is not always easy. The 8-puzzle: how many misplaced tiles? how many slots away from the correct place? and so on. Water jugs: ??? Chess: no simple counting of pieces is adequate.

Heuristic search, page 4 CSI 4106, Winter 2005 Definitions (3) The principal gain -- often spectacular -- is the reduction of the state space. For example, the full tree for Tic-Tac-Toe has 9! leaves. If we consider symmetries, the tree becomes six times smaller, but it is still quite large. With a fairly simple heuristic function we can get the tree down to 40 states. (More on this when we discuss games.) Heuristics can also help speed up exhaustive, blind search, such as depth-first and breadth- first search.

Heuristic search, page 5 CSI 4106, Winter 2005 Best-first search The algorithm select a heuristic function (e.g., distance to the goal); put the initial node(s) on the open list; repeat select N, the best node on the open list; succeed if N is a goal node; otherwise put N on the closed list and add N's children to the open list; until we succeed or the open list becomes empty (we fail); A closed node reached on a different path is made open. NOTE: "the best" only means "currently appearing the best"...

Heuristic search, page 6 CSI 4106, Winter 2005 Hill climbing This is a greedy algorithm: go as high up as possible as fast as possible, without looking around too much. The algorithm select a heuristic function; set C, the current node, to the highest-valued initial node; loop select N, the highest-valued child of C; return C if its value is better than the value of N; otherwise set C to N;

Heuristic search, page 7 CSI 4106, Winter 2005 Problems with hill climbing 1.Local maximum, or the foothill problem: there is a peak, but it is lower than the highest peak in the whole space. 2.The plateau problem: all local moves are equally unpromising, and all peaks seem far away. 3.The ridge problem: almost every move takes us down. Random-restart hill climbing is a series of hill- climbing searches with a randomly selected start node whenever the current search gets stuck. See also simulated annealing -- in a moment.

Heuristic search, page 8 CSI 4106, Winter 2005 A hill climbing example

Heuristic search, page 9 CSI 4106, Winter 2005 A hill climbing example (2) A local heuristic function Count +1 for every block that sits on the correct thing. The goal state has the value +8. Count -1 for every block that sits on an incorrect thing. In the initial state blocks C, D, E, F, G, H count +1 each. Blocks A, B count -1 each, for the total of +4. Move 1 gives the value +6 (A is now on the correct support). Moves 2a and 2b both give +4 (B and H are wrongly situated). This means we have a local maximum of +6.

Heuristic search, page 10 CSI 4106, Winter 2005 A hill climbing example (3) A global heuristic function Count +N for every block that sits on a correct stack of N things. The goal state has the value +28. Count -N for every block that sits on an incorrect stack of N things. That is, there is a large penalty for blocks tied up in a wrong structure. In the initial state C, D, E, F, G, H count -1, -2, -3, -4, -5, -6. A counts -7, for the total of -28. continued

Heuristic search, page 11 CSI 4106, Winter 2005 A hill climbing example (4) Move 1 gives the value -21 (A is now on the correct support). Move 2a gives -16, because C, D, E, F, G, H count -1, -2, -3, -4, -5, -1. Move 2b gives -15, because C, D, E, F, G count -1, -2, -3, -4, -5. There is no local maximum! Moral: sometimes changing the heuristic function is all we need.

Heuristic search, page 12 CSI 4106, Winter 2005 Simulated annealing The intuition for this search method, an improvement on hill-climbing, is the process of gradually cooling a liquid. There is a schedule of "temperatures", changing in time. Reaching the "freezing point" (temperature 0) stops the process. Instead of a random restart, we use a more systematic method.

Heuristic search, page 13 CSI 4106, Winter 2005 Simulated annealing (2) The algorithm, one of the versions select a heuristic function f; set C, the current node, to any initial node; set t, the current time, to 0; let schedule(x) be a table of "temperatures”; loop t = t + 1; if schedule(t) = 0, return C; select at random N, any child of C; if f(N) > f(C), set C to N, otherwise set C to N with probability e (f(N)-f(C))/schedule(t) ;

Heuristic search, page 14 CSI 4106, Winter 2005 A few other search ideas Stochastic beam search: select w nodes at random; nodes with higher values have a higher probability of selection. Genetic algorithms: generate nodes like in stochastic beam search, but from two parents rather than from one. (This topic is worthy of a separate lecture...)

Heuristic search, page 15 CSI 4106, Winter 2005 The A* procedure Hill-climbing (and its clever versions) may miss an optimal solution. Here is a search method that ensures optimality of the solution. The algorithm keep a list of partial paths (initially root to root, length 0); repeat succeed if the first path P reaches the goal node; otherwise remove path P from the list; extend P in all possible ways, add new paths to the list; sort the list by the sum of two values: the real cost of P till now, and an estimate of the remaining distance; prune the list by leaving only the shortest path for each node reached so far; until success or the list of paths becomes empty;

Heuristic search, page 16 CSI 4106, Winter 2005 The A* procedure (2) A* requires a lower-bound estimate of the distance of any node to the goal node. A heuristic that never overestimates is also called optimistic or admissible. We consider three functions with values ≥ 0: g(n) is the actual cost of reaching node n, h(n) is the actual unknown remaining cost, h'(n) is the optimistic estimate of h(n).

Heuristic search, page 17 CSI 4106, Winter 2005 The A* procedure (3) Here is a sketchy proof of the optimality of the goal node found by A*. Let m be such a non-optimal goal: g(m) > g(n k ) and let n 0, n 1,..., n k be a path leading to n k. Since m is a goal, h(m) = 0 and thus h'(m) = 0. Every step of A* selects the next n i in such a way that g(n i ) + h'(n i ) ≤ g(n i ) + h(n i ) = g(n k ) < g(m) = g(m) + h'(m) In other words, g(n i ) + h'(n i ) < g(m) + h'(m), so that A* cannot have selected m.

Heuristic search, page 18 CSI 4106, Winter 2005 The A* procedure (4) A simple search problem: S is the start node, G is the goal node, the real distances are shown. A lower-bound estimate of the distance to G could be as follows (note that we do not need it for F): A B C D E F G S A B C D E F G S

Heuristic search, page 19 CSI 4106, Winter 2005 The A* procedure (5) Hill-climbing happens to succeed here: S A D A B F G S E D E

Heuristic search, page 20 CSI 4106, Winter 2005 The A* procedure (6) A*, step 1 S A D

Heuristic search, page 21 CSI 4106, Winter 2005 The A* procedure (7) A*, step 2 S A D B D

Heuristic search, page 22 CSI 4106, Winter 2005 The A* procedure (8) A*, step 3 S A D B C D E

Heuristic search, page 23 CSI 4106, Winter 2005 The A* procedure (9) A*, step 4 S A D B C E D A E

Heuristic search, page 24 CSI 4106, Winter 2005 The A* procedure (10) A*, step 5 S A D B C E F D A E B

Heuristic search, page 25 CSI 4106, Winter 2005 The A* procedure (11) A*, step 6 S A D B C E F G D A E B

Heuristic search, page 26 CSI 4106, Winter 2005 The A* procedure (12) The 8-puzzle with optimistic heuristics. A,..., N: states; m = misplaced; d = depth; f(x) = m(x) + d(x).

Heuristic search, page 27 CSI 4106, Winter 2005 Means-ends analysis The idea is due to Newell and Simon (1957): work by reducing the difference between states, and so approaching the goal state. There are procedures, indexed by differences, that change states. The General Problem Solver algorithm set C, the current node, to any initial node; loop succeed if the goal state has been reached, otherwise find the difference between C and the goal state; choose a procedure that reduces this difference, apply it to C to produce the new current state;

Heuristic search, page 28 CSI 4106, Winter 2005 Means-ends analysis (2) An example: planning a trip. miles PlaneTrainCarTaxiWalk > 1000X XX XX < 1X PrerequisiteAt planeAt trainAt carAt taxi DistanceDistance P r o c e d u r e