SlideShare a Scribd company logo
1 of 123
Download to read offline
Exercises: Artificial Intelligence
A*
A* ALGORITHM
A*
A* Algorithm
• Input:
– QUEUE: Path only containing root
• Algorithm:
– WHILE (QUEUE not empty && first path not reach goal) DO
• Remove first path from QUEUE
Create paths to all children• Create paths to all children
• Reject paths with loops
• Add paths and sort QUEUE (by f = cost + heuristic)
• IF QUEUE contains paths: P, Q
AND P ends in node Ni && Q contains node Ni
AND cost_P ≥ cost_Q
THEN remove P
– IF goal reached THEN success ELSE failure
FIRST EXAMPLE ON A*
A*
A* algorithm by Example
S7
7
0
f = accumulated path cost + heuristic
QUEUE = path containing root
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <S>
A* algorithm by Example
S
f = accumulated path cost + heuristic
A10
11
1
B9
10
1
Remove first path, Create paths to all
children, Reject loops and Add paths.
Sort QUEUE by f
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SB,SA>
A10 B9
A* algorithm by Example
S
f = accumulated path cost + heuristic
A10
11
1
B
Remove first path, Create paths to all
children, Reject loops and Add paths.
Sort QUEUE by f
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SA,SBC,SBG,SBA>
A10 B
C5
12
7
G0
13
13
A10
10
20
A* algorithm by Example
S
f = accumulated path cost + heuristic
A10
11
1
B
IF P terminating in I with cost_P &&
Q containing I with cost_Q AND
cost_P ≥ cost_Q THEN remove P
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SA,SBC,SBG,SBA>
A10 B
C5
12
7
G0
13
13
A10
10
20
A* algorithm by Example
S
f = accumulated path cost + heuristic
A B
Remove first path, Create paths to all
children, Reject loops and Add paths.
Sort QUEUE by f
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SBC,SBG,SAB>
A B
C5
12
7
G0
13
13
B9
10
19
A* algorithm by Example
S
f = accumulated path cost + heuristic
A B
IF P terminating in I with cost_P &&
Q containing I with cost_Q AND
cost_P ≥ cost_Q THEN remove P
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SBC,SBG,SAB>
A B
C5
12
7
G0
13
13
B9
10
19
A* algorithm by Example
S
f = accumulated path cost + heuristic
B
Remove first path, Create paths to all
children, Reject loops and Add paths.
Sort QUEUE by f
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SBCG,SBG>
B
C G0
13
13
G0
12
12
A* algorithm by Example
S
f = accumulated path cost + heuristic
B
IF P terminating in I with cost_P &&
Q containing I with cost_Q AND
cost_P ≥ cost_Q THEN remove P
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SBCG,SBG>
B
C G0
13
13
G0
12
12
A* algorithm by Example
S
f = accumulated path cost + heuristic
B
SUCCESS
CS
A GB10
7 5
9
0
6
9
1 1
12
5
QUEUE: <SBCG>
B
C
G0
12
12
PROBLEM
A*
Problem
• Perform the A* Algorithm on the following
figure. Explicitly write down the queue at each
step.
A
10
6
C
S
A
GB
0
6
D
E
F
1
4
2
13
4
17
10
5
6
6
6
7
4
6
3
A* SEARCH
A*
A* Search
S
QUEUE:
S
17
17
0
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
S
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A10
16
6
B13
18
5
C4
14
10
QUEUE:
SCSC
SA
SB
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A10
16
6
B13
18
5
C QUEUE:
SA
D2
18
16
SA
SCD
SB
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B13
18
5
C QUEUE:
SAE
D2
18
16
E4
16
12
SAE
SCD
SB
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B13
18
5
C QUEUE:
SAEF
D2
18
16
E
F1
17
16
B13
31
18
SAEF
SCD
SB
SAEB
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B13
18
5
C QUEUE:
SCD
D2
18
16
E
F
G0
19
19
D2
24
22
SCD
SB
SAEFG
SAEFD
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B13
18
5
C QUEUE:
SB
DE
F
G0
19
19
F1
23
22
B13
36
23
SB
SAEFG
SCDF
SCDB
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B QUEUE:
SBD
E
F
G0
19
19
E4
15
11
D2
14
12
SBD
SBE
SAEFG
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B QUEUE:
SBE
E
F
G0
19
19
E4
15
11
D
F1
19
18
C4
22
18
SBE
SBDF
SAEFG
SBDC
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B QUEUE:
SBEF
E
F
G0
19
19
ED
F1
19
18
C4
22
18
F1
16
15
A10
27
17
SBEF
SAEFG
SBDF
SBDC
SBEA
A* Search
S
C
S
A
GB
0
6
D
E
F
1
4
2
13
10
4
17
10
5
6
6
6
7
4
6
3
A B QUEUE:
SBEFG
E
F
G0
19
19
ED
C4
22
18
FA10
27
17
G0
18
18
D 23
2
21
SBEFG
SAEFG
SBDC
SBEFD
SBEA
Exercises: Artificial Intelligence
Iterated Deepening A*
IDA* ALGORITHM
Iterated Deepening A*
IDA* Algorithm
• f-bound ôôôô f(S)
• Algorithm:
– WHILE (goal is not reached) DO
• f-bound ôôôô f-limitted_search(f-bound)• f-bound ôôôô f-limitted_search(f-bound)
– Perform f-limited search with f-bound
(See next slide)
f-limitted Search Algorithm
• Input:
– QUEUE ô Path only containing root
– f-bound ô Natural number
– f-new ô ¶
• Algorithm:• Algorithm:
– WHILE (QUEUE not empty && goal not reached) DO
• Remove first path from QUEUE
• Create paths to children
• Reject paths with loops
• Add paths with f(path) ≤ f-bound to front of QUEUE (depth-first)
• f-new ô minimum( {f-new} » {f(P) | P is rejected path} )
– IF goal reached THEN success ELSE report f-new
PROBLEM
Iterated Deepening A*
Problem
• Perform the IDA* Algorithm on the following
figure.
C S A109
G B D
5 1
4
8
5
S A B C D G
heuristic 0 0 4 3 0 0
IDA* SEARCH
Iterated Deepening A*
IDA* Search
S0
0
0
C S A
G B D
5
109
1
4
8
5
f-bound = 0
f-new = ¶¶¶¶
0 0
040
3
f-new = ¶¶¶¶
IDA* Search
S
A0
10
10
B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 0
f-new = 10
A0 B4 C3
f-new = 10
Children are explored
depth-first!
IDA* Search
S0
0
0
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 10
f-new = ¶¶¶¶f-new = ¶¶¶¶
IDA* Search
S
A0
10
10
B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 10
f-new = 12
A0 B4 C3
f-new = 12
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 10
f-new = 11
A B4 C3
D0
11
11
f-new = 11
IDA* Search
S0
0
0
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 11
f-new = ¶¶¶¶f-new = ¶¶¶¶
IDA* Search
S
A0
10
10
B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 11
f-new = 12
A0 B4 C3
f-new = 12
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 11
f-new = 12
A B4 C3
D0
11
11
f-new = 12
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 11
f-new = 12
A B4 C3
D
B4
19
15
f-new = 12
IDA* Search
S0
0
0
C S A
G B D
5
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = ¶¶¶¶f-new = ¶¶¶¶
IDA* Search
S
A0
10
10
B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = ¶¶¶¶
A0 B4 C3
f-new = ¶¶¶¶
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = ¶¶¶¶
A B4 C3
D0
11
11
f-new = ¶¶¶¶
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = 19
A B4 C3
D
B4
19
15
f-new = 19
IDA* Search
S
A B C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = 13
A B C3
D
B4
19
15
D G0
12
12
0
13
13
f-new = 13
IDA* Search
S
A B C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = 13
A B C3
D
B4
19
15
D G0
12
12
0
13
13
A0
13
13
f-new = 13
IDA* Search
S
A B C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 12
f-new = 13
A B C3
D
B4
19
15
D G0
12
12
0
13
13
A0
13
13
G0
14
14
f-new = 13
IDA* Search
S0
0
0
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 13
f-new = ¶¶¶¶f-new = ¶¶¶¶
IDA* Search
S
A0
10
10
B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 13
f-new = ¶¶¶¶
A0 B4 C3
f-new = ¶¶¶¶
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 13
f-new = ¶¶¶¶
A B4 C3
D0
11
11
f-new = ¶¶¶¶
IDA* Search
S
A B4
12
8
C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 13
f-new = 19
A B4 C3
D
B4
19
15
f-new = 19
IDA* Search
S
A B C3
12
9
C S A
G B D
109
1
4
8
5
0 0
040
3
f-bound = 13
f-new = 19
A B C3
D
B4
19
15
D G0
12
12
0
13
13
f-new = 19
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
GB
3
2
1
4
5
2
0
03 2
1
S3 3
0
SMA* by Example
C
S
A
GB
3
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
GB
3
2
1
4
5
2
0
03 2
1
S3 3
0
A0 4
4
B2 5
3
A0 4 B2 5
Generate children
(One by one)
SMA* by Example
C
S
A
GB
3
2
1
4
5
2
0
03 2
1
S3 3
0
A0 4
4
B2 5
3
C1 6
5
(5)
A0 4 B2 5 C1 6
Generate children
(One by one)
Memory full
SMA* by Example
C
S
A
GB
3
2
1
4
5
2
0
03 2
1
S3
0
A0 4
4
C1 6
5
(5)
43
A0 4 C1 6
All children are
explored
Adjust f-values
SMA* by Example
C
S
A
GB
3
2
1
4
5
2
0
03 2
1
S3
0
A0 4
4
C1 6
5
(5)
4
A0 4 C1 6
G0 6
6
Generate children
(One by one)
Memory full
SMA* by Example
C
S
A
GB
3
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
GB
3
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
GB
3
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
GB
3
2
1
4
5
2
0
03 2
1
S3
0
A0
4
(6)
6
5
B2 5
3(6)
C1 6
5
A0 6 B2 5 C1 6
Generate children
(One by one)
Memory full
SMA* by Example
C
S
A
GB
3
2
1
4
5
2
0
03 2
1
S3
0 (6)
5
B2 5
3
C1 6
5
B2 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 32
A 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
8
B
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
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
A5 15
Problem
S12 12
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8
A5 15 B5 13
Problem
S12 12
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8
13
A5 15 B5 13
Problem
S12 13
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8
A5 15 B5 13
D2 18
16
Problem
S12 13
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8 (18)
A5 15 B5 13
D2 18
16
G0 24
24
Problem
S12 13
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8 (18)
18A5 15 B5 13
G0 24
24
18
Problem
S12 13
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8 (18)
15
A5 15 B5 18
G0 24
24
Problem
S12 15
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8 (18)
A5 15 B5 18
G0 24
24
C5 17
12
Problem
S12 15
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8 (18)
(18)
A5 15 B5 18
G0 20
20
C5 17
12
Problem
S12 15
0
A5 15
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
(18)
17A5 15
G0 20
20
C5 17
12
17
Problem
S12 15
0
A5 17
10
D
S
C
FG
3
1
2
8
B
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
20
C5 17
12
Problem
S12 17
0
A5 17
10
D
S
C
FG
3
1
2
8
B
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
20
C5 17
12
E2 17
15
Problem
S12 17
0
A5 17
10
D
S
C
FG
3
1
2
8
B
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
10
D
S
C
FG
3
1
2
8
B
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
10
D
S
C
FG
3
1
2
8
B
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
10
D
S
C
FG
3
1
2
8
B
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
10
D
S
C
FG
3
1
2
8
B
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
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1(20)
B5 13
8
A5 20
C5 21
12
G0 21
21
(21)
B5 13
Problem
S12 18
0
A5 20
10
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1(20)
B5 13
8
A5 20
C5 21
12
D2 18
16(21)
B5 13
Problem
S12 18
0
A5 20
10
D
S
C
FG
3
1
2
8
B
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
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 13
8
(20)
18
D2 18
16
B5 13
G0 24
24
18
Problem
S12 18
0
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 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
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8
(20)
(24)
D2 18
16
B5 18
H1 18
17
G0 19
19
(19)
Problem
S12 18
0
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8
(20)
(24)
D2 18
16
B5 18
H1 18
17
(19)
¶¶¶¶
Problem
S12 18
0
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 18
8
(20)
(24)
D2 18
16
B5 18
H1
17
(19)
¶¶¶¶
19
Problem
S12 18
0
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 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
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 19
8
(20)
(24)
19
D2 19
16
B5 19
H1
17
(19)
¶¶¶¶
Problem
S12 19
0
D
S
C
FG
3
1
2
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 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
8
B
A E
H
10
8
10 9 2
16 3 1
12
5 5 2
0 1
25 1
B5 19
8
(20)
(24)
D2 19
16
B5 19
G0
19
19
Exercises: Artificial Intelligence
Monotonicity 1
PROBLEM
Monotonicity 1
Problem
• Prove that:
– IF a heuristic function h satisfies the monotonicity
restriction
• h(x) ≤ cost(x…y) + h(y)• h(x) ≤ cost(x…y) + h(y)
– THEN f is monotonously non-decreasing
• f(s…x) ≤ f(s…x…y)
Monotonicity 1
• Given:
– h satisfies the monotonicity restriction
• Proof:
f(S…A) = cost(S…A) + h(A)f(S…A) = cost(S…A) + h(A)
Monotonicity 1
• Given:
– h satisfies the monotonicity restriction
• Proof:
f(S…A) = cost(S…A) + h(A)f(S…A) = cost(S…A) + h(A)
≤ cost(S…A) + cost(A…B) + h(B)
Monotonicity 1
• Given:
– h satisfies the monotonicity restriction
• Proof:
f(S…A) = cost(S…A) + h(A)f(S…A) = cost(S…A) + h(A)
≤ cost(S…A) + cost(A…B) + h(B)
≤ cost(S…A…B) + h(B)
Monotonicity 1
• Given:
– h satisfies the monotonicity restriction
• Proof:
f(S…A) = cost(S…A) + h(A)f(S…A) = cost(S…A) + h(A)
≤ cost(S…A) + cost(A…B) + h(B)
≤ cost(S…A…B) + h(B)
≤ f(S…A…B)
Exercises: Artificial Intelligence
Monotonicity 2
PROBLEM
Monotonicity 2
Problem
• Prove or refute:
– IF f is monotonously non-decreasing
• f(s…x) ≤ f(s…xy)
– THEN h is an admissable heuristic– THEN h is an admissable heuristic
• h is an underestimate of the remaining path to the goal
with the smallest cost
• Can an extra constraint on h change this?
Monotonicity 2
• Given:
– f is mononously non-decreasing
• Proof (Counter-example):
S7 7
0
D6 8
2
B6 7
1
G5
3
8
f is monotonously non-decreasing,
yet h is not an admissable heuristic.
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G)
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G) ñ
f(S…A) ≤ f(S…G)
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G) ñ
f(S…A) ≤ f(S…G) ñ
cost(S…A) + h(A) ≤ cost(S…G) + h(G)
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G) ñ
f(S…A) ≤ f(S…G) ñ
cost(S…A) + h(A) ≤ cost(S…G) + h(G) ñ
cost(S…A) + h(A) ≤ cost(S…A) + cost(A…G) + h(G)
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G) ñ
f(S…A) ≤ f(S…G) ñ
cost(S…A) + h(A) ≤ cost(S…G) + h(G) ñ
cost(S…A) + h(A) ≤ cost(S…A) + cost(A…G) + h(G) ñ
h(A) ≤ cost(A…G) + h(G)
Monotonicity 2
• Given:
– f is mononously non-decreasing
– Extra constraint: h(G) = 0
• Proof:• Proof:
f(S…A) ≤ f(S…AB) ≤ … ≤ f(S…AB…G) ñ
f(S…A) ≤ f(S…G) ñ
cost(S…A) + h(A) ≤ cost(S…G) + h(G) ñ
cost(S…A) + h(A) ≤ cost(S…A) + cost(A…G) + h(G) ñ
h(A) ≤ cost(A…G) + h(G) ñ
h(A) ≤ cost(A…G)

More Related Content

What's hot

Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligencesandeep54552
 
Online Shopping Agent in AI
Online Shopping Agent in AIOnline Shopping Agent in AI
Online Shopping Agent in AIFazle Rabbi Ador
 
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search techniqueKapil Dahal
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problemJayesh Chauhan
 
Uninformed search /Blind search in AI
Uninformed search /Blind search in AIUninformed search /Blind search in AI
Uninformed search /Blind search in AIKirti Verma
 
peas description of task environment with different types of properties
 peas description of task environment with different types of properties peas description of task environment with different types of properties
peas description of task environment with different types of propertiesmonircse2
 
MPI Presentation
MPI PresentationMPI Presentation
MPI PresentationTayfun Sen
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmHema Kashyap
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13Kumar
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackSoumen Santra
 
Artificial Intelligence PEAS
Artificial Intelligence PEASArtificial Intelligence PEAS
Artificial Intelligence PEASMUDASIRABBAS9
 
Intro to-iterative-deepening
Intro to-iterative-deepeningIntro to-iterative-deepening
Intro to-iterative-deepeningAdel Totott
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theorySampath Kumar S
 
Network Layer Numericals
Network Layer NumericalsNetwork Layer Numericals
Network Layer NumericalsManisha Keim
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using BacktrackingAbhishek Singh
 

