IDA* and Memory-Bounded Search Algorithms CSCE 580 ANDREW SMITH JOHNNY FLOWERS What were covering 1. Introduction 2. Korfs analysis of IDA* 3. Russells criticism of IDA* 4. Russells solution to memory-bounded search Introduction

Two types of search algorithms: Brute force (breadth-first, depth-first, etc.) Heuristic (A*, heuristic depth-first, etc.) Measure of optimality The Fifteen Puzzle! INTRODUCTION Korfs Analysis A few definitions Node branching factor (b): The number of new states that are generated by the application of a single operator to a given state, averaged over all states in the problem space Edge branching factor (e): The average number of different operators which are

applicable to a given state (i.e. how many edges are coming out of a node) Depth (d): Length of the shortest sequence of operators that map the initial state to a goal state KORFS ANALYSIS Brute Force Algorithm Analysis Breadth-first search Expands all nodes from the initial state, until a goal state is reached. Pros:

Cons: Always finds the shortest path to the goal state. Requires time O(bd) SPACE! O(bd) nodes must be stored! Most problem spaces exhaust memory far before a goal is reached (in 1985 anyway). KORFS ANALYSIS

Brute Force Algorithm Analysis Depth first search Expands a path to depth d before expanding any other path, until a goal state is reached. Pros: Requires little space; only the current path from the initial node must be stored, O(d) Cons:

Does not typically find the shortest path Takes time O(ed)! If a depth cutoff is not set, the algorithm may never terminate KORFS ANALYSIS Brute Force Algorithm Analysis Depth-first iterative-deepening Perform a depth-first search at depth 1, then depth 2, ... all the way to depth d Pros:

Optimal time, O(bd) [proof] Optimal space, O(d), since it is performing depth-first search , and never searches deeper than d Always finds the shortest path Cons

Wasted computation time at depths not containing the goal Proven to not affect asymptotic performance (next slide) Must explore all possible paths to a given depth KORFS ANALYSIS Brute Force Algorithm Analysis Branching factor vs. constant coefficient as search depth -> infinity KORFS ANALYSIS Increasing Optimality with Bi-Directional Search

DFID with Bi-Directional search Depth-first search up to depth k from start node; 2 depth-first searches from goal node up to depth k and k+1 Performance Space, solution of length d, O(bd/2) Time, O(bd/2) KORFS ANALYSIS IDA* A*, like depth-first search, except based on

increasing values of total cost rather than increasing depths IDA* sets bounds on the heuristic cost of a path, instead of depth A* always finds a cheapest solution if the heuristic is admissible Extends to a monotone admissible function as well Korf, Lemma 6.2

Also applies to IDA* Korf, Lemma 6.3 KORFS ANALYSIS IDA* IDA* is optimal in terms of solution cost, time, and space for admissible best-first searches on a tree

With an admissible monotone heuristic. Korf, Theorem 6.4 IDA* expands the same number of nodes, asymptotically, as A*. A* proven to be optimal for nodes expanded. KORFS ANALYSIS IDA* vs. A* Fifteen Puzzle with Manhattan distance

heuristic Initial State Estimate Actual Total Nodes 7681 11 5 14 10 3 4 9 13

15 2 0 12 41 59 1,369,596,7 78 IDA* generates more nodes than A*, but runs faster. KORFS ANALYSIS Other conclusions

Also optimal for two-player games Can search deeper in the tree at optimal time Can be used to order nodes, so alpha-beta cutoff is more efficient only possible with ID KORFS ANALYSIS Russells Criticism A* must store all nodes in an open list A good implementation of the Fifteen Puzzle will run out of memory (on a 64 MB machine this is a small issue now) Memory-bounded variants developed

Problems: Ensuring an optimal solution Avoiding re-expansion of nodes (wasted computation) RUSSELLS Russells Criticism In worst-case scenarios (and for large problems), IDA* is sub-optimal compared to A*

Worst case = every node has a different f-cost If A* examines k-nodes [O(k)], then IDA* examines k2-nodes [O(k2)] Unacceptable slowdown for large k Evident in real-world problems, such as Traveling Salesman

IDA* retains no path information between iterations RUSSELLS Russells Solutions to MB Searches MA* Once a preset limit is reached (in memory), the algorithm prunes the open list by highest f-cost SMA*

Improves upon MA* by: 1. Using a more efficient data structure for the open list (binary tree), sorted by f-cost and depth 2. Only maintaining two f-cost quantities (instead of four with MA*) 3. Pruning one node at a time (the worst f-cost) 4. Retaining backed-up f-costs for pruned paths

RUSSELLS SOLUTIONS TO MEMORY SMA* Algorithm SMA* - If memory can only hold 10 nodes. RUSSELLS SOLUTIONS TO MEMORY Properties of SMA* Maintain f-costs of the best path (lower bound) The best lower bound node is always expanded

Guaranteed to return an optimal solution MAX must be big enough to hold the shortest path Behaves identical to A* if MAX > number of nodes generated RUSSELLS SOLUTIONS TO MEMORY IE Algorithm IE All but the current best path and sibling nodes are pruned away. Otherwise, similar to

SMA*, until the bound is exceeded. Very similar to best-first search as well. IE Algorithm Example Labels are f-cost / bound Russells Performance Tests Used a perturbed 8-puzzle as opposed to Korfs 15-puzzle test Small perturbations on Manhattan-distance heuristic

This is to ensure each node has a different f-cost Run on a Macintosh Powerbook 140 w/ 4MB RAM SMA* vs. A* vs. IE vs. IDA* Russells Performance Results Russells Performance Results Breadth-First Heuristic Search

Storing all open and closed nodes, as in A*, allows Reconstruction of the optimal solution path Detection of duplicate node expansions Sacrificing one of these reduces required memory Variations of A* such as DFIDA* and RBFS give up duplicate detection

In doing so, such algorithms convert graph-search into tree-search For complex problems in which a given state may be reached through many paths, these algorithms perform poorly Breadth-First Heuristic Search Second strategy: maintain duplicate detection, but give up traceback solution reconstruction Proofs

ID Optimality proof (Korf) To see that this is optimal, we present a simple adversary argument. The number of nodes at depth d is bd. Assume that there exists an algorithm that examines less than bd nodes. Then, there must exist at least one node at depth d which is not examined by this algorithm. Since we have no additional information, an adversary could place the only solution at this node and hence the proposed algorithm would fail. Hence, any bruteforce algorithm must take at least cbd time, for some constant c. Proofs IDA* optimal solution Therefore, since IDA* always expands all nodes at a

given cost before expanding any nodes at a greater cost, the first solution it finds will be a solution of least cost. References Korf, Richard E. Depth-First Iterative- Deepening: An Optimal Admissible Tree Search. Russell, Stuart. Efficient memory-bounded serach methods. Zhou, Rong. A Breadth-First Approach to Memory-Efficient Graph Search.