Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Human-awareRobotics
1
Informed Search• 2018/01/18
• Chapter 3.5 in R&N 3rd
Ø Announcement:q Slides for this lecture are here:
http://www.public.asu.edu/~yzhan442/teaching/CSE471/Lectures/informed.
q Project 1 released. Due in two weeks, on Jan 31 by midnight.
Human-awareRobotics
2
• Planning agent (goal-based agent) and environment
• Planning problem
• Search
• Search strategies
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.1-3.4
Last time
Human-awareRobotics
3
Outline for today
• Heuristics
• Best-first search
• Admissible heuristics
• Graph search and consistency
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.5-3.6
Human-awareRobotics
• Search problem:– States (configurations of the world)– Actions and costs– Successor function (world dynamics)– 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 plans
Planning agent
fromhttp://ai.berkeley.edu
Human-awareRoboticsTree search
Human-awareRobotics
• Remember: UCS explores increasing cost contours
• The good: UCS is complete and optimal!
• The bad:– Explores options in every “direction”– No information about goal location
• We’ll fix it today!
Start Goal
…
c£ 3c£ 2
c£ 1
Issues with UCS
Human-awareRoboticsInformed search
Human-awareRobotics§ A heuristic is:
§ A function that estimates how close a state is to a goal
§ Designed for a particular search problem§ Examples: Manhattan distance, Euclidean
distance for path finding
10
5
11.2
Search heuristics
Human-awareRobotics
9
Outline for today
• Heuristics
• Best-first search
• Admissible heuristics
• Graph search and consistency
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.5-3.6
Human-awareRoboticsBest-first search
Idea:
• Use heuristic for each node to estimate its “desirability”• Expand the most desirable unexpanded node
Special cases:
Greedy searchA* search
Human-awareRoboticsGreedy search
Human-awareRobotics
• 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
Greedy search
Human-awareRoboticsGreedy search
Human-awareRoboticsGreedy search
Human-awareRoboticsGreedy search
Human-awareRobotics• What nodes does greedy search expand?
– Takes time O(bm) (exponential in effective depth)– A good heuristic can give dramatic improvement!
• How much space does the fringe take?– May keeps all nodes at the bottom tier, so O(bm)
• Is it complete?– No, i.e., stuck in loops (when state space graph has
loops)
• Is it optimal?– No
Properties of greedy search
…b
…b
mtiers
Human-awareRoboticsA* search
Human-awareRobotics• 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 d
b
Gh=5
h=6
h=2
1
8
11
2
h=6 h=0
c
h=7
3
e h=11
S
a
b
c
ed
dG
G
g =0h=6
g =1h=5
g =2h=6
g =3h=7
g =4h=2
g =6h=0
g =9h=1
g =10h=2
g =12h=0
Combining UCS and Greedy
Human-awareRobotics• Should we stop when we enqueue a goal?• No: only stop when we dequeue a goal
S
B
A
G
2
3
2
2h=1
h=2
h=0h=3
When should A* terminate?
Human-awareRobotics
• What went wrong?• Actual bad goal cost < estimated good goal cost• We need estimates to be less than actual costs!
A
GS
1 3h=6
h=0
5
h =7
Is A* optimal
Human-awareRobotics
21
Outline for today
• Heuristics
• Best-first search
• Admissible heuristics
• Graph search and consistency
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.5-3.6
Human-awareRoboticsAdmissible Heuristic
Human-awareRobotics
Inadmissible (pessimistic) heuristics break optimality by trapping good plans on the fringe
Admissible (optimistic) heuristics slow down bad plans but never outweigh true costs
Admissibility
Human-awareRobotics• 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.
15
Admissible Heuristic
Human-awareRobotics
• 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
15366
Admissible heuristics
Human-awareRobotics• Heuristic: Number of tiles
misplaced• Why is it admissible?• h(start) = • This is a relaxed-problem heuristic
Averagenodesexpandedwhentheoptimalpathhas……4steps
…8steps
…12steps
UCS 112 6,300 3.6x106
TILES 13 39 227
StartState GoalState
StatisticsfromAndrewMoore
Example
8
Human-awareRobotics
• 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 is it admissible?
• h(start) = 3+1+2+…=18
Averagenodesexpandedwhentheoptimalpathhas…
…4steps …8steps …12stepsTILES 13 39 227MANHATTAN 12 25 73
StartState GoalState
Example
Human-awareRobotics
• How about using the actual cost as a heuristic?– Would it be admissible?– What’s wrong with it?
• With A*: a trade-off between quality of estimate and work per node– As heuristics get closer to the true cost, you will expand fewer
nodes but usually do more work per node to compute the heuristic itself
Example
Human-awareRobotics• 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
Dominance
Human-awareRoboticsOptimality of A*
Human-awareRobotics
Assume:• A is an optimal goal node• B is a suboptimal goal
node• h is admissible
Claim:
• A will exit the fringe before B
…
Optimality of A*
Human-awareRobotics
Proof:• Imagine B is on the fringe• Some ancestor n of A is on the
fringe, too (maybe A!)• Claim: n will be expanded
before B1. f(n) is less or equal to f(A)
Admissibilityofh
…
h=0atagoal
Optimality of A*
Human-awareRobotics
Proof:• Imagine B is on the fringe• Some ancestor n of A is on the
fringe, too (maybe A!)• Claim: n will be expanded
before B1. f(n) is less or equal to f(A)2. f(A) is less than f(B)
B issuboptimalh=0atagoal
…
Optimality of A*
Human-awareRobotics
Proof:• Imagine B is on the fringe• Some ancestor n of A is on the
fringe, too (maybe A!)• Claim: n will be expanded
before B1. f(n) is less or equal to f(A)2. f(A) is less than f(B)3. n expands before B
• All ancestors of A expand before B
• A expands before B• A* search is optimal
…
Optimality of A*
Human-awareRobotics
…b
…b
Uniform-Cost A*
UCS and A* contour
Human-awareRobotics
• Uniform-cost expands equally in all “directions”
• A* expands mainly toward the goal, but does hedge its bets to ensure optimality
Start Goal
Start Goal
UCS and A* contour
Human-awareRobotics
Greedy UniformCost A*
Comparison
Human-awareRobotics
Greedy UniformCost A*
Comparison
S
G
UsingManhattandistanceastheheuristic
• Whenwillgreedyperformbetter?• WhenwilluniformcostbeatA*?• Howyoubreaktiesmayalsobeimportant
Canonlymovetoadjacentcells
Human-awareRobotics
39
Outline for today
• Heuristics
• Best-first search
• Admissible heuristics
• Graph search and consistency
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.5-3.6
Human-awareRoboticsGraph search
Human-awareRoboticsGraph search vs tree search
Human-awareRobotics
• In BFS, for example, we shouldn’t bother expanding the circled nodes (why?)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Graph search
Human-awareRobotics
S
A
B
C
G
1
1
1
23
h=2
h=1
h=4
h=1
h=0
S(0+2)
A(1+4) B(1+1)
C(2+1)
G(5+0)
C(3+1)
G(6+0)
Statespacegraph Searchtree
A* graph search gone wrong
Human-awareRobotics• Main idea: estimated heuristic costs ≤ actual costs
– Admissibility: heuristic cost ≤ actual cost to
goal
h(A) ≤ actual cost from A to G
– Consistency: heuristic “arc” cost ≤ actual cost
for each arc
h(A) – h(C) ≤ cost(A to C)
• Consequences of consistency:
– The f value along a path never decreases
h(A) ≤ cost(A to C) + h(C)
– A* graph search is optimal
3
A
C
G
h=4 h=11
h=2
Consistency
Human-awareRobotics
• Sketch: consider what A* does with a consistent heuristic:
– Fact 1: In tree search, A* expands nodes in increasing total f value (f-contours)
– Fact 2: For every state s, nodes that reach s optimally are expanded before s is expanded
– Result: A* graph search is optimal
…
f£ 3
f£ 2
f£ 1
Optimality of A* graph search
Human-awareRobotics
• Tree search:– A* is optimal if heuristic is admissible– UCS is a special case (h = 0)
• Graph search:– A* optimal if heuristic is consistent– UCS optimal (h = 0 is consistent)
• Consistency implies admissibility
• In general, most natural admissible heuristics tend to be consistent, especially if from relaxed problems
Optimality
Human-awareRobotics
• Video games• Path finding / routing problems• Robot motion planning• Resource planning problems• Language analysis• Machine translation• Speech recognition• …
A* applications
Human-awareRobotics
48
Summary
Human-awareRobotics
49
Outline for today
• Heuristics
• Best-first search
• Admissible heuristics
• Graph search and consistency
• Required reading (red means it will be on your exams):
o R&N: Chapter 3.5-3.6