What's hot (20)

Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
 
Online Shopping Agent in AI
Online Shopping Agent in AIOnline Shopping Agent in AI
Online Shopping Agent in AI
 
Uninformed Search technique
Uninformed Search techniqueUninformed Search technique
Uninformed Search technique
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
Uninformed search /Blind search in AI
Uninformed search /Blind search in AIUninformed search /Blind search in AI
Uninformed search /Blind search in AI
 
peas description of task environment with different types of properties
 peas description of task environment with different types of properties peas description of task environment with different types of properties
peas description of task environment with different types of properties
 
MPI Presentation
MPI PresentationMPI Presentation
MPI Presentation
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Dfs
DfsDfs
Dfs
 
Circular queues
Circular queuesCircular queues
Circular queues
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using Stack
 
Artificial Intelligence PEAS
Artificial Intelligence PEASArtificial Intelligence PEAS
Artificial Intelligence PEAS
 
Intro to-iterative-deepening
Intro to-iterative-deepeningIntro to-iterative-deepening
Intro to-iterative-deepening
 
Radix sort
Radix sortRadix sort
Radix sort
 
1.1. the central concepts of automata theory
1.1. the central concepts of automata theory1.1. the central concepts of automata theory
1.1. the central concepts of automata theory
 
Network Layer Numericals
Network Layer NumericalsNetwork Layer Numericals
Network Layer Numericals
 
