SlideShare a Scribd company logo
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Problem Solving by Searching
Search Methods :
informed (Heuristic) search
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
2
Traditional informed search
strategies
 Greedy Best first search
 “Always chooses the successor node with the best f value”
where f(n) = h(n)
 We choose the one that is nearest to the final state among
all possible choices
 A* search
 Best first search using an “admissible” heuristic function f
that takes into account the current cost g
 Always returns the optimal solution path
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Informed Search Strategies
 Best First Search
Greedy Search
eval-fn: f(n) = h(n)
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
4
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
5
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
6
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
7
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
8
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
9
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
10
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
11
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
12
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
13
Greedy Search
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
14
Greedy Search: Tree Search
A
Start
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
15
Greedy Search: Tree Search
A
B
C
E
Start
75118
140 [374][329]
[253]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
16
Greedy Search: Tree Search
A
B
C
E
F
99
G
A
80
Start
75118
140 [374][329]
[253]
[193]
[366]
[178]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
17
Greedy Search: Tree Search
A
B
C
E
F
I
99
211
G
A
80
Start
Goal
75118
140 [374][329]
[253]
[193]
[366]
[178]
E
[0][253]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
18
Greedy Search: Tree Search
A
B
C
E
F
I
99
211
G
A
80
Start
Goal
75118
140 [374][329]
[253]
[193]
[366]
[178]
E
[0][253]
Path cost(A-E-F-I) = 253 + 178 + 0 = 431
dist(A-E-F-I) = 140 + 99 + 211 = 450
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
19
Greedy Search: Optimal ?
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
dist(A-E-G-H-I) =140+80+97+101=418
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
20
Greedy Search: Complete ?
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = h (n) = straight-line distance heuristic
State Heuristic: h(n)
A 366
B 374
** C 250
D 244
E 253
F 178
G 193
H 98
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
21
Greedy Search: Tree Search
A
Start
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
22
Greedy Search: Tree Search
A
B
C
E
Start
75118
140 [374][250]
[253]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
23
Greedy Search: Tree Search
A
B
C
E
D
111
Start
75118
140 [374][250]
[253]
[244]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
24
Greedy Search: Tree Search
A
B
C
E
D
111
Start
75118
140 [374][250]
[253]
[244]
C[250]
Infinite Branch !
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
25
Greedy Search: Tree Search
A
B
C
E
D
111
Start
75118
140 [374][250]
[253]
[244]
C
D
[250]
[244]
Infinite Branch !
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
26
Greedy Search: Tree Search
A
B
C
E
D
111
Start
75118
140 [374][250]
[253]
[244]
C
D
[250]
[244]
Infinite Branch !
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
27
Greedy Search: Time and Space
Complexity ?
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
140
• Greedy search is not optimal.
• Greedy search is incomplete
without systematic checking of
repeated states.
• In the worst case, the Time and
Space Complexity of Greedy
Search are both O(bm)
Where b is the branching factor and m
the maximum path length
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Informed Search Strategies
 A* Search
 eval-fn: f(n)=g(n)+h(n)
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
29
 Greedy Search minimizes a heuristic h(n) which is an
estimated cost from a node n to the goal state. However,
although greedy search can considerably cut the search
time (efficient), it is neither optimal nor complete.
 Uniform Cost Search minimizes the cost g(n) from the
initial state to n. UCS is optimal and complete but not
efficient.
 New Strategy: Combine Greedy Search and UCS to get an
efficient algorithm which is complete and optimal.
A* Search
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
30
 A* uses a heuristic function which
combines g(n) and h(n): f(n) = g(n) + h(n)
 g(n) is the exact cost to reach node n from
the initial state. Cost so far up to node n.
 h(n) is an estimation of the remaining cost
