0% found this document useful (0 votes)
19 views32 pages

AI Coursebook - Ch3 - Informed Search

The document explains informed search algorithms, focusing on heuristic functions that help find goal states more efficiently than uninformed searches. It discusses Greedy Best-First Search and A* Search, highlighting their advantages, limitations, and the importance of admissible and consistent heuristics. A* Search is presented as a more optimal approach than Greedy Best-First Search, as it combines heuristic information with actual path costs.

Uploaded by

ayusbhatta0702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views32 pages

AI Coursebook - Ch3 - Informed Search

The document explains informed search algorithms, focusing on heuristic functions that help find goal states more efficiently than uninformed searches. It discusses Greedy Best-First Search and A* Search, highlighting their advantages, limitations, and the importance of admissible and consistent heuristics. A* Search is presented as a more optimal approach than Greedy Best-First Search, as it combines heuristic information with actual path costs.

Uploaded by

ayusbhatta0702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Informed Search

Informed search is like a better version of uninformed search.


This is because we use heuristic functions here.
Heuristic function:
It is like a little hint we give to help you find the goal state faster. Let’s see an example.

Let’s say we want to go from Arad to


Bucharest in the shortest possible time. The
actual road distances are given on the map
itself. However, we also took a hint, and noted
down the straight-line distances from the
various cities to Bucharest.

12210064
Heuristic function:
It is like a little hint we give to help you find the goal state faster. Let’s see an example.

Let’s not use the hint for now. How do we find


the shortest distance? Of course, by using
Uniform Cost Search. But that is so tiresome
and time consuming. So, let’s use the hints.

12210064
Heuristic function:

Before we start using them, let’s look how is it written officially.

h(n) = estimated cost of the cheapest path from the state at node n to a goal state

12210064
Heuristic function:

So, h(Arad) = 366, means it is estimated that it


is 366 km from Arad to Bucharest.

12210064
Now there are two very important things we need to remember:

1. Open list: A list of nodes that are yet to be explored during the search.

2. Closed list: A list of nodes that have already been explored and processed.

12210064
Greedy Best First Search

Note that we didn’t consider the path costs


here, because well, what’s the use of writing
it if we aren’t going to use it.

12210064
Greedy Best First Search

So, let’s initiate the open and closed lists.

Open A
Closed

Open list consists of all those nodes that we didn’t ‘open’


yet. Like here, we didn’t open A to get B, C, D.
12210064
Greedy Best First Search

Open A
Closed

Now we opened A.
Remember, first shift a node from open to closed list
and then write the new nodes in the open list.
Also, the node with largest evaluation function value
is placed last and the smallest one is placed first.

12210064
Greedy Best First Search

Open C B D
Closed A

Now we opened A.
Remember, first shift a node from open to closed list
and then write the new nodes in the open list.
Also, the node with largest evaluation function value
is placed last and the smallest one is placed first.

12210064
Greedy Best First Search

Open C B D
Closed A

Evaluation function value: f(n)


Heuristic function value: h(n)

However, for greedy best first search, f(n) = h(n).

12210064
Greedy Best First Search

Open B D
Closed C A

We shift the C (lowest heuristic) to closed. Now


let’s explore it.

12210064
Greedy Best First Search

Open F E B D
Closed C A

We get F and E.
We again arrange them with increasing heuristic.

Also remember that we didn’t consider A here,


although it is a neighbor of C.
This is because it is already in the closed list. If
something is in the closed list, we don’t include
them back in the open list.

From now on we will shift a node12210064


to closed list
and explore it both at the same time.
Greedy Best First Search

Open G E B D
Closed F C A

Just as we get the goal state in the open list, we stop.

12210064
Greedy Best First Search

Open G E B D
Closed F C A

Path made: A – C – F – G

12210064
Greedy Best First Search

Advantages of Greedy Best-First Search

1. Speed: GBFS is generally faster than uninformed search algorithms like Breadth-First Search because it
leverages heuristic information.

2. Simplicity: The algorithm is simple to implement and understand, making it a preferred choice in cases
where speed is more important than optimality.

3. Resource-Efficient: Since it focuses on the path that seems most promising, it may require less memory
compared to algorithms like A*.

