I don't understand how IDA*
saves memory space.
From how I understand IDA*
is A*
with iterative deepening.
What's the difference between the amount of memory A*
uses vs IDA*
.
Wouldn't the last iteration of IDA*
behave exactly like A*
and use the same amount of memory. When I trace IDA*
I realize that it also has to remember a priority queue of the nodes that are below the f(n)
threshold.
I understand that ID-Depth first search helps depth first search by allowing it to do a breadth first like search while not having to remember every every node. But I thought A*
already behaves like depth first as in it ignores some sub-trees along the way. How does Iteratively deepening make it use less memory?
Another question is Depth first search with iterative deepening allows you to find the shortest path by making it behave breadth first like. But A*
already returns optimal shortest path (given that heuristic is admissible). How does iterative deepening help it. I feel like IDA*'s last iteration is identical to A*
.
In IDA*
, unlike A*
, you don't need to keep a set of tentative nodes which you intend to visit, therefore, your memory consumption is dedicated only to the local variables of the recursive function.
Although this algorithm is lower on memory consumption, it has its own flaws:
Unlike A*, IDA* doesn't utilize dynamic programming and therefore often ends up exploring the same nodes many times. (IDA* In Wiki)
The heuristic function still needs to be specified for your case in order to not scan the whole graph, yet the scan's memory required in every moment is only the path you are currently scanning without its surrounding nodes.
Here is a demo of the memory required in each algorithm:
In the A*
algorithm all of the nodes and their surrounding nodes needs to be included in the "need to visit" list while in the IDA*
you get the next nodes "lazily" when you reach its previews node so you don't need to include it in an extra set.
As mentioned in the comments, IDA*
is basically just IDDFS
with heuristics: