





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The A* Search Algorithm, a popular algorithm in artificial intelligence used for finding optimal paths in a state space graph. It covers uninformed and informed search, heuristics, greedy search, and the combination of uniform-cost search and greedy search in A*. The document also discusses the termination, optimality, admissibility, and consistency of A* search.
Typology: Exams
1 / 9
This page cannot be seen from the preview
Don't miss anything!






Lecture Attendance: http://bit.ly/3GEMoKZState space graph.Given a task, model of world appropriate to task.Search Tree.Representation of all plans
(also paths through state space graph.) Uninformed Search.Depth First Search.
Good space bound, āleftmostā exploration seems bad. Breadth First Search.
Bad space bound, finds plan with fewest number of actions. Uniform Cost Search.
Bad space bounds, finds optimal plan. Demo: L3D
A heuristic is:^ I
A function that
estimates
how close a state
is to a goal I^
Designed for a particular search problem I^
Examples:
Euclidean distance for pathing.
Manhattan distance.
Heuristic: the number of the largest pancake that is still out of place
Expand the node that seems closest to the goal?
What can go wrong?
Greedy: 140 + 99 + 211 = 450Better: 140+80+97+101 = 418
Strategy: expand a node that (you think) is closest to a goal state.Heuristic: estimate of distance to nearest goal for each state
Wildest dream:Perfect heuristic. A common case:
Best-first takes you straight to the (wrong) goal Worst-case:
Like a badly-guided DFS
[Democontours greedy empty (L3D3)][Demo: contours greedy pacman small maze (L3D4)]
Greedy
Claim: Goal
is expanded before
with
g
g(
Proof:
Definition of f-cost:
g
(n
h(
n)
Admissibility of
h(
n)
ā h (n
h = 0 at a goal
Imagine B is on the fringe.
Some ancestor
n^
of A is on the fringe, too (maybe A!)
Claim:
n^
will be expanded before B
f(n) is less or equal to f(A)
since
f^ (
n) =
g(
n) +
h(
n)
f^ (
f(A) is less than f(B)
since
g(
g(
h(
All ancestors of A expand before B.A expands before B.
A* search is optimal.
Uniform-cost expands equally in allādirectionsā.A* expands mainly toward the goal, butdoes hedge its bets to ensure optimality
[Demo: contours UCS / greedy / A* empty (L3D1)][Demo: contours A* pacmansmall maze (L3D5)]
Uniform Cost Greedy
Video gamesPathing / routing problemsResource planning problemsRobot motion planningLanguage analysisMachine translationSpeech recognition[Demo: UCS / A * pacman tinymaze (L3D6,L3D7)][Demo: guess algorithm EmptyShallow/Deep (L3D8)]
How about using the actual cost as aheuristic?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^ I
As heuristics get closer to the true cost, expand fewer nodes, butmore work per node to compute the heuristic itself.
exact^ zero ha
hb
hc
max(
ha
,^ h
)b
Dominance:
ha
hc
if ān
:^ h
(na
hc
(n
Heuristics form a semi-lattice:Max of admissible heuristics is admissible.Trivial heuristicsBottom of lattice is the zero heuristic.
(what does this give us?)Top of lattice is the exact heuristic
Search TreeState Graph
Failure to detect repeated statescan cause exponentially morework.
In BFS, for example, we shouldnāt bother expanding the circled nodes(why?)
Idea: never expand a state twiceHow to implement:Tree search + set of expanded states (āclosed setā)Expand the search tree node-by-node, but...Before expanding a node,
check if state was never been expanded beforeIf yes skip it, else add to closed set and expand. Important:
store the closed set as a set, not a list
Can graph search wreck completeness? Why/why not?How about optimality?
Is^
h(
Ā·)^ admissible? Yes. Will exploring w.r..t
h(
g(
n)
be optimal?
Expand
A^ and
in fringe!
Expands
, since
h(
g(
h(
g(
in fringe with key, 3
h(
in fringe with key, 5. Could have been there in 4.
A h =^
h^ =
h^ =
Main idea: est. heuristic costs
actual costs
Admissibility:
h
(x)
cost to goal.
Consistency:
h
(x)
h(
y)
cost
(x
,^ y
heuristic āarcā cost
actual arc cost
Consistent
admissible? Yes? No?
Consistent: f value along a path neverdecreasesAdmissible:^ f
h(
f^ (A
h(
Consistent:
f^ (
f^ (
Claim: If
y^
is expanded due to
x,
f^ (
y)
f^ (
x)
Proof:^ f
(y
g(
x) +
cost
(x
,^ y
h(
y)
g(
x) +
h(
x)
h(
y) +
h(
y) =
g(
x) +
h(
x) =
f^ (
x)
The āestimateā of plan cost keeps rising as you progress.
Sketch: consider what A* does with aconsistent heuristic:Fact 1: In tree search, A* expands nodes inincreasing total f value (f-contours)Fact 2: For every state
s, the optimal path is
discovered.Result: A* graph search is optimalFact 1 Proof. Previous slide.
v
s
x
g Start (v^ )
g(x
)
pathCost(
v^ ,^ s
)
cost(
x,^ s)
Fact 2: The optimal path is discovered to every state
s.
Proof: Consider first error.State
s^
discovered from
x.
Optimal path is from
y^
x.
There is a vertex
v^
in the optimal path to
y^
in fringe.
s^ in fringe with key
f^ (
s) =
g(
x) +
cost
(x
,^ s) +
h(
s).
v^ in fringe with key
f^ (
v^ ) =
g(
v^ ) +
h(
v^ )
h(
v^ )
h(
s)^
pathCost
(v
,^ s
)^ by induction.
g(
v^ ) +
pathCost
(v^
,^ s)
g(
x) +
cost
(x
,^ s)
f^ (
v^ )
f^ (
s)
But then
v^
would have been expanded before
s!