Heuristics


Estimates of how good the next state is

Approximations, not necessarily exact values

Can often be quickly computed

Properties of

Heuristics



Admissible Heuristics

Never overestimates cost to goal

Consistent Heuristics

For every node $n$ and every successor node $n'$
$h(n) \le c(n \rightarrow n') + h(n')$

Consider Manhattan Distance



Is this admissible?

Is this consistent?

Greedy Best-First Search


Expand the node that appears to be closest to goal

Uses only the heuristic function

Can get stuck in local optima

Greedy Best-First Search


function GBFS ( G , s, h, goal ):
		PQ.push( h(s,goal), s, [] )
		while PQ is not empty:
			c, v, path = PQ.pop()
			if v not visited:
				mark v as visited
				path.append(v)
				if v == goal:
					return path
				for all neighbors w of v:
					if w not visited:
						PQ.push( h(w,goal), w, path )

A* Search


Expand the node that appears to be closest to goal

Uses both the heuristic function and the cost to reach the node

Guaranteed* to find the optimal path

A* Search


function ASTAR ( G, s, goal ):
		PQ.push( H(s, goal), 0, s, [] )
		while PQ is not empty:
			h, c, v, path = PQ.pop()
			if v not visited:
				mark v as visited
				path.append(v)
				if v == goal:
					return path
				for all neighbors w of v:
					g = c + WT(v, w)
					PQ.push( g + H(w, goal), g, w, path )

A* is only optimal if the heuristic is consistent


Admissibility alone is insufficient


Consider this graph


Beam Search


Expand only the $k$ best nodes

Straightforward extension to A* Search

Incomplete and Suboptimal

Alternate version: expand branches where
$f(n') = f(n) \pm \delta$