to reach the goal.
A* Search
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
31
A* (A Star)
n
g(n)
h(n)
f(n) = g(n)+h(n)
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
32
A* Search
f(n) = g(n) + h (n)
g(n): is the exact cost to reach node n from the initial state.
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
33
A* Search: Tree Search
A Start
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
34
A* Search: Tree Search
A
BC E
Start
75118
140
[393] [449]
[447]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
35
A* Search: Tree Search
A
BC E
F
99
G
80
Start
75118
140
[393] [449]
[447]
[417][413]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
36
A* Search: Tree Search
A
BC E
F
99
G
80
Start
75118
140
[393] [449]
[447]
[417][413]
H
97
[415]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
37
A* Search: Tree Search
A
BC E
F
I
99
G
H
80
Start
97
101
75118
140
[393] [449]
[447]
[417][413]
[415]
Goal [418]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
38
A* Search: Tree Search
A
BC E
F
I
99
G
H
80
Start
97
101
75118
140
[393] [449]
[447]
[417][413]
[415]
Goal [418]
I [450]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
39
A* Search: Tree Search
A
BC E
F
I
99
G
H
80
Start
97
101
75118
140
[393] [449]
[447]
[417][413]
[415]
Goal [418]
I [450]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
40
A* Search: Tree Search
A
BC E
F
I
99
G
H
80
Start
97
101
75118
140
[393] [449]
[447]
[417][413]
[415]
Goal [418]
I [450]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* Search
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* Search Tree
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Admissible and Consistency
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Admissible
h(n) =< C(n,g)
Consistency
h(n) =< h(n’) + C(n,n’)
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Admissible
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Admissible
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Consistency
S------B
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* with h() not Admissible
 h() overestimates the cost to reach
the goal state
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
49
A* Search: h not admissible !
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
f(n) = g(n) + h (n) – (H-I) Overestimated
g(n): is the exact cost to reach node n from the initial state.
State Heuristic: h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 138
I 0
140
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
50
A* Search: Tree Search
A Start
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
51
A* Search: Tree Search
A
BC E
Start
75118
140
[393] [449]
[447]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
52
A* Search: Tree Search
A
BC E
F
99
G
80
Start
75118
140
[393] [449]
[447]
[417][413]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
53
A* Search: Tree Search
A
BC E
F
99
G
80
Start
75118
140
[393] [449]
[447]
[417][413]
H
97
[455]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
54
A* Search: Tree Search
A
BC E
F
99
G
H
80
Start
97
75118
140
[393] [449]
[447]
[417][413]
[455] Goal I [450]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
55
A* Search: Tree Search
A
BC E
F
99
G
H
80
Start
97
75118
140
[393] [449]
[447]
[417][413]
[455] Goal I [450]
D[473]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
56
A* Search: Tree Search
A
BC E
F
99
G
H
80
Start
97
75118
140
[393] [449]
[447]
[417][413]
[455] Goal I [450]
D[473]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
57
A* Search: Tree Search
A
BC E
F
99
G
H
80
Start
97
75118
140
[393] [449]
[447]
[417][413]
[455] Goal I [450]
D[473]
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
58
A* Search: Tree Search
A
BC E
F
99
G
H
80
Start
97
75118
140
[393] [449]
[447]
[417][413]
[455] Goal I [450]
D[473]
A* not optimal !!!
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* Algorithm
 A* with systematic checking for
