DOC PREVIEW
Berkeley COMPSCI 188 - Lecture Notes

This preview shows page 1-2-3-4-5-6 out of 18 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 18 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Announcements Project 1: Search It’s live! Due 9/14. Start early and ask questions. It’s longer than most! Need a partner? Come up after class or try Piazza Sections: can go to any, but have priority in your ownCS 188: Artificial IntelligenceFall 2011Lecture 3: A* Search9/1/2011Dan Klein – UC BerkeleyMultiple slides from Stuart Russell or Andrew Moore2Today A* Search Graph Search Heuristic DesignUCS GreedyA*Recap: Search Search problem: States (configurations of the world) Successor function: a function from states to lists of (state, action, cost) triples; drawn as a graph Start state and goal test Search tree: Nodes: represent plans for reaching states Plans have costs (sum of action costs) Search Algorithm: Systematically builds a search tree Chooses an ordering of the fringe (unexplored nodes) Optimal: finds least-cost plans3Example: Pancake ProblemCost: Number of pancakes flippedExample: Pancake Problem324332224State space graph with costs as weights343424General Tree SearchAction: flip top twoCost: 2Action: flip all fourCost: 4Path to reach goal:Flip four, flip threeTotal cost: 7Uniform Cost Search Strategy: expand lowest path cost The good: UCS is complete and optimal! The bad: Explores options in every “direction” No information about goal locationStartGoal…c ≤ 3c ≤ 2c ≤ 1[demo: countours UCS]5Example: Heuristic FunctionHeuristic: the largest pancake that is still out of place4302333443444h(x)Example: Heuristic Functionh(x)6Best First (Greedy) Strategy: expand a node that you think is closest to a goal state Heuristic: estimate of distance to nearest goal for each state A common case: Best-first takes you straight to the (wrong) goal Worst-case: like a badly-guided DFS…b…b[demo: countours greedy]Combining UCS and Greedy Uniform-cost orders by path cost, or backward cost g(n) Greedy orders by goal proximity, or forward cost h(n) A* Search orders by the sum: f(n) = g(n) + h(n)S a dbGh=5h=6h=215112h=6h=0ch=73eh=11Example: Teg Grenager7 Should we stop when we enqueue a goal? No: only stop when we dequeue a goalWhen should A* terminate?SBAG2322h = 1h = 2h = 0h = 3Is A* Optimal?AGS13h = 6h = 05h = 7 What went wrong? Actual bad goal cost < estimated good goal cost We need estimates to be less than actual costs!8Admissible Heuristics A heuristic h is admissible (optimistic) if:where is the true cost to a nearest goal Examples: Coming up with admissible heuristics is most of what’s involved in using A* in practice.415Optimality of A*: Blocking…Notation: g(n) = cost to node n h(n) = estimated cost from n to the nearest goal (heuristic) f(n) = g(n) + h(n) =estimated total cost via n G*: a lowest cost goal node G: another goal node9Optimality of A*: BlockingProof: 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 also be on the fringe (why?) n will be popped before G…Properties of A*…b…bUniform-Cost A*10UCS vs A* Contours Uniform-cost expanded in all directions A* expands mainly toward the goal, but does hedge its bets to ensure optimalityStartGoalStartGoal[demo: countours UCS / A*]Creating Admissible Heuristics Most of the work in solving hard search problems optimally is in coming up with admissible heuristics Often, admissible heuristics are solutions to relaxed problems, where new actions are available Inadmissible heuristics are often useful too (why?)1536611Example: 8 Puzzle What are the states? How many states? What are the actions? What states can I reach from the start state? What should the costs be?8 Puzzle I Heuristic: Number of tiles misplaced Why is it admissible? h(start) = This is a relaxed-problem heuristic8Average nodes expanded when optimal path has length……4 steps …8 steps …12 stepsUCS 112 6,300 3.6 x 106TILES13 39 227128 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) =3 + 1 + 2 + …= 18Average nodes expanded when optimal path has length……4 steps …8 steps …12 stepsTILES13 39 227MANHATTAN12 25 738 Puzzle III How about using the actual cost as a heuristic? Would it be admissible? Would we save on nodes expanded? What’s wrong with it? With A*: a trade-off between quality of estimate and work per node!13Trivial Heuristics, Dominance Dominance: ha≥ hcif 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 heuristicOther A* Applications Pathing / routing problems Resource planning problems Robot motion planning Language analysis Machine translation Speech recognition …[demo: plan tiny UCS / A*]14Tree 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?)Sabdpacephfrqq cGaqephfrqq cGa15Graph Search Idea: never expand a state twice How to implement:  Tree search + set of expanded states (“closed set”) Expand the search tree node-by-node, but… Before expanding a node, check to make sure its state is new If not new, skip it Important: store the closed set as a set, not a list Can graph search wreck completeness? Why/why not? How about optimality?Warning: 3e book has a more complex, but also correct, variantA* Graph Search Gone Wrong?SABCG11123h=2h=1h=4h=1h=0S (0+2)A (1+4) B (1+1)C (2+1)G (5+0)C (3+1)G (6+0)State space graph Search tree16Consistency of Heuristics Stronger than admissibility Definition:cost(A to C) + h(C) ≥ h(A)cost(A to C) ≥ h(A) - h(C)real cost ≥ cost implied by heuristic Consequences: The f value along a path never decreases A* graph search is optimal3ACGh=4h=11Optimality of A* Graph SearchProof: New possible problem: some n on path to G* isn’t in queue when we need it, because some worse n’ for the same state dequeued and expanded first (disaster!) Take the highest such n in tree Let p be the ancestor of n that was on the


View Full Document

Berkeley COMPSCI 188 - Lecture Notes

Documents in this Course
CSP

CSP

42 pages

Metrics

Metrics

4 pages

HMMs II

HMMs II

19 pages

NLP

NLP

23 pages

Midterm

Midterm

9 pages

Agents

Agents

8 pages

Lecture 4

Lecture 4

53 pages

CSPs

CSPs

16 pages

Midterm

Midterm

6 pages

MDPs

MDPs

20 pages

mdps

mdps

2 pages

Games II

Games II

18 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?