More advanced aspects of search Extensions of A* Extensions of A* Iterated deepening A* Simplified Memory-bounded A* Iterative-deepening A* Memory problems with A* A* is similar to breadth-first: Breadthfirst d=1 d=2 d=3 d=4 Expand by depth-layers A* f1 f2 f3 f4 Expands by f-contours Here: 2 extensions of A* that improve memory usage. 4 Iterative deepening A* Depth-first in each f- f1 contour f2 f3 f4 Perform depth-first search LIMITED to some f-bound. If goal found: ok. Else: increase de fbound and restart. How to establish the f-bounds? - initially: f(S) generate all successors record the minimal f(succ) > f(S) Continue with minimal f(succ) instead of f(S) 5 Example: f-limited, f-bound = 100 f-new = 120 S f=100 A f=120 D f=140 B f=130 G f=125 C f=120 E f=140 F f=125 6 Example: f-limited, f-bound = 120 f-new = 125 S f=100 A f=120 D f=140 B f=130 G f=125 C f=120 E f=140 F f=125 7 Example: f-limited, f-bound = 125 S f=100 A f=120 D f=140 B f=130 G f=125 C f=120 E f=140 F f=125 SUCCESS 8 f-limited search: 1. QUEUE <-- path only containing the root; f-bound <-- <some natural number>; f-new <-- 2. WHILE QUEUE is not empty AND goal is not reached DO remove the first path from the QUEUE; create new paths (to all children); reject the new paths with loops; add the new paths with f(path) f-bound to front of QUEUE; f-new <-- minimum of current f-new and of the minimum of new f-values which are larger than f-bound 3. IF goal reached THEN success; ELSE report f-new ; 9 Iterative deepening A*: 1. f-bound <-- f(S) 2. WHILE DO goal is not reached perform f-limited search; f-bound <-- f-new 10 Properties of IDA* Complete and optimal: under the same conditions as for A* Memory: Let be the minimal cost of an arc: == O( b* (cost(B) /) ) Speed: depends very strongly on the number of f-contours there are !! In the worst case: f(p) f(q) for every 2 paths: 1 + 2 + ….+ N = O(N2) 11 Why is this optimal, even without monotonicity ?? In absence of Monotonicity: we can have search spaces like: S 100 120 150 C A B D 90 E 60 120 F 140 If f can decrease, how can we be sure that the first goal reached is the optimal one ??? 12 Properties: practical If there are only a reduced number of different contours: IDA* is one of the very best optimal search techniques ! Example: the 8-puzzle But: also for MANY other practical problems Else, the gain of the extended f-contour is not sufficient to compensate recalculating the previous In such cases: increase f-bound by a fixed number at each iteration: effects: less re-computations, BUT: optimality is lost: obtained solution can deviate up to 13 Simplified Memory-bounded A* Simplified Memory-bounded A* Fairly complex algorithm. Optimizes A* to work within reduced memory. Key idea: (15) 13 15 A S B 13 C 18 memory of 3 nodes only If memory is full and we need to generate an extra node (C): Remove the highest fvalue leaf from QUEUE (A). Remember the f-value of the best ‘forgotten’ child in each parent node (15 in S). 15 Generate children 1 by 1 13 A When expanding a node (S), only add its children 1 at a time to QUEUE. S B First add A, later B we use left-to-right Avoids memory overflow and allows monitoring of whether we need to delete another node 16 Too long path: give up 13 S B 13 If extending a node would produce a path longer than memory: give up on this path (C). Set the f-value of the node (C) to 18 C D memory of 3 nodes only (to remember that we can’t find a path here) 17 Adjust f-values 15 13 15 A S B 24 better estimate for f(S) If all children M of a node N have been explored and for all M: f(S...M) f(S...N) then reset: f(S…N) = min { f(S…M) | M child of N} A path through N needs to go through 1 of its children ! 18 SMA*: an example: 10 0+12=12 S 8 8+5=13 10+5=15 A B 8 16 10 10 20+5=25 C G1 20+0=20 D 16+2=18 G2 24+0=24 8 10 10 8 30+5=35 E G3 30+0=30 24+0=24 G4 F 24+5=29 12 12 S 12 13 S A 15 13 (15) S A 15 B S 13 A B 15 D 18 13 19 Example: continued 13 (15) S B D 10 8+5=13 10+5=15 A B 13 8 16 10 10 20+5=25 C G1 20+0=20 D 16+2=18 G2 24+0=24 8 10 10 8 30+5=35 E G3 30+0=30 24+0=24 G4 F 24+5=29 15 13 (15) 15 (15) S 24 () D 0+12=12 S 8 B 13 G2 24 15 (24) S 15 A B () 24 G2 24 S 15 B A C 25 24 20 15 15 (24) S 20 A 15 C () G1 20 20 SMA*: properties: Complete: If available memory allows to store the shortest path. Optimal: If available memory allows to store the best path. Otherwise: returns the best path that fits in memory. Memory: Uses whatever memory available. Speed: If enough memory to store entire tree: same as A* 21