repeated states …
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
60
A* Algorithm
1. Search queue Q is empty.
2. Place the start state s in Q with f value h(s).
3. If Q is empty, return failure.
4. Take node n from Q with lowest f value.
(Keep Q sorted by f values and pick the first element).
5. If n is a goal node, stop and return solution.
6. Generate successors of node n.
7. For each successor n’ of n do:
a) Compute f(n’) = g(n) + cost(n,n’) + h(n’).
b) If n’ is new (never generated before), add n’ to Q.
c) If node n’ is already in Q with a higher f value, replace it with
current f(n’) and place it in sorted order in Q.
End for
8. Go back to step 3.
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
61
A* Search: Analysis
A
B
D
C
E
F
I
99
211
G
H
80
Start
Goal
97
101
75118
111
140
•A* is complete except if there is an
infinity of nodes with f < f(G).
•A* is optimal if heuristic h is
admissible.
•Time complexity depends on the
quality of heuristic but is still
exponential.
•For space complexity, A* keeps all
nodes in memory. A* has worst case
O(bd) space complexity, but an
iterative deepening version is possible
(IDA*).
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* Algorithm
 A* with systematic checking for repeated states
 An Example: Map Searching
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
63
SLD Heuristic: h()
Straight Line Distances to Bucharest
Town SLD
Arad 366
Bucharest 0
Craiova 160
Dobreta 242
Eforie 161
Fagaras 178
Giurgiu 77
Hirsova 151
Iasi 226
Lugoj 244
Town SLD
Mehadai 241
Neamt 234
Oradea 380
Pitesti 98
Rimnicu 193
Sibiu 253
Timisoara 329
Urziceni 80
Vaslui 199
Zerind 374
We can use straight line distances as an admissible heuristic as they will never overestimate
the cost to the goal. This is because there is no shorter distance between two cities than the
straight line distance. Press space to continue with the slideshow.
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
64
Arad
Bucharest
Oradea
Zerind
Faragas
Neamt
Iasi
Vaslui
Hirsov
a
Eforie
Urziceni
Giurgui
Pitesti
Sibiu
Dobreta
Craiova
Rimnicu
Mehadi
a
Timisoara
Lugoj
87
92
142
86
98
86
211
101
90
99
151
71
75
140
118
111
70
75
120
138
146
97
80
140
80
97
101
Sibiu
Rimnicu
Pitesti
Distances Between Cities
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Greedy Search in Action …
 Map Searching
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
66
OradeaZerind
Fagaras
Sibiu
Rimnicu
Timisoara
Arad
F= 366
F= 366
F= 374
F= 374
F= 253
F=253
F= 329
F= 329
F= 178
F= 178
F= 380
F= 380
F= 193
F= 193
Bucharest
F= 0
F= 0
Path cost(Arad-Sibiu-Fagaras-Bucharest) = 253 + 178 + 0 = 431
dist(Arad-Sibiu-Fagaras-Bucharest) = 140 + 99 + 211 = 450
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
A* in Action …
 Map Searching
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
68
OradeaZerind
Fagaras
Pitesti
Sibiu
Craiova
Rimnicu
Timisoara
Bucharest
Arad
F= 0 + 366
F= 366
F= 75 + 374
F= 449
F= 140 + 253
F= 393
F= 118 + 329
F= 447
F= 239 + 178
F= 417
F= 291 + 380
F= 671
F= 220 + 193
F= 413
F= 317 + 98
F= 415
F= 366 + 160
F= 526
F= 418 + 0
F= 418
Bucharest(2)
F= 450 + 0
F= 450
BucharestBucharestBucharest
F= 418 + 0
F= 418
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
Informed Search Strategies
 Iterative Deepening A*
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
70
Iterative Deepening A*:IDA*
 Use f(N) = g(N) + h(N) with admissible and
consistent h
 Each iteration is depth-first with cutoff on
the value of f of expanded nodes
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
71
Consistent Heuristic
 The admissible heuristic h is consistent (or
satisfies the monotone restriction) if for every
node N and every successor N’ of N:
h(N)  c(N,N’) + h(N’)
(triangular inequality)
 A consistent heuristic is admissible.
N
N’ h(N)
h(N’)
c(N,N’)
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
72
IDA* Algorithm
 In the first iteration, we determine a “f-cost limit” – cut-off value
f(n0) = g(n0) + h(n0) = h(n0), where n0 is the start node.
 We expand nodes using the depth-first algorithm and backtrack whenever
f(n) for an expanded node n exceeds the cut-off value.
 If this search does not succeed, determine the lowest f-value among the
nodes that were visited but not expanded.
 Use this f-value as the new limit value – cut-off value and do another
depth-first search.
 Repeat this procedure until a goal node is found.
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
73
8-Puzzle
4
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Cutoff=4
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
74
8-Puzzle
4
4
6
Cutoff=4
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
75
8-Puzzle
4
4
6
Cutoff=4
6
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
76
8-Puzzle
4
3
6
Cutoff=4
6
5
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
77
4
8-Puzzle
4
6
Cutoff=4
6
5
56
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
78
8-Puzzle
4
6
Cutoff=5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
79
8-Puzzle
4
4
6
Cutoff=5
6
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
80
8-Puzzle
4
4
6
Cutoff=5
6
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
81
8-Puzzle
4
4
6
Cutoff=5
6
5
7
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
82
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
83
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5 5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
84
8-Puzzle
4
4
6
Cutoff=5
6
5
7
5 5
f(N) = g(N) + h(N)
with h(N) = number of misplaced tiles
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
85
When to Use Search Techniques
 The search space is small, and
 There are no other available techniques, or
 It is not worth the effort to develop a more