And or graph problem reduction using predicate logic
And or graph problem reduction using predicate logicAnd or graph problem reduction using predicate logic
And or graph problem reduction using predicate logic
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 

More from Amar Jukuntla (19)

Singly linked list
Singly linked listSingly linked list
Singly linked list
 
Types of files
Types of filesTypes of files
Types of files
 
Hashing
HashingHashing
Hashing
 
Planning
Planning Planning
Planning
 
Unit 2
Unit 2Unit 2
Unit 2
 
Problem Solving
Problem Solving Problem Solving
Problem Solving
 
Intelligent Agents
Intelligent Agents Intelligent Agents
Intelligent Agents
 
Introduction
IntroductionIntroduction
Introduction
 
DFS
DFSDFS
DFS
 
Sorting
SortingSorting
Sorting
 
Sorting
SortingSorting
Sorting
 
Nature of open source
Nature of open sourceNature of open source
Nature of open source
 
Linux Directory System: Introduction
Linux Directory System: IntroductionLinux Directory System: Introduction
Linux Directory System: Introduction
 
Introduction to Data Structures
Introduction to Data StructuresIntroduction to Data Structures
Introduction to Data Structures
 
Learning
LearningLearning
Learning
 
First Order Logic resolution
First Order Logic resolutionFirst Order Logic resolution
First Order Logic resolution
 
First Order Logic
First Order LogicFirst Order Logic
First Order Logic
 
Agents1
Agents1Agents1
Agents1
 
Need of object oriented programming
Need of object oriented programmingNeed of object oriented programming
Need of object oriented programming
 

Recently uploaded

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Recently uploaded (20)

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 

Artificial Intelligence Exercises: A* and IDA* Algorithms