Review: Tree search Initialize the frontier using the starting state

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Lights Out Issues Questions? Comment from me.
Informed search algorithms
Review: Search problem formulation
Informed Search Algorithms
Notes Dijstra’s Algorithm Corrected syllabus.
Informed search strategies
Informed search algorithms
An Introduction to Artificial Intelligence
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
Solving Problem by Searching
1 Heuristic Search Chapter 4. 2 Outline Heuristic function Greedy Best-first search Admissible heuristic and A* Properties of A* Algorithm IDA*
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Informed search algorithms
Informed search algorithms
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
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 strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Search (cont) & CSP Intro Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Dan Klein, Stuart Russell, Andrew Moore,
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Chapter 4 Informed/Heuristic Search
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.
CSC3203: AI for Games Informed search (1) Patrick Olivier
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 Functions. A Heuristic is a function that, when applied to a state, returns a number that is an estimate of the merit of the state, with respect.
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
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.
For Monday Read chapter 4 exercise 1 No homework.
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Lecture 3: Uninformed Search
Last time: Problem-Solving
Heuristic Functions.
Artificial Intelligence (CS 370D)
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CS 4100 Artificial Intelligence
Artificial Intelligence Informed Search Algorithms
EA C461 – Artificial Intelligence
Informed search algorithms
Informed search algorithms
Artificial Intelligence
CSE 473 University of Washington
Announcements This Friday Project 1 due Talk by Jeniya Tabassum
HW 1: Warmup Missionaries and Cannibals
Heuristic Search Generate and Test Hill Climbing Best First Search
HW 1: Warmup Missionaries and Cannibals
Artificial Intelligence
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Solving Problems by Searching
Informed Search.
Presentation transcript:

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 strategy and take it off the frontier If the node contains the goal state, return solution Else expand the node and add its children to the frontier To handle repeated states: Keep an explored set; add each node to the explored set every time you expand it Every time you add a node to the frontier, check whether it already exists in the frontier with a higher path cost, and if yes, replace that node with the new one

Review: Uninformed search strategies Breadth-first search Depth-first search Iterative deepening search Uniform-cost search

Informed search strategies (Sections 3.5-3.6) Idea: give the algorithm “hints” about the desirability of different states Use an evaluation function to rank nodes and select the most promising one for expansion Greedy best-first search A* search

Heuristic function Heuristic function h(n) estimates the cost of reaching goal from node n Example: Start state Goal state

Heuristic for the Romania problem

Greedy best-first search Expand the node that has the lowest value of the heuristic function h(n)

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Greedy best-first search example

Properties of greedy best-first search Complete? No – can get stuck in loops start goal

Properties of greedy best-first search Complete? No – can get stuck in loops Optimal? No

Properties of greedy best-first search Complete? No – can get stuck in loops Optimal? No Time? Worst case: O(bm) Can be much better with a good heuristic Space?

How can we fix the greedy problem? 3 3 2 3 4 3 How about keeping track of the distance already traveled in addition to the distance remaining?

A* search Idea: avoid expanding paths that are already expensive The evaluation function f(n) is the estimated total cost of the path through node n to the goal: f(n) = g(n) + h(n) g(n): cost so far to reach n (path cost) h(n): estimated cost from n to goal (heuristic) Dates back to 1968

A* search example

A* search example

A* search example

A* search example

A* search example

A* search example

Another example Source: Wikipedia

Uniform cost search vs. A* search Source: Wikipedia

Admissible heuristics An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic A heuristic h(n) is admissible if for every node n, h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal state from n Example: straight line distance never overestimates the actual road distance Theorem: If h(n) is admissible, A* is optimal

Optimality of A* Theorem: If the heuristic is admissible, A* without repeated state detection is optimal Proof sketch: Let C* be the evaluation function value (actual path cost) of the first goal node we select for expansion Then all the other nodes on the frontier have estimated path costs to the goal that are at least as big as C* Because we are using an admissible heuristic, the true path costs to the goal for those nodes cannot be less than C* start n frontier Estimated path costs to goal Actual path costs to goal

