You are on page 1of 51

Exercises: Artificial Intelligence

Simplified Memory-bounded A*
Simplified Memory-bounded A*

SMA* ALGORITHM
SMA* Algorithm
• Optimizes A* to work within reduced memory
• Key Idea:
– IF memory full for extra node (C)
– Remove highest f-value leaf (A) (15)
– Remember best-forgotten child in
S 13

each parent node (15 in S)


A 15 B 13

E.g. Memory of 3 nodes only C 18


SMA* Algorithm
• Generate Children 1 by 1
– Expanding: add 1 child at the time to QUEUE
– Avoids memory overflow
– Allows monitoring if nodes need deletion

S 13

A 15 B 13 First add A later B


SMA* Algorithm
• Too long paths: Give up
– Extending path cannot fit in memory
• give up (C) S 13

– Set f-value node (C) to ¶


• Remembers:
path cannot be found here B 13

C 18 ¶

E.g. Memory of 3 nodes only D


SMA* Algorithm
• Adjust f-values
– IF all children Mi of node N have been explored
– AND "i: f(S…Mi) > f(S…N)
– THEN reset (through N ï through children)
• f(S…N) = min{f(S…Mi)|Mi child of N}

S 13 15

A 15 B 24 Better estimate for f(S)


Simplified Memory-bounded A*

SMA* BY EXAMPLE
SMA* by Example
• Perform SMA* (memory: 3 nodes) on the
following figure.
A
4 2

3 2
S B G
5 1

C
S A B C G
heuristic 3 0 2 1 0
SMA* by Example
0

4
A 2
0
3 S 3
3
S
3
2
B
2
0
G
1
5 1
C
SMA* by Example
0

4
A 2
0
3 S 3
3
S
3
2
B
2
0
G
1
5 1
4
A C
0 4
Generate children
(One by one)
SMA* by Example
0

4
A 2
0
3 S 3
3
S
3
2
B
2
0
G
1
5 1
4
A 3
B C
0 4 2 5
Generate children
(One by one)
SMA* by Example
0

4
A 2
0 (5)
3 S 3
3
S
3
2
B
2
0
G
1
5 1
4
A 3
B 5
C C
0 4 2 5 1 6
Generate children
(One by one)

Memory full
SMA* by Example
0

4
A 2
0 (5)
3 S 3 4
S
3
3
2
B
2
0
G
1
5 1
4
A 5
C C
0 4 1 6
All children are
explored
Adjust f-values
SMA* by Example
0

4
A 2
0 (5)
3 S 4
3
S
3
2
B
2
0
G
1
5 1
4
A 5
C C
0 4 1 6
Generate children
(One by one)
6
0 G 6
Memory full
SMA* by Example
0

4
A 2
0 (5)
3 S 4
S
3
3
2
B
2
0
G
1
5 1
4
A C
0 4 6
All children are
6 explored
0 G 6
Adjust f-values
SMA* by Example
0

4
A 2
0 (5)
3 S 4 5
3
S
3
2
B
2
0
G
1
5 1
4
A C
0 6
All children are
6 explored (update)
0 G 6
Adjust f-values
SMA* by Example
0

4
A 2
0
3 S 5
3
S
3
2
B
2
0
G
1
5 1
4
A (6) 3
B C
0 6 2 5
Generate children
(One by one)
6
0 G 6
Memory full
SMA* by Example
0

4
A 2
0 (6)
3 S 5
3
S
3
2
B
2
0
G
1
5 1
4
A (6) 3
B 5
C C
0 6 2 5 1 6
Generate children
(One by one)

Memory full
SMA* by Example
0

4
A 2
0 (6)
3 S 5
3
S
3
2
B
2
0
G
1
5 1
3
B 5
C C
2 5 1 6
Generate children
(One by one)
5
0 G 5
Memory full
Simplified Memory-bounded A*

PROBLEM
Problem
• Perform SMA* (memory: 4 nodes) on the
following figure. 2 3
A C E
10 10 9 2

S G F
8 16 3 1
8 1
B D H
S A B C D E F H G
heuristic 12 5 5 5 2 2 1 1 0
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 12
12 S G 0 F 1
8 16 3 1
8 1
B D H
5 2 1
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 12
12 S G 0 F 1
8 16 3 1
8 1
B D H
10
5 A 15
5 2 1
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 12
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8
5 A 15 5 B 13
5 2 1
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 12 13
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8
5 A 15 5 B 13
5 2 1
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 13
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8
5 A 15 5 B 13
5 2 1

16
2 D 18
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 13
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8 (18)
5 A 15 5 B 13
5 2 1

16 24
2 D 18 0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 13
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8 (18)
5 A 15 5 B 13 18
5 2 1

24
0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 13 15
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8 (18)
5 A 15 5 B 18
5 2 1

24
0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 15
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8 (18)
5 A 15 5 B 18
5 2 1

12 24
5 C 17 0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 15
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 8 (18)
5 A 15 5 B 18
5 2 1

12 20
5 C 17 0 G 20
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 15
12 S G 0 F 1
8 16 3 1
8 1
B D H
10
5 A 15 17
5 2 1

12 20
5 C 17 0 G 20
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 15 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10
5 A 17
5 2 1

12 20
5 C 17 0 G 20
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 17
5 2 1

12 20
5 C 17 0 G 20
15
2 E 17
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 17
5 2 1

12
5 C 17

15
2 E 17 ¶
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 17
5 2 1

12 ¶)

5 C 17

15 21
2 E ¶ 0 G 21
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 17
5 2 1

12 ¶)

5 C 17 21

21
0 G 21
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 17 20
5 2 1

12 ¶)

5 C 21

21
0 G 21
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (18)
12 S 17 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20)
5 A 20
5 2 1

12 ¶)

5 C 21

21
0 G 21
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20) 8
5 A 20 5 B 13
5 2 1

12 (21)
5 C 21

21
0 G 21
Problem 5 5 2
2 3
A C E
10 10 9 2
0
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20) 8
5 A 20 5 B 13
5 2 1

12 (21) 16
5 C 21 2 D 18
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
10 (20) 8
5 A 20 5 B 13
5 2 1

16 24
2 D 18 0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8
5 B 13 18
5 2 1

16 24
2 D 18 0 G 24
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 18
5 2 1

16 24
2 D 18 0 G 24
19
0 G 19
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 18
5 2 1

16 (19)
2 D 18

19 17
0 G 19 1 H 18
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 18
5 2 1

16 (19)
2 D 18

17
1 H 18 ¶
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 18
5 2 1

16 (19)
2 D 18 19

17
1 H ¶
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 18 19
5 2 1

16 (19)
2 D 19

17
1 H ¶
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 18 19
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 19
5 2 1

16 (19)
2 D 19

17
1 H ¶
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 19
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 19
5 2 1

16
2 D 19

17 19
1 H ¶ 0 G 19
Problem 5 5 2
2 3
A C E
10 10 9 2
0 (20)
12 S 19
12 S G 0 F 1
8 16 3 1
8 1
B D H
8 (24)
5 B 19
5 2 1

16
2 D 19

19
0 G 19

You might also like