12210064
Greedy Best First Search

Limitations of Greedy Best-First Search

1. Incomplete: GBFS may fail to find a solution if it becomes trapped in a local optimum or dead-end, as it
does not consider backtracking.

2. Non-Optimal: The algorithm is not guaranteed to find the shortest or best path. It only focuses on immediate
gains (greedily choosing the nearest node), which may lead to suboptimal solutions.

3. Heuristic Dependency: The efficiency and success of GBFS heavily rely on the quality of the heuristic. A
poor heuristic can lead to inefficient searches.

12210064
A* Search

It is better than greedy best first search, because it considers the hints along with the actual path
costs.

Evaluation function value: f(n)


Heuristic function value: h(n)
Actual path cost value: g(n)

In A* search, f(n) = h(n) + g(n)

12210064
A* Search

S
1
n h(n)
A S 7 Let’s go from S to Z
2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S
1
n h(n)
A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S
1
n h(n)
A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S to A to B f(n) = 3 + 4 = 7
S S to A to C f(n) = 2 + 1 = 3
1
n h(n)
A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S to A to B f(n) = 3 + 4 = 7
S S to A to C f(n) = 2 + 1 = 3
1
n h(n)
A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S to A to B f(n) = 3 + 4 = 7
S S to A to C f(n) = 2 + 1 = 3
1 S to A to C to D f(n) = 5 + 5 = 10
n h(n) S to A to C to Z f(n) = 5 + 0 = 5

A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S to A to B f(n) = 3 + 4 = 7
S S to A to C f(n) = 2 + 1 = 3
1 S to A to C to D f(n) = 5 + 5 = 10
n h(n) S to A to C to Z f(n) = 5 + 0 = 5

A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0

D 2 Z
12210064
A* Search S to A f(n) = 1 + 3 = 4
S to Z f(n) = 15 + 0 = 15

S to A to B f(n) = 3 + 4 = 7
S S to A to C f(n) = 2 + 1 = 3
1 S to A to C to D f(n) = 5 + 5 = 10
n h(n) S to A to C to Z f(n) = 5 + 0 = 5

A S 7

2 1 A 3
15 B 4

B C C
D
1
5
5 3 3 Z 0
Final path: S to A to C to Z
D 2 Z
12210064
Greedy Best First Search

Advantages of A* Search

1. Completeness: A* is guaranteed to find a solution if one exists, as long as the search space is finite and the
heuristic is admissible.

2. Optimality: A* ensures the shortest or least costly path is found if the heuristic is admissible (never
overestimates the cost) and consistent.

3. Efficiency: It uses heuristic guidance to reduce the number of explored nodes, making it faster than
uninformed search algorithms like BFS or DFS in many cases.

4. Flexibility: The performance of A* can be tailored by adjusting the heuristic function, balancing between
speed and optimality.

12210064
Greedy Best First Search

Limitations of A* Search

1. Memory Usage: A* stores all generated nodes in memory, making it unsuitable for large or infinite search
spaces due to high memory consumption.

2. Time Complexity: In large graphs, A* may expand many nodes, especially when the heuristic is weak,
leading to long computation times.

3. Heuristic Dependency: The algorithm's performance heavily relies on the quality of the heuristic. Poor or
inadmissible heuristics can degrade efficiency and optimality.

4. Inefficiency in Uniform Costs: When all edge costs are the same, A* can behave similarly to BFS, losing
its advantage over other search algorithms.

12210064
1. Admissible heuristic

• A heuristic is admissible if it never overestimates the actual cost to reach the goal
from any node.

• It ensures the heuristic value h(n) <= h*(n) where h*(n) is the true cost to the goal.

• Example: In a road map, the straight-line distance is admissible because it’s always
less than or equal to the actual travel distance.
1. Consistent heuristic

• A heuristic is consistent (or monotonic) if for every node n, and its successor n′, the
estimated cost satisfies: h(n) <= c(n, n′)+h(n′), where c(n, n′) is the cost of the edge
between n and n′.

• Consistency implies admissibility, and it ensures that the f(n) values (costs) never
decrease along a path.

• Example: In a grid, using the Manhattan distance is consistent because it respects the
actual travel cost between nodes.
The End

You might also like