A* gone wrong? Source: Berkeley CS188x

Consistency of heuristics Source: Berkeley CS188x

Optimality of A* Tree search (i.e., search without repeated state detection): A* is optimal if heuristic is admissible (and non-negative) Graph search (i.e., search with repeated state detection) A* optimal if heuristic is consistent Consistency implies admissibility In general, most natural admissible heuristics tend to be consistent, especially if they come from relaxed problems Source: Berkeley CS188x

Optimality of A* A* is optimally efficient – no other tree-based algorithm that uses the same heuristic can expand fewer nodes and still be guaranteed to find the optimal solution A* expands all nodes for which f(n) ≤ C*. Any algorithm that does not risks missing the optimal solution

Properties of A* Complete? Yes – unless there are infinitely many nodes with f(n) ≤ C* Optimal? Yes Time? Number of nodes for which f(n) ≤ C* (exponential) Space? Exponential

Designing heuristic functions Heuristics for the 8-puzzle h1(n) = number of misplaced tiles h2(n) = total Manhattan distance (number of squares from desired location of each tile) h1(start) = 8 h2(start) = 3+1+2+2+2+3+3+2 = 18 Are h1 and h2 admissible?

Heuristics from relaxed problems A problem with fewer restrictions on the actions is called a relaxed problem The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem If the rules of the 8-puzzle are relaxed so that a tile can move anywhere, then h1(n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square, then h2(n) gives the shortest solution

Heuristics from subproblems Let h3(n) be the cost of getting a subset of tiles (say, 1,2,3,4) into their correct positions Can precompute and save the exact solution cost for every possible subproblem instance – pattern database

Dominance If h1 and h2 are both admissible heuristics and h2(n) ≥ h1(n) for all n, (both admissible) then h2 dominates h1 Which one is better for search? A* search expands every node with f(n) < C* or h(n) < C* – g(n) Therefore, A* search with h1 will expand more nodes

Dominance Typical search costs for the 8-puzzle (average number of nodes expanded for different solution depths): d=12 IDS = 3,644,035 nodes A*(h1) = 227 nodes A*(h2) = 73 nodes d=24 IDS ≈ 54,000,000,000 nodes A*(h1) = 39,135 nodes A*(h2) = 1,641 nodes

h(n) = max{h1(n), h2(n), …, hm(n)} Combining heuristics Suppose we have a collection of admissible heuristics h1(n), h2(n), …, hm(n), but none of them dominates the others How can we combine them? h(n) = max{h1(n), h2(n), …, hm(n)}

Weighted A* search Idea: speed up search at the expense of optimality Take an admissible heuristic, “inflate” it by a multiple α > 1, and then perform A* search as usual Fewer nodes tend to get expanded, but the resulting solution may be suboptimal (its cost will be at most α times the cost of the optimal solution)

Example of weighted A* search Heuristic: 5 * Euclidean distance from goal Source: Wikipedia

Example of weighted A* search Heuristic: 5 * Euclidean distance from goal Source: Wikipedia Compare: Exact A*

Additional pointers Interactive path finding demo Variants of A* for path finding on grids

All search strategies Algorithm Complete? Optimal? Time complexity Space complexity BFS DFS IDS UCS Greedy A* If all step costs are equal Yes O(bd) O(bd) No No O(bm) O(bm) If all step costs are equal Yes O(bd) O(bd) Yes Yes Number of nodes with g(n) ≤ C* Worst case: O(bm) No No Best case: O(bd) Yes (if heuristic is admissible) Yes Number of nodes with g(n)+h(n) ≤ C*

A note on the complexity of search We said that the worst-case complexity of search is exponential in the length of the solution path But the length of the solution path can be exponential in the number of “objects” in the problem! Example: towers of Hanoi