efficient technique
 The search space is large, and
 There is no other available techniques, and
 There exist “good” heuristics
Renas R. Rekany Artificial Intelligence Nawroz University
Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016
86
Conclusions
 Frustration with uninformed search led to the idea
of using domain specific knowledge in a search so
that one can intelligently explore only the relevant
part of the search space that has a good chance of
containing the goal state. These new techniques
are called informed (heuristic) search strategies.
 Even though heuristics improve the performance
of informed search algorithms, they are still time
consuming especially for large size instances.

More Related Content

More from Renas Rekany

C# p5
C# p5C# p5
C# p4
C# p4C# p4
C# p3
C# p3C# p3
C# p2
C# p2C# p2
C# p1
C# p1C# p1
C# with Renas
C# with RenasC# with Renas
C# with Renas
Renas Rekany
 
Object oriented programming inheritance
Object oriented programming inheritanceObject oriented programming inheritance
Object oriented programming inheritance
Renas Rekany
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Renas Rekany
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
Renas Rekany
 
Renas Rajab Asaad
Renas Rajab AsaadRenas Rajab Asaad
Renas Rajab Asaad
Renas Rekany
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
Renas Rekany
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
Renas Rekany
 
Kurdish computer skills lec1, Renas R. Rekany
Kurdish computer skills lec1, Renas R. RekanyKurdish computer skills lec1, Renas R. Rekany
Kurdish computer skills lec1, Renas R. Rekany
Renas Rekany
 
Kurdish computer skills lec3, Renas R. Rekany
Kurdish computer skills lec3, Renas R. RekanyKurdish computer skills lec3, Renas R. Rekany
Kurdish computer skills lec3, Renas R. Rekany
Renas Rekany
 
Kurdish computer skills lec2, Renas R. Rekany
Kurdish computer skills lec2, Renas R. RekanyKurdish computer skills lec2, Renas R. Rekany
Kurdish computer skills lec2, Renas R. Rekany
Renas Rekany
 

More from Renas Rekany (15)

C# p5
C# p5C# p5
C# p5
 
C# p4
C# p4C# p4
C# p4
 
C# p3
C# p3C# p3
C# p3
 
C# p2
C# p2C# p2
C# p2
 
C# p1
C# p1C# p1
C# p1
 
C# with Renas
C# with RenasC# with Renas
C# with Renas
 
Object oriented programming inheritance
Object oriented programming inheritanceObject oriented programming inheritance
Object oriented programming inheritance
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
 
Renas Rajab Asaad
Renas Rajab AsaadRenas Rajab Asaad
Renas Rajab Asaad
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
 
Renas Rajab Asaad
Renas Rajab Asaad Renas Rajab Asaad
Renas Rajab Asaad
 
Kurdish computer skills lec1, Renas R. Rekany
Kurdish computer skills lec1, Renas R. RekanyKurdish computer skills lec1, Renas R. Rekany
Kurdish computer skills lec1, Renas R. Rekany
 
Kurdish computer skills lec3, Renas R. Rekany
Kurdish computer skills lec3, Renas R. RekanyKurdish computer skills lec3, Renas R. Rekany
Kurdish computer skills lec3, Renas R. Rekany
 
Kurdish computer skills lec2, Renas R. Rekany
Kurdish computer skills lec2, Renas R. RekanyKurdish computer skills lec2, Renas R. Rekany
Kurdish computer skills lec2, Renas R. Rekany
 

Recently uploaded

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 

