0% found this document useful (0 votes)
14 views10 pages

Heuristic Search Strategies in AI

Chapter 4 discusses informed search strategies in AI, focusing on heuristic methods that estimate the cost or distance to a goal. It details three common heuristics: Euclidean Distance, Manhattan Distance, and Misplaced Tiles, each with specific use cases and properties. Additionally, it covers the A* algorithm and Greedy Best-First Search, highlighting their advantages, disadvantages, and the impact of heuristic accuracy on search efficiency.

Uploaded by

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

Heuristic Search Strategies in AI

Chapter 4 discusses informed search strategies in AI, focusing on heuristic methods that estimate the cost or distance to a goal. It details three common heuristics: Euclidean Distance, Manhattan Distance, and Misplaced Tiles, each with specific use cases and properties. Additionally, it covers the A* algorithm and Greedy Best-First Search, highlighting their advantages, disadvantages, and the impact of heuristic accuracy on search efficiency.

Uploaded by

ATHARVA SUBHEDAR
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 4: INFORMED (HEURISTIC) SEARCH STRATEGIES

1. Heuristic Search Methods in AI:

In informed search, the search algorithm uses a heuristic function to estimate the cost or
distance from a given state to the goal. These heuristics guide the search towards the goal more
efficiently by selecting the most promising paths first.

A heuristic is a problem-solving technique or strategy that provides a good-enough solution for a


problem, especially when finding the exact solution is difficult or time-consuming. In Artificial
Intelligence (AI), a heuristic function estimates the cost or distance from a current state to a goal
state to guide the search process efficiently.

Below are three commonly used heuristic functions:

1. Euclidean Distance Heuristic:

The Euclidean Distance measures the straight-line (as-the-crow-flies) distance between two
points in space, such as between the current state and the goal state.

Formula:

Where:

• (x1,y1) = coordinates of the current state

• (x2,y2) = coordinates of the goal state


Use Case:
It’s commonly used in pathfinding problems (like in A* search) when movement occurs diagonally,
and the distance between points is continuous.

Example:
To apply Euclidean distance in a more realistic context, let’s assume we are finding the straight-
line distance (as-the-crow-flies) between Belgaum and Panaji (Goa). The straight-line (or
Euclidean) distance is based on the geographical coordinates (latitude and longitude) of these
cities.

• Belgaum (Latitude, Longitude): 15.8497°N, 74.4977°E

• Panaji (Goa, Latitude, Longitude): 15.4909°N, 73.8278°E

Where:

• x1,y1 = Latitude and Longitude of Belgaum

• x2,y2 = Latitude and Longitude of Panaji

• k= Earth radius constant in kilometers (~111 km/degree)

h(n) = 84.4 km

The Euclidean (straight-line) distance between Belgaum and Panaji (Goa) is approximately
84.4 kilometers. However, the actual driving distance will be longer (around 100-110 km)
since roads are not perfectly straight.

Key Property:

• This heuristic is admissible (it never overestimates) because it provides the shortest
straight-line path.
2. Manhattan Distance Heuristic

The Manhattan Distance measures the total distance traveled along grid lines (horizontal and
vertical paths only). This is often used in grid-based games or puzzles, such as when the agent can
only move up, down, left, or right.

Formula:

Use Case:
It’s used when movements are restricted to orthogonal directions (no diagonals), such as in
navigating through city blocks or in puzzles.

Example:
The Manhattan distance heuristic calculates how far each tile is from its correct position in terms
of horizontal and vertical moves only (like moving on a grid). It sums the individual distances of all
tiles from their goal positions.

2 8 3 1 2 3
1 6 4 4 5 6
7 5 7 8
Initial State Goal State

h(n)=1+1+0+2+2+1+0+2 = 9

Key Property:

• The Manhattan heuristic works well in grid environments but may underestimate in cases
where diagonal moves are allowed.

3. Misplaced Tiles Heuristic (for the 8-puzzle problem):

This heuristic counts the number of tiles not in their correct position in a puzzle, such as the 8-
puzzle or 15-puzzle. The fewer the misplaced tiles, the closer the state is to the goal.

Formula:
Use Case:
Used specifically for sliding-tile puzzles like the 8-puzzle, where tiles need to be arranged to match
a goal configuration.

Example:
Consider the following initial and goal states:

2 8 3 1 2 3
4 1 6 4 5 6
7 5 7 8

Initial State Goal State

Here, 1, 2, 5 and 8 are misplaced so h(n) = 4

Key Property:

