Open In App

Iterative Deepening A* algorithm (IDA*) – Artificial intelligence

Iterative deepening A* (IDA*) is a graph traversal and path-finding method that can determine the shortest route in a weighted graph between a defined start node and any one of a group of goal nodes. It is a kind of iterative deepening depth-first search that adopts the A* search algorithm’s idea of using a heuristic function to assess the remaining cost to reach the goal.
A memory-limited version of A* is called IDA*. It performs all operations that A* does and has optimal features for locating the shortest path, but it occupies less memory.
Iterative Deepening A Star uses a heuristic to choose which nodes to explore and at which depth to stop, as opposed to Iterative Deepening DFS, which utilizes simple depth to determine when to end the current iteration and continue with a higher depth.

Key points

The evaluation function in IDA* looks like this:



Where h is admissible.
here,
          f(n)  = Total cost evaluation function.
          g(n) = The actual cost from the initial node to the current node.
          h(n) = Heuristic estimated cost from the current node to the goal state. it is based on the approximation according to the problem characteristics.



What is the f score?

In the IDA* algorithm, F-score is a heuristic function that is used to estimate the cost of reaching the goal state from a given state. It is a combination of two other heuristic functions, g(n) and h(n).
It is used to determine the order in which the algorithm expands nodes in the search tree and thus, it plays an important role in how quickly the algorithm finds a solution. A lower F-score indicates that a node is closer to the goal state and will be expanded before a node with a higher F-score.
Simply it is nothing but g(n) + h(n).

How IDA* algorithm work?

Step 1: Initialization

Set the root node as the current node, and find the f-score.

Sep 2: Set threshold

Set the cost limit as a threshold for a node i.e the maximum f-score allowed for that node for further explorations.

Step 3: Node Expansion

Expand the current node to its children and find f-scores.

Step 4: Pruning

If for any node the f-score > threshold, prune that node because it’s considered too expensive for that node. and store it in the visited node list.

Step 5:  Return Path

If the Goal node is found then return the path from the start node Goal node.

Step 6: Update the Threshold

 If the Goal node is not found then repeat from step 2 by changing the threshold with the minimum pruned value from the visited node list. And Continue it until you reach the goal node.  
 

Example

In the below tree, the f score is written inside the nodes means the f score is already computed and the start node is 2 whereas the goal node is 15. the explored node is colored green color.

so now we have to go to a given goal by using IDA* algorithm.

Iteration 1

Iteration 1

Iteration 2

Iteration 2

Iteration 3

Iteration 3

Iteration 4

 

Iteration 5

 

Iteration 6

Iteration 6

IDA* can be used to solve various real-life problems that are:

The 15-Puzzle Problem:

The 15-puzzle problem is a classic example of a sliding puzzle game. It consists of a 4×4 grid of numbered tiles with one tile missing. The aim is to rearrange the tiles to form a specific goal configuration. The state space of the puzzle can be represented as a tree where each node represents a configuration of the puzzle and each edge represents a legal move. IDA* can be used to find the shortest sequence of moves to reach the goal state from the initial state.

The 8-Queens Problem:

The 8-Queens problem is a classic example of the n-Queens problem where n queens have been placed on an n x n chessboard such that no two queens attack each other. The state space of the problem can be represented as a tree where each node represents a configuration of the chessboard and each edge represents the placement of a queen. IDA* can be used to find the minimum number of queens that need to be moved to reach the goal state.

In both of these examples, IDA* is used to find the optimal solution by using a combination of depth-first search and a heuristic function to limit the search space. The algorithm incrementally increases the depth bound, allowing it to find the solution without exploring the entire state space, which would be infeasible for larger problems.

Advantages and disadvantages

Advantages

  1. IDA* is guaranteed to find the optimal solution if one exists.
  2. IDA* avoids the exponential time complexity of traditional Depth First Search. by using an “iterative deepening” approach, where the search depth is gradually increased.
  3. IDA* uses a limited amount of memory as compared to the A* algorithm because it uses Depth First Search.
  4. IDA* is an admissible heuristic, it never overestimates the cost of reaching the goal.
  5. It’s efficient in handling large numbers of states and large branch factors.

Disadvantages

  1. Explore the visited node again and again. it doesn’t keep track of the visited nodes.
  2. IDA* may be slower to get a solution than other search algorithms like A* or Breadth-First Search because it explores and repeats the explore node again and again.
  3. It takes more time and power than the A* algorithm.

It’s important to note that IDA* is not suitable for all types of problems, and the choice of algorithm will depend on the specific characteristics of the problem you’re trying to solve.

Conclusion

In every branch, we have visited depth till the f score value is greater than the threshold value but we are not going above the threshold but going in depth so this is the difference between the iterative depth-first search algorithms. and IDA* algorithm. 

 

iterative depth-first search algorithms(IDDFS)

Iterative deepening A* (IDA*) 

1

Systematic

Not Systematic

2

Optimal

Optimal but never expands the node where f-score > Threshold

3

Never expands the same node twice

Expands the same node many times if f-score < Threshold

4

Not good for infinite Search traversal

For infinite Search traversal, it is better than IDDFS.


Article Tags :