Docsity

Informed Search Algorithms: Greedy Search and A* Search with Examples, Study notes of Computer Science

Partial preview of the text

Download Informed Search Algorithms: Greedy Search and A* Search with Examples and more Study notes Computer Science in PDF only on Docsity!

Informed Search

• Heuristic functions

• Greedy Search

• A?^ Search (Hart, Nilsson, and Raphael, 1968)

• Proofs of optimality and completeness

• Examples

• Iterative Deepening A?^ Search (IDA? )

• Simplified Memory-Bounded A?^ (SMA? ).

Heuristic

Informally, a heuristic is any “rule of thumb,” or information that helps one solve

a problem.

In the context of search trees, a heuristic function , h(n) , estimates the cost of

the cheapest path between node n and a goal node. Thus h(n) = 0 , if n is a

goal node.

A greedy search always expands the node in the queue that is believed to be

closest to the goal state, i.e., the node in the queue with the smallest value of

h. Equivalent to a best-first search that uses h(n) to sort the queue.

Greedy Search: Arad to Bucharest

Arad

( h Sibiu = 253)^ Timisoara ( h = 329) (^ Zerind h =374)

Romania: h(n) = straight-line distance to Bucharest

Bucharest

Giurgiu

Urziceni

Hirsova

Eforie

NeamtOradea

Zerind

Arad

Timisoara

LugojMehadia

DobretaCraiova

Sibiu

Fagaras

PitestiRimnicu Vilcea

Vaslui

Iasi

Straightline distanceto Bucharest

Giurgiu

Urziceni Hirsova Eforie

Neamt Oradea Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest

Romania: h(n) = straight-line distance to Bucharest

Bucharest

Giurgiu

Urziceni

Hirsova

Eforie

NeamtOradea

Zerind

Arad

Timisoara

LugojMehadia

DobretaCraiova

Sibiu

Fagaras

PitestiRimnicu Vilcea

Vaslui

Iasi

Straightline distanceto Bucharest

Giurgiu

Urziceni Hirsova Eforie

Neamt Oradea Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest

Greedy Search: Arad to Bucharest

Arad

( h Sibiu = 253)^ Timisoara ( h = 329) (^ Zerind h =374)

( h^ Arad=366) (^ Fagaras h = 178) (^ Oradea h =380) (^ Rimnicu h = 193)

( h^ Sibiu=253)^ Bucharest ( h =0)

Total cost is g = 140 + 99 + 211 = 450.

Properties of Greedy Search ( AIMA , pp. 95–96)

• “Greedy algorithms often perform quite well.”

• “Susceptable to false starts.”

• Time and memory complexity are both O (bm) in the worst case.

A?^ Search

Recall that

g(n) = the path cost from the root to node n

h(n) = the approxiate cost from n to the closest goal.

Now define,

f (n) = g(n) + h(n).

The f -cost , f (n) , estimates the smallest path cost to a goal node through node

n.

An A?^ search is a best-first search using f (n) to order the nodes in the queue.

Romania: Contours of constant f for a monotonic

f -cost

Giurgiu

Urziceni Hirsova Eforie

Oradea Neamt Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest

Romania: A?^ Search

Bucharest

Giurgiu

Urziceni

Hirsova

Eforie

NeamtOradea

Zerind

Arad

Timisoara

LugojMehadia

DobretaCraiova

Sibiu

Fagaras

PitestiRimnicu Vilcea

Vaslui

Iasi

Straightline distanceto Bucharest

Giurgiu

Urziceni Hirsova

Eforie

Oradea Neamt Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest

Romania: A?^ Search

Bucharest

Giurgiu

Urziceni

Hirsova

Eforie

NeamtOradea

Zerind

Arad

Timisoara

LugojMehadia

DobretaCraiova

Sibiu

Fagaras

PitestiRimnicu Vilcea

Vaslui

Iasi

Straightline distanceto Bucharest

Giurgiu

Urziceni Hirsova

Eforie

Oradea Neamt Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest

A?^ Search: Arad to Bucharest

Arad

( h Sibiu = 253,

f = 393)

Timisoara ( h = 329,

f = 447)

( h^ Zerind = 374,

f = 449)

g = 140

g = 280 239 291 220

( h^ Arad = 366,

f = 646)

(^ Fagaras h = 178,

f = 417)

( h^ Oradea = 380,

f = 671)

(^ Rimnicu h = 193,

f = 413)

A?^ Search: Arad to Bucharest

(f = 366)Arad

( h^ Sibiu = 253,

f = 393)

Timisoara ( h = 329,

f = 447)

( h^ Zerind = 374,

f = 449)

g = 140

g = 280

g = 366

( h^ Arad = 366,

f = 646)

(^ Fagaras h = 178,

f = 417)

( h^ Oradea = 380,

f = 671)

(^ Rimnicu h = 193,

f = 413)

(^ Craiova h = 160,

f = 526)

(^ Pitesti h = 98,

f = 415)

( h^ Sibiu = 253,

f = 553)

Romania: A?^ Search

Bucharest

Giurgiu

Urziceni

Hirsova

Eforie

NeamtOradea

Zerind

Arad

Timisoara

LugojMehadia

DobretaCraiova

Sibiu

Fagaras

PitestiRimnicu Vilcea

Vaslui

Iasi

Straightline distanceto Bucharest

Giurgiu

Urziceni Hirsova

Eforie

Oradea Neamt Zerind Arad

Timisoara Lugoj Mehadia Dobreta Craiova

Sibiu (^) Fagaras

Pitesti

Vaslui

Iasi

Rimnicu Vilcea

Bucharest