AI heuristic search

  • 1. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Problem Solving by Searching Search Methods : informed (Heuristic) search
  • 2. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 2 Traditional informed search strategies  Greedy Best first search  “Always chooses the successor node with the best f value” where f(n) = h(n)  We choose the one that is nearest to the final state among all possible choices  A* search  Best first search using an “admissible” heuristic function f that takes into account the current cost g  Always returns the optimal solution path
  • 3. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Informed Search Strategies  Best First Search Greedy Search eval-fn: f(n) = h(n)
  • 4. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 4 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 5. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 5 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 6. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 6 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 7. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 7 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 8. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 8 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 9. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 9 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 10. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 10 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 11. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 11 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 12. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 12 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 13. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 13 Greedy Search A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 14. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 14 Greedy Search: Tree Search A Start
  • 15. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 15 Greedy Search: Tree Search A B C E Start 75118 140 [374][329] [253]
  • 16. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 16 Greedy Search: Tree Search A B C E F 99 G A 80 Start 75118 140 [374][329] [253] [193] [366] [178]
  • 17. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 17 Greedy Search: Tree Search A B C E F I 99 211 G A 80 Start Goal 75118 140 [374][329] [253] [193] [366] [178] E [0][253]
  • 18. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 18 Greedy Search: Tree Search A B C E F I 99 211 G A 80 Start Goal 75118 140 [374][329] [253] [193] [366] [178] E [0][253] Path cost(A-E-F-I) = 253 + 178 + 0 = 431 dist(A-E-F-I) = 140 + 99 + 211 = 450
  • 19. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 19 Greedy Search: Optimal ? A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic dist(A-E-G-H-I) =140+80+97+101=418 State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 20. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 20 Greedy Search: Complete ? A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = h (n) = straight-line distance heuristic State Heuristic: h(n) A 366 B 374 ** C 250 D 244 E 253 F 178 G 193 H 98 I 0 140
  • 21. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 21 Greedy Search: Tree Search A Start
  • 22. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 22 Greedy Search: Tree Search A B C E Start 75118 140 [374][250] [253]
  • 23. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 23 Greedy Search: Tree Search A B C E D 111 Start 75118 140 [374][250] [253] [244]
  • 24. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 24 Greedy Search: Tree Search A B C E D 111 Start 75118 140 [374][250] [253] [244] C[250] Infinite Branch !
  • 25. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 25 Greedy Search: Tree Search A B C E D 111 Start 75118 140 [374][250] [253] [244] C D [250] [244] Infinite Branch !
  • 26. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 26 Greedy Search: Tree Search A B C E D 111 Start 75118 140 [374][250] [253] [244] C D [250] [244] Infinite Branch !
  • 27. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 27 Greedy Search: Time and Space Complexity ? A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 140 • Greedy search is not optimal. • Greedy search is incomplete without systematic checking of repeated states. • In the worst case, the Time and Space Complexity of Greedy Search are both O(bm) Where b is the branching factor and m the maximum path length
  • 28. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Informed Search Strategies  A* Search  eval-fn: f(n)=g(n)+h(n)
  • 29. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 29  Greedy Search minimizes a heuristic h(n) which is an estimated cost from a node n to the goal state. However, although greedy search can considerably cut the search time (efficient), it is neither optimal nor complete.  Uniform Cost Search minimizes the cost g(n) from the initial state to n. UCS is optimal and complete but not efficient.  New Strategy: Combine Greedy Search and UCS to get an efficient algorithm which is complete and optimal. A* Search
  • 30. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 30  A* uses a heuristic function which combines g(n) and h(n): f(n) = g(n) + h(n)  g(n) is the exact cost to reach node n from the initial state. Cost so far up to node n.  h(n) is an estimation of the remaining cost to reach the goal. A* Search
  • 31. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 31 A* (A Star) n g(n) h(n) f(n) = g(n)+h(n)
  • 32. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 32 A* Search f(n) = g(n) + h (n) g(n): is the exact cost to reach node n from the initial state. State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 98 I 0 A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 140
  • 33. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 33 A* Search: Tree Search A Start
  • 34. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 34 A* Search: Tree Search A BC E Start 75118 140 [393] [449] [447]
  • 35. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 35 A* Search: Tree Search A BC E F 99 G 80 Start 75118 140 [393] [449] [447] [417][413]
  • 36. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 36 A* Search: Tree Search A BC E F 99 G 80 Start 75118 140 [393] [449] [447] [417][413] H 97 [415]
  • 37. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 37 A* Search: Tree Search A BC E F I 99 G H 80 Start 97 101 75118 140 [393] [449] [447] [417][413] [415] Goal [418]
  • 38. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 38 A* Search: Tree Search A BC E F I 99 G H 80 Start 97 101 75118 140 [393] [449] [447] [417][413] [415] Goal [418] I [450]
  • 39. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 39 A* Search: Tree Search A BC E F I 99 G H 80 Start 97 101 75118 140 [393] [449] [447] [417][413] [415] Goal [418] I [450]
  • 40. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 40 A* Search: Tree Search A BC E F I 99 G H 80 Start 97 101 75118 140 [393] [449] [447] [417][413] [415] Goal [418] I [450]
  • 41. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* Search
  • 42. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* Search Tree
  • 43. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Admissible and Consistency
  • 44. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Admissible h(n) =< C(n,g) Consistency h(n) =< h(n’) + C(n,n’)
  • 45. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Admissible
  • 46. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Admissible
  • 47. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Consistency S------B
  • 48. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* with h() not Admissible  h() overestimates the cost to reach the goal state
  • 49. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 49 A* Search: h not admissible ! A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 f(n) = g(n) + h (n) – (H-I) Overestimated g(n): is the exact cost to reach node n from the initial state. State Heuristic: h(n) A 366 B 374 C 329 D 244 E 253 F 178 G 193 H 138 I 0 140
  • 50. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 50 A* Search: Tree Search A Start
  • 51. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 51 A* Search: Tree Search A BC E Start 75118 140 [393] [449] [447]
  • 52. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 52 A* Search: Tree Search A BC E F 99 G 80 Start 75118 140 [393] [449] [447] [417][413]
  • 53. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 53 A* Search: Tree Search A BC E F 99 G 80 Start 75118 140 [393] [449] [447] [417][413] H 97 [455]
  • 54. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 54 A* Search: Tree Search A BC E F 99 G H 80 Start 97 75118 140 [393] [449] [447] [417][413] [455] Goal I [450]
  • 55. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 55 A* Search: Tree Search A BC E F 99 G H 80 Start 97 75118 140 [393] [449] [447] [417][413] [455] Goal I [450] D[473]
  • 56. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 56 A* Search: Tree Search A BC E F 99 G H 80 Start 97 75118 140 [393] [449] [447] [417][413] [455] Goal I [450] D[473]
  • 57. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 57 A* Search: Tree Search A BC E F 99 G H 80 Start 97 75118 140 [393] [449] [447] [417][413] [455] Goal I [450] D[473]
  • 58. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 58 A* Search: Tree Search A BC E F 99 G H 80 Start 97 75118 140 [393] [449] [447] [417][413] [455] Goal I [450] D[473] A* not optimal !!!
  • 59. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* Algorithm  A* with systematic checking for repeated states …
  • 60. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 60 A* Algorithm 1. Search queue Q is empty. 2. Place the start state s in Q with f value h(s). 3. If Q is empty, return failure. 4. Take node n from Q with lowest f value. (Keep Q sorted by f values and pick the first element). 5. If n is a goal node, stop and return solution. 6. Generate successors of node n. 7. For each successor n’ of n do: a) Compute f(n’) = g(n) + cost(n,n’) + h(n’). b) If n’ is new (never generated before), add n’ to Q. c) If node n’ is already in Q with a higher f value, replace it with current f(n’) and place it in sorted order in Q. End for 8. Go back to step 3.
  • 61. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 61 A* Search: Analysis A B D C E F I 99 211 G H 80 Start Goal 97 101 75118 111 140 •A* is complete except if there is an infinity of nodes with f < f(G). •A* is optimal if heuristic h is admissible. •Time complexity depends on the quality of heuristic but is still exponential. •For space complexity, A* keeps all nodes in memory. A* has worst case O(bd) space complexity, but an iterative deepening version is possible (IDA*).
  • 62. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* Algorithm  A* with systematic checking for repeated states  An Example: Map Searching
  • 63. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 63 SLD Heuristic: h() Straight Line Distances to Bucharest Town SLD Arad 366 Bucharest 0 Craiova 160 Dobreta 242 Eforie 161 Fagaras 178 Giurgiu 77 Hirsova 151 Iasi 226 Lugoj 244 Town SLD Mehadai 241 Neamt 234 Oradea 380 Pitesti 98 Rimnicu 193 Sibiu 253 Timisoara 329 Urziceni 80 Vaslui 199 Zerind 374 We can use straight line distances as an admissible heuristic as they will never overestimate the cost to the goal. This is because there is no shorter distance between two cities than the straight line distance. Press space to continue with the slideshow.
  • 64. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 64 Arad Bucharest Oradea Zerind Faragas Neamt Iasi Vaslui Hirsov a Eforie Urziceni Giurgui Pitesti Sibiu Dobreta Craiova Rimnicu Mehadi a Timisoara Lugoj 87 92 142 86 98 86 211 101 90 99 151 71 75 140 118 111 70 75 120 138 146 97 80 140 80 97 101 Sibiu Rimnicu Pitesti Distances Between Cities
  • 65. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Greedy Search in Action …  Map Searching
  • 66. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 66 OradeaZerind Fagaras Sibiu Rimnicu Timisoara Arad F= 366 F= 366 F= 374 F= 374 F= 253 F=253 F= 329 F= 329 F= 178 F= 178 F= 380 F= 380 F= 193 F= 193 Bucharest F= 0 F= 0 Path cost(Arad-Sibiu-Fagaras-Bucharest) = 253 + 178 + 0 = 431 dist(Arad-Sibiu-Fagaras-Bucharest) = 140 + 99 + 211 = 450
  • 67. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 A* in Action …  Map Searching
  • 68. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 68 OradeaZerind Fagaras Pitesti Sibiu Craiova Rimnicu Timisoara Bucharest Arad F= 0 + 366 F= 366 F= 75 + 374 F= 449 F= 140 + 253 F= 393 F= 118 + 329 F= 447 F= 239 + 178 F= 417 F= 291 + 380 F= 671 F= 220 + 193 F= 413 F= 317 + 98 F= 415 F= 366 + 160 F= 526 F= 418 + 0 F= 418 Bucharest(2) F= 450 + 0 F= 450 BucharestBucharestBucharest F= 418 + 0 F= 418
  • 69. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 Informed Search Strategies  Iterative Deepening A*
  • 70. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 70 Iterative Deepening A*:IDA*  Use f(N) = g(N) + h(N) with admissible and consistent h  Each iteration is depth-first with cutoff on the value of f of expanded nodes
  • 71. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 71 Consistent Heuristic  The admissible heuristic h is consistent (or satisfies the monotone restriction) if for every node N and every successor N’ of N: h(N)  c(N,N’) + h(N’) (triangular inequality)  A consistent heuristic is admissible. N N’ h(N) h(N’) c(N,N’)
  • 72. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 72 IDA* Algorithm  In the first iteration, we determine a “f-cost limit” – cut-off value f(n0) = g(n0) + h(n0) = h(n0), where n0 is the start node.  We expand nodes using the depth-first algorithm and backtrack whenever f(n) for an expanded node n exceeds the cut-off value.  If this search does not succeed, determine the lowest f-value among the nodes that were visited but not expanded.  Use this f-value as the new limit value – cut-off value and do another depth-first search.  Repeat this procedure until a goal node is found.
  • 73. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 73 8-Puzzle 4 6 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles Cutoff=4
  • 74. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 74 8-Puzzle 4 4 6 Cutoff=4 6 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 75. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 75 8-Puzzle 4 4 6 Cutoff=4 6 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 76. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 76 8-Puzzle 4 3 6 Cutoff=4 6 5 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 77. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 77 4 8-Puzzle 4 6 Cutoff=4 6 5 56 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 78. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 78 8-Puzzle 4 6 Cutoff=5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 79. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 79 8-Puzzle 4 4 6 Cutoff=5 6 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 80. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 80 8-Puzzle 4 4 6 Cutoff=5 6 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 81. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 81 8-Puzzle 4 4 6 Cutoff=5 6 5 7 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 82. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 82 8-Puzzle 4 4 6 Cutoff=5 6 5 7 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 83. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 83 8-Puzzle 4 4 6 Cutoff=5 6 5 7 5 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 84. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 84 8-Puzzle 4 4 6 Cutoff=5 6 5 7 5 5 f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
  • 85. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 85 When to Use Search Techniques  The search space is small, and  There are no other available techniques, or  It is not worth the effort to develop a more efficient technique  The search space is large, and  There is no other available techniques, and  There exist “good” heuristics
  • 86. Renas R. Rekany Artificial Intelligence Nawroz University Keep Reading as long as you breathComSci: Renas R. Rekany Nov2016 86 Conclusions  Frustration with uninformed search led to the idea of using domain specific knowledge in a search so that one can intelligently explore only the relevant part of the search space that has a good chance of containing the goal state. These new techniques are called informed (heuristic) search strategies.  Even though heuristics improve the performance of informed search algorithms, they are still time consuming especially for large size instances.