• This heuristic is admissible because it never overestimates the number of moves required
to reach the goal.

Heuristic Use Case Admissibility Optimal For


Pathfinding with
Euclidean Distance Yes Continuous spaces
diagonal moves
Manhattan Orthogonal
Grid-based navigation Yes
Distance movement only

Sliding tile puzzles (8-


Misplaced Tiles Yes Puzzle-solving
puzzle)

2. A *Algorithm in AI: ***** IMPORTANT *****


A* is one of the most popular informed search algorithms used in Artificial Intelligence. It
combines features of Uniform Cost Search and Greedy Best-First Search to find the shortest
path from a start node to a goal node, ensuring both completeness and optimality.

Key Concepts of A*:

• g(n): The cost from the start node to the current node n.
• h(n): The heuristic estimate of the cost from n to the goal.

• f(n) = g(n) + h(n): The total estimated cost of the path through node n.

The A* algorithm explores the node with the lowest f(n) value, ensuring that it balances both the
actual cost from the start (g(n)) and the predicted cost to the goal (h(n)).
Advantages of A*:

• Complete: It will always find a solution if one exists.

• Optimal: It guarantees the shortest path if the heuristic is admissible (does not
overestimate the cost).

• Efficient: Explores fewer nodes compared to uninformed search algorithms.

Disadvantages of A*:

• Memory-intensive: It stores all generated nodes, which can be a problem for large graphs.

• Performance depends on the heuristic: If the heuristic is not accurate, the algorithm’s
efficiency reduces.

2.1 Overestimation and Underestimation in A Algorithm*

The A algorithm* is an informed search technique that uses both the actual cost from the start node
to the current node (g(n)) and the estimated cost from the current node to the goal (h(n)). It selects
the path with the lowest f(n) = g(n) + h(n) at each step.

The heuristic function h(n) plays a crucial role in determining the efficiency and optimality of the A*
algorithm. The behavior of A* depends on whether the heuristic is overestimating or
underestimating the actual cost to the goal.

1. Overestimation of the Heuristic Function (h(n) > h*(n))

• Overestimation means that the heuristic value is greater than the actual cost from the
current node to the goal.

• This can lead the algorithm to believe a path is more promising than it actually is, which
might result in non-optimal solutions.

Effects of Overestimation:

1. Loss of Optimality: A* may no longer guarantee finding the shortest or least-cost path.

2. Faster but Incorrect: It may reach the goal faster but not via the best possible path.
3. Greedy-like behavior: Overestimation can make A* behave like Greedy Best-First Search
by focusing too much on the heuristic and ignoring the actual path cost.

Example of Overestimation:

Imagine in a route-finding problem, the actual remaining distance from a city to the goal is 100 km,
but the heuristic function predicts it to be 150 km. This overestimation might cause the algorithm to
explore paths that appear cheaper but are not optimal.

2. Underestimation of the Heuristic Function (h(n) < h*(n))

• Underestimation occurs when the heuristic predicts a cost less than the actual remaining
cost to the goal.

• While this makes A* more cautious, it ensures that the algorithm finds the optimal solution
because it explores all relevant paths.

Effects of Underestimation:

1. Optimal but Slow: A* will still guarantee the shortest or least-cost path but may explore more
nodes, leading to higher time complexity.

2. More Complete Search: The algorithm expands more nodes than necessary, increasing
computational overhead.

Example of Underestimation:

If the actual remaining cost from a city to the goal is 100 km, but the heuristic estimates it to be 50
km, A* will explore additional nodes unnecessarily to confirm the optimal path.
3. Greedy Best-First Search in AI:
Greedy Best-First Search (GBFS) is an informed search algorithm that focuses on expanding
the node that appears to be closest to the goal, according to a given heuristic function h(n). It tries
to reach the goal as fast as possible by selecting the node with the lowest heuristic value, but it
doesn’t consider the cost to reach the current node from the start (g(n)). Uses priority queue
method.

How Greedy Best-First Search Works

• Heuristic function h(n) estimates the cost from the current node to the goal.
• GBFS chooses the node with the smallest h(n) value from the open list (nodes waiting to
be explored).

• It focuses entirely on the goal, ignoring the cost of the path already traversed. This makes
it fast but prone to errors, as it can get stuck in local optima (suboptimal paths).

Analysis of GBFS:
Fast but not optimal: The search is goal-oriented and may not always find the shortest path. In this
example, it selected Karwar because of the lower heuristic value, but it ignored the actual cost (g(n))
to reach that node.
Advantages of Greedy Best-First Search:

1. Fast and simple: It selects the node that seems closest to the goal.

2. Useful for large state spaces: Focuses only on the goal, reducing the search space.

3. Easy to implement: It only requires a heuristic function.

Disadvantages of Greedy Best-First Search:

1. Not optimal: It may not find the shortest or most cost-effective path (local optimum issue).

2. Incomplete: It can get stuck in loops if the graph is not properly handled.

3. Heuristic-dependent: The efficiency heavily relies on the accuracy of the heuristic function.

Common questions

Powered by AI

The concept of completeness in search algorithms like A* guarantees that if a solution exists, the algorithm will find it. This is achieved by the algorithm iteratively exploring nodes with the lowest estimated total cost (f(n)), effectively navigating throughout the search space. Even if the heuristic is inaccurate but admissible (underestimating), A* will eventually explore all viable paths, ensuring no potential solutions are missed, albeit possibly at higher computational costs .

Heuristic functions offer advantages in search algorithms by providing estimates that guide the search efficiently, such as directing A* to explore the most promising paths, thereby maintaining completeness and optimality when admissible. However, the limitations include the dependency on the accuracy of heuristics, which can lead to inefficiencies or suboptimal solutions if incorrectly estimated. In Greedy Best-First Search, reliance on heuristics can speed up search for large state spaces but often at the cost of not finding the optimal path due to neglect of actual path costs .

The Manhattan Distance Heuristic measures the distance moved along grid lines, particularly useful in environments with orthogonal restrictions, such as puzzles where movement is grid-based. In contrast, the Misplaced Tiles Heuristic is used specifically for sliding-tile puzzles like the 8-puzzle, where it counts tiles out of position, indicating proximity to the goal state. While both heuristics are admissible, ensuring they do not overestimate, the Manhattan Distance often suits grid environments while Misplaced Tiles focus on sequential puzzle solving .

Admissibility in heuristic functions, which prevents overestimation, ensures that the A* algorithm can find the shortest or least-cost path efficiently. This principle influences the algorithm's ability to balance the actual cost with anticipated remaining cost effectively, upholding optimal and complete solutions. An admissible heuristic allows A* to prioritize paths that are not only feasible but also optimal, maintaining the integrity of the search outcome by guaranteeing optimal paths .

In A*, the heuristic function is used together with the actual path cost to determine the most promising node to explore next, maintaining a balance between exploring efficiently and ensuring optimality. This approach allows A* to find the shortest path possible. Conversely, in Greedy Best-First Search, the heuristic function solely drives node selection, focusing on nodes that appear closest to the goal without accounting for the accumulated path cost, which can result in faster but potentially less accurate searches .

Heuristic overestimation in the A* search algorithm affects its performance by potentially compromising its ability to guarantee the shortest path, thus causing a loss of optimality. It may lead to exploring seemingly cheaper but suboptimal paths, making the algorithm behave similarly to Greedy Best-First Search. This results in a faster but possibly incorrect path to the goal as the heuristic value falsely appears promising .

Greedy Best-First Search might be favored in large state spaces because of its speed and simplicity, focusing only on nodes closest to the goal according to the heuristic function. This minimizes the number of nodes considered and reduces the overall search space, making it suitable for scenarios where time is a constraint. However, it compromises path optimality by potentially choosing suboptimal paths due to ignoring the actual cost to reach a node, being prone to get stuck in local optima .

The Euclidean Distance Heuristic guides search processes by estimating the straight-line distance between a given state and the goal. This is particularly efficient in pathfinding problems where movement occurs diagonally, as it helps in identifying the shortest path geometrically. It is most effective in scenarios involving continuous spaces, such as A* search, when the environment allows diagonal movement and the real path cost closely aligns with the straight-line path .

The A* algorithm's memory intensity is a drawback because it retains all generated nodes in memory, which can lead to high memory consumption especially in large graphs. This storage requirement can substantially reduce the algorithm's efficiency, particularly when handling expansive state spaces, as it needs to manage and process a significant amount of data. In severe cases, it may lead to resource exhaustion or force truncation of the search process .

Underestimation in heuristic functions ensures that the A* algorithm remains optimal and complete, as it fully explores necessary nodes to confirm the shortest path. Although this approach might increase computational time and inefficiency due to exploring more nodes than needed, it guarantees finding the least-cost path. The thorough exploration reinforces the algorithm's reliability in identifying the optimal route but at the expense of efficiency, making it both thorough and guaranteed under admissible heuristic conditions .

You might also like