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)
Remember best-forgotten child in
each parent node (15 in S)

S
A

E.g. Memory of 3 nodes only

15

(15)
13

13

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
A

15

13

13

First add A later B

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

13

13

18

Set f-value node (C) to


Remembers:
path cannot be found here

E.g. Memory of 3 nodes only

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

S
A

15

13 15

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.

C
heuristic

SMA* by Example
0
0
3

3
3

4
3
5

A
2

B
1

2
2
1

SMA* by Example
0
0
3

3
3

4
3
5

4
0

A
2

B
1

2
2

Generate children
(One by one)

SMA* by Example
0
0
3

3
3

4
3
5

4
0

3
4 2

A
2

B
1

2
2

Generate children
(One by one)

SMA* by Example
0
0
3

(5)
3

4
3
5

4
0

3
4 2

5
5 1

A
2

B
1

2
2

Generate children
(One by one)

Memory full

SMA* by Example
0
0
3

(5)
3 4

4
3
5

4
0

5
4 1

A
2

B
1

2
2

All children are


explored

Adjust f-values

SMA* by Example
0
0
3

(5)
4

4
3
5

4
0

5
4 1

A
2

B
1

2
2

Generate children
6
0

(One by one)
6

Memory full

SMA* by Example
0
0
3

(5)
4

4
3
5

4
0

6
0

A
G

4 6

A
2

B
1

2
2

All children are


explored
6

Adjust f-values

SMA* by Example
0
0
3

(5)
4 5

4
3
5

4
0

6
0

A
G

A
2

B
1

2
2

All children are


explored (update)
6

Adjust f-values

SMA* by Example
0
0
3

3
5

4
3
5

4
0

(6) 3
6 2

A
2

B
1

2
2

Generate children
6
0

(One by one)
6

Memory full

SMA* by Example
0
0
3

(6)
5

4
3
5

4
0

(6) 3
6 2

5
5 1

A
2

B
1

2
2

Generate children
(One by one)

Memory full

SMA* by Example
0
0
3

(6)
5

4
3
5

3
2

5
5 1

A
2

B
1

2
2

Generate children
5
0

(One by one)
5

Memory full

Simplified Memory-bounded A*

PROBLEM

Problem
Perform SMA* (memory: 4 nodes) on the
following figure.
2
3

10

10

16
8

B
heuristic

E
F

1
1

12

Problem

5
2

10
0
12

12

12

2
3

10 9

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

12

5
15

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

12

8
15 5

5
13

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

12 13

8
15 5

5
13

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

13

13

16
2

18

E
2

16 3

8
15 5

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

13

A
16
2

8
15 5

24
18 0

(18)
13

G 24

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

13

8
15 5

24
0

(18)
13 18

G 24

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

13 15

8
15 5

24
0

(18)
18

G 24

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

15

12
5

8
15 5

(18)
18

24
17 0

G 24

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
15

12

12
5

A
20
17 0

8
15 5

G 20

(18)
18

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
15

12

12
5

20
17 0

5
15 17

G 20

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
15 17

12

12
5

20
17 0

5
17

G 20

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17

12

12
5

20
17 0

15
2

17

(20)
17

G 20

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17

12

(20)
17

12
5

17

15
2

17

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17

12

12
5

15
2

(20)
17

(
)
17

21
0

G 21

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17

12

(20)
17

12
5

(
)
17 21

21
0

G 21

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17

12

(20)
17 20

12
5

(
)
21

21
0

G 21

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(18)
17 18

12

(20)
20

12
5

(
)
21

21
0

G 21

10 9

8
10
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

18

(20) 8
20 5

12
5

(21)
21

21
0

G 21

5
13

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

12

18

12
5

13

(21) 16
21 2

18

E
2

16 3

(20) 8
20 5

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

(20) 8
20 5

16
2

24
18 0

5
13

G 24

E
2

16 3

10 9

8
10
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

16
2

24
18 0

5
13 18

G 24

E
2

16 3

10 9

8
8
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

16
2

24
18 0

19
0

G 19

(24)
18

G 24

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

16
2

19
0

(24)
18

(19)
18

17
19 1

E
2

16 3

B
5

18

10 9

8
8
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

(24)
18

16
2

(19)
18

17
1

18

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

(24)
18

16
2

(19)
18 19

17
1

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18

12

(24)
18 19

16
2

(19)
19

17
1

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
18 19

12

(24)
19

16
2

(19)
19

17
1

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
19

12

17
1

(24)
19

16
2

19

19
0

G 19

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

Problem

5
2

10
0
12

(20)
19

12

(24)
19

16
2

19

19
0

G 19

10 9

8
8
5

E
2

16 3

B
5

D
2

1
1

H
1

You might also like