exercises: artificial intelligence - dtai.cs.kuleuven.be · exercises: artificial intelligence...

51
Exercises: Artificial Intelligence Simplified Memory-bounded A*

Upload: lamkiet

Post on 01-May-2019

261 views

Category:

Documents


1 download

TRANSCRIPT

Exercises: Artificial Intelligence

Simplified Memory-bounded A*

SMA* ALGORITHM

Simplified Memory-bounded A*

SMA* Algorithm

• Optimizes A* to work within reduced memory

• Key Idea:

– IF memory full for extra node (C)

– Remove highest f-value leaf (A)– Remove highest f-value leaf (A)

– Remember best-forgotten child in

each parent node (15 in S)

S

A 15 B 13

C 18

13

(15)

E.g. Memory of 3 nodes only

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– Allows monitoring if nodes need deletion

S

A 15 B 13

13

First add A later B

SMA* Algorithm

• Too long paths: Give up

– Extending path cannot fit in memory

• give up (C)

– Set f-value node (C) to ¶¶¶¶

S 13

• Remembers: path cannot be found here B 13

C ¶¶¶¶

D

18

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(S…Mi) > f(S…N)

– THEN reset (through N ï through children)– THEN reset (through N ï through children)

• f(S…N) = min{f(S…Mi)|Mi child of N}

Better estimate for f(S)

S

A 15 B 24

1513

SMA* BY EXAMPLE

Simplified Memory-bounded A*

SMA* by Example

• Perform SMA* (memory: 3 nodes) on the

following figure.A

24

C

S GB3

15

S A B C G

heuristic 3 0 2 1 0

2

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3 3

0

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3 3

0

A0 4

4

Generate children(One by one)

A0 4

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3 3

0

A0 4

4B2 5

3A0 4 B2 5

Generate children(One by one)

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3 3

0

A0 4

4B2 5

3C1 6

5

(5)

A0 4 B2 5 C1 6

Generate children(One by one)

Memory full

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0 4

4C1 6

5

(5)

43

A0 4 C1 6

All children are

explored

Adjust f-values

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0 4

4C1 6

5

(5)

4

A0 4 C1 6

G0 6

6

Generate children(One by one)

Memory full

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0 4

4

(5)

4

6A0 4

G0 6

6

6

All children are

explored

Adjust f-values

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0 6

4

(5)

54

A0 6

G0 6

6

All children are

explored (update)

Adjust f-values

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0

4

6

5

B2 5

3(6)A0

G0 6

6

6 B2 5

Generate children(One by one)

Memory full

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0

A0

4

(6)

6

5

B2 5

3(6)C1 6

5A0 6 B2 5 C1 6

Generate children(One by one)

Memory full

SMA* by Example

C

S

A

GB3

2

1

4

5

2

0

03 2

1

S3

0 (6)

5

B2 5

3C1 6

5B2 5 C1 6

G0 5

5

Generate children(One by one)

Memory full

PROBLEM

Simplified Memory-bounded A*

Problem

• Perform SMA* (memory: 4 nodes) on the

following figure.C

32A E

10 10 9 2

D

S FG

18

S A B C D E F H G

heuristic 12 5 5 5 2 2 1 1 0

B H

8 16 3 1

Problem

S12 12

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

Problem

S12 12

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1A5 15

Problem

S12 12

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8A5 15 B5 13

Problem

S12 12

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8

13

A5 15 B5 13

Problem

S12 13

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8A5 15 B5 13

D2 18

16

Problem

S12 13

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8 (18)A5 15 B5 13

D2 18

16G0 24

24

Problem

S12 13

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8 (18)

18A5 15 B5 13

G0 24

24

18

Problem

S12 13

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8 (18)

15

A5 15 B5 18

G0 24

24

Problem

S12 15

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8 (18)A5 15 B5 18

G0 24

24C5 17

12

Problem

S12 15

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8 (18)

(18)

A5 15 B5 18

G0 20

20C5 17

12

Problem

S12 15

0

A5 15

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

17A5 15

G0 20

20C5 17

12

17

Problem

S12 15

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

17

A5 17

G0 20

20C5 17

12

Problem

S12 17

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)A5 17

G0 20

20C5 17

12

E2 17

15

Problem

S12 17

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)A5 17

C5 17

12

E2 17

15

¶¶¶¶

Problem

S12 17

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)A5 17

C5 17

12

E2

15

¶¶¶¶ G0 21

21

(¶¶¶¶)

Problem

S12 17

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)A5 17

C5 17

12

G0 21

21

(¶¶¶¶)

21

Problem

S12 17

0

A5 17

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)

20A5 17

C5 21

12

G0 21

21

(¶¶¶¶)

20

Problem

S12 17

0

A5 20

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1

(18)

(20)

18

A5 20

C5 21

12

G0 21

21

(¶¶¶¶)

Problem

S12 18

0

A5 20

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1(20)B5 13

8A5 20

C5 21

12

G0 21

21

(21)

B5 13

Problem

S12 18

0

A5 20

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1(20)B5 13

8A5 20

C5 21

12D2 18

16(21)

B5 13

Problem

S12 18

0

A5 20

10D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1(20)B5 13

8

(20)

A5 20

D2 18

16

B5 13

G0 24

24

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 13

8

(20)

18

D2 18

16

B5 13

G0 24

24

18

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8

(20)

(24)

D2 18

16

B5 18

G0 24

24

G0 19

19

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8

(20)

(24)

D2 18

16

B5 18

H1 18

17G0 19

19

(19)

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8

(20)

(24)

D2 18

16

B5 18

H1 18

17

(19)

¶¶¶¶

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8

(20)

(24)

D2 18

16

B5 18

H1

17

(19)

¶¶¶¶

19

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 18

8

(20)

(24)

19

D2 19

16

B5 18

H1

17

(19)

¶¶¶¶

19

Problem

S12 18

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 19

8

(20)

(24)

19

D2 19

16

B5 19

H1

17

(19)

¶¶¶¶

Problem

S12 19

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 19

8

(20)

(24)

D2 19

16

B5 19

H1

17

¶¶¶¶ G0

19

19

Problem

S12 19

0

D

S

C

FG

3

1

2

8B

A E

H

10

8

10 9 2

16 3 1

12

5 5 2

0 1

25 1B5 19

8

(20)

(24)

D2 19

16

B5 19

G0

19

19