CS 188: Artificial Intelligence Fall 2006

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Review: Search problem formulation
Informed Search Algorithms
Informed search strategies
Informed search algorithms
An Introduction to Artificial Intelligence
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 4 Jim Martin.
Solving Problem by Searching
Announcements Homework 1: Search Project 1: Search Sections
CS 343H: Artificial Intelligence
Review: Search problem formulation
CS 188: Artificial Intelligence Fall 2009 Lecture 3: A* Search 9/3/2009 Dan Klein – UC Berkeley Multiple slides from Stuart Russell or Andrew Moore.
CSC344: AI for Games Lecture 4: Informed search
CS 188: Artificial Intelligence Spring 2006 Lecture 2: Queue-Based Search 8/31/2006 Dan Klein – UC Berkeley Many slides over the course adapted from either.
Informed search algorithms
1 Shanghai Jiao Tong University Informed Search and Exploration.
Quiz 1 : Queue based search  q1a1: Any complete search algorithm must have exponential (or worse) time complexity.  q1a2: DFS requires more space than.
CSE 473: Artificial Intelligence Spring 2012
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.
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.
Advanced Artificial Intelligence Lecture 2: Search.
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
 Graphs vs trees up front; use grid too; discuss for BFS, DFS, IDS, UCS  Cut back on A* optimality detail; a bit more on importance of heuristics, performance.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
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:
Warm-up: Tree Search Solution
CE 473: Artificial Intelligence Autumn 2011 A* Search Luke Zettlemoyer Based on slides from Dan Klein Multiple slides from Stuart Russell or Andrew Moore.
CHAPTER 2 SEARCH HEURISTIC. QUESTION ???? What is Artificial Intelligence? The study of systems that act rationally What does rational mean? Given its.
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.
Lecture 3: Uninformed Search
Review: Tree search Initialize the frontier using the starting state
Announcements Homework 1 Questions 1-3 posted. Will post remainder of assignment over the weekend; will announce on Slack. No AI Seminar today.
Last time: Problem-Solving
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
Heuristic Search Introduction to Artificial Intelligence
Artificial Intelligence Problem solving by searching CSC 361
CS 188: Artificial Intelligence Spring 2007
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.
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
CAP 5636 – Advanced Artificial Intelligence
CS 188: Artificial Intelligence Spring 2007
CS 188: Artificial Intelligence Fall 2008
CS 188: Artificial Intelligence Fall 2008
Lecture 1B: Search.
CS 4100 Artificial Intelligence
Problem Solving and Searching
EA C461 – Artificial Intelligence
Informed search algorithms
Informed search algorithms
Problem Solving and Searching
Artificial Intelligence
Announcements Homework 1: Search Project 1: Search
Warm-up: DFS Graph Search
CSE 473 University of Washington
Announcements This Friday Project 1 due Talk by Jeniya Tabassum
HW 1: Warmup Missionaries and Cannibals
CS 188: Artificial Intelligence Spring 2006
Heuristic Search Generate and Test Hill Climbing Best First Search
HW 1: Warmup Missionaries and Cannibals
Artificial Intelligence
CS 416 Artificial Intelligence
Reading: Chapter 4.5 HW#2 out today, due Oct 5th
Informed Search.
Presentation transcript:

CS 188: Artificial Intelligence Fall 2006 Lecture 3: A* Search 9/4/2007 Dan Klein – UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore

Announcements Sections: Homework New section 106: Tu 5-6pm You can go to any section, if there’s space Sections start this week Homework Project 1 on the web, due 9/12 New written homework format: One or two questions handed out end of section (and online) Due the next week in section, graded check / no check Each assignment 1% of grade, cap of 10%, so can skip at least one week, depends on how many there are Solve in groups of any size, write up alone

Today A* Search Heuristic Design Local Search

Recap: Search Search problems: Search trees: States (configurations of the world) Successor functions, costs, start and goal tests Search trees: Nodes: represent paths / plans Paths have costs (sum of action costs) Strategies differ (only) in fringe management

Expanding includes incrementing the path cost! General Tree Search Expanding includes incrementing the path cost!

Uniform Cost Strategy: expand lowest path cost The good: UCS is complete and optimal! The bad: Explores options in every “direction” No information about goal location … c  1 c  2 c  3 Start Goal

Best First Strategy: expand nodes which appear closest to goal Heuristic: function which maps states to distance A common case: Best-first takes you straight to the (wrong) goal Worst-case: like a badly-guided DFS b … b …

Example: Heuristic Function h(x)

Combining UCS and Greedy Uniform-cost orders by path cost, or backward cost g(n) Best-first orders by goal proximity, or forward cost h(n) A* Search orders by the sum: f(n) = g(n) + h(n) 5 e h=1 1 1 3 2 S a d G h=5 2 1 h=6 h=2 h=0 1 b c h=5 h=4 Example: Teg Grenager

When should A* terminate? Should we stop when we enqueue a goal? No: only stop when we dequeue a goal A 2 2 h = 2 G S h = 3 h = 0 B 3 2 h = 1

Is A* Optimal? 1 A 3 S G 5 What went wrong? Actual bad goal cost > estimated good goal cost We need estimates to be less than actual costs!

Admissible Heuristics A heuristic is admissible (optimistic) if: where is the true cost to a nearest goal E.g. Euclidean distance on a map problem Coming up with admissible heuristics is most of what’s involved in using A* in practice.

Optimality of A*: Blocking Proof: What could go wrong? We’d have to have to pop a suboptimal goal G off the fringe before G* This can’t happen: Imagine a suboptimal goal G is on the queue Some node n which is a subpath of G* must be on the fringe (why?) n will be popped before G …

UCS vs A* Contours Uniform-cost expanded in all directions A* expands mainly toward the goal, but does hedge its bets to ensure optimality Start Goal Start Goal

Properties of A* Uniform-Cost A* b b … …

Admissible Heuristics Most of the work is in coming up with admissible heuristics Inadmissible heuristics are often quite effective (especially when you have no choice) Very common hack: use  x h(n) for admissible h,  > 1 to generate a faster but less optimal inadmissible h’ from admissible h

Example: 8 Puzzle What are the states? What are the actions? What states can I reach from the start state? What should the costs be?

8 Puzzle I Number of tiles misplaced? Why is it admissible? h(start) = This is a relaxed-problem heuristic Average nodes expanded when optimal path has length… …4 steps …8 steps …12 steps ID 112 6,300 3.6 x 106 TILES 13 39 227 8

8 Puzzle II What if we had an easier 8-puzzle where any tile could slide any direction at any time, ignoring other tiles? Total Manhattan distance Why admissible? h(start) = Average nodes expanded when optimal path has length… …4 steps …8 steps …12 steps TILES 13 39 227 MAN-HATTAN 12 25 73 3 + 1 + 2 + … = 18

8 Puzzle III How about using the actual cost as a heuristic? Would it be admissible? Would we save on nodes? What’s wrong with it? With A*: a trade-off between quality of estimate and work per node!

Trivial Heuristics, Dominance Dominance: ha ≥ hc if Heuristics form a semi-lattice: Max of admissible heuristics is admissible Trivial heuristics Bottom of lattice is the zero heuristic (what does this give us?) Top of lattice is the exact heuristic

Course Scheduling From the university’s perspective: Set of courses {c1, c2, … cn} Set of room / times {r1, r2, … rn} Each pairing (ck, rm) has a cost wkm What’s the best assignment of courses to rooms? States: list of pairings Actions: add a legal pairing Costs: cost of the new pairing Admissible heuristics? (Who can think of a cs170 answer to this problem?)

Other A* Applications Pathing / routing problems Resource planning problems Robot motion planning Language analysis Machine translation Speech recognition …

Tree Search: Extra Work? Failure to detect repeated states can cause exponentially more work. Why?

Graph Search In BFS, for example, we shouldn’t bother expanding the circled nodes (why?) S a b d p c e h f r q G

Graph Search Very simple fix: never expand a state twice Can this wreck completeness? Optimality?

Optimality of A* Graph Search Consider what A* does: Expands nodes in increasing total f value (f-contours) Proof idea: optimal goals have lower f value, so get expanded first We made a stronger assumption than in the last proof… What?

Consistency Wait, how do we know we expand in increasing f value? Couldn’t we pop some node n, and find its child n’ to have lower f value? YES: What can we assume to prevent these inversions? Consistency: Real cost always exceeds reduction in heuristic B h = 0 h = 8 3 g = 10 G A h = 10

Optimality Tree search: Graph search: A* optimal if heuristic is admissible (and non-negative) UCS is a special case (h = 0) Graph search: A* optimal if heuristic is consistent UCS optimal (h = 0 is consistent) In general, natural admissible heuristics tend to be consistent

Summary: A* A* uses both backward costs and (estimates of) forward costs A* is optimal with admissible heuristics Heuristic design is key: often use relaxed problems

Large Scale Problems What states get expanded? Goal Start All states with f-cost less than optimal goal cost How far “in every direction” will this be? Intuition: depth grows like the heuristic “gap”: h(start) – g(goal) Gap usually at least linear in problem size Work exponential in depth In huge problems, often A* isn’t enough State space just too big Can’t visit all states with f less than optimal Often, can’t even store the entire fringe Solutions Better heuristics Beam search (limited fringe size) Greedy hill-climbing (fringe size = 1) Goal Start

Limited Memory Options Hill-Climbing Search: Only “best” node kept around, no fringe! Usually prioritize successor choice by h (greedy hill climbing) Compare to greedy backtracking, which still has fringe Beam Search (Limited Memory Search) In between: keep K nodes in fringe Dump lowest priority nodes as needed Can prioritize by h alone (greedy beam search), or h+g (limited memory A*) Why not applied to UCS? We’ll return to beam search later… No guarantees once you limit the fringe size!