Informed Search and Exploration: Chapter 4 (4.1-4.3)
Informed Search and Exploration: Chapter 4 (4.1-4.3)
Exploration
Chapter 4 (4.1-4.3)
CS 2710
Introduction
Ch.3 searches good
building blocks for
learning about search
But vastly inefficient eg:
Can we
Time
do better?
Space
Breadth
First
B^D
B^D
Optimal?
Y
Complete?
Y
Depth
First
B^M
BM
N
N
Uniform
Cost
>B^D (?)
>B^D (?)
Y
Y
(Quick Partial)
Breadth First
Depth First
Uniform cost
Review
Overview
Heuristic Search
Greedy
A*
Heuristic Functions
Hill-climbing
Simulated Annealing
Local Beam
Genetic Algorithms
CS 2710 Informed Search
Informed Searching
Best-First Search
Best-First Search
Best-first search:
F(n) = g(n)
F(n) = h(n)
f(n) = h(n)
Route Finding
374
366
253
329
10
f(n) = 366
11
Sibiu
253
f(n) = 366
Timisoara
329
Zerind
374
12
Sibiu
Arad
366
253
f(n) = 366
Timisoara
Fagaras
176
329
Oradea
Zerind
380
374
13
Sibiu
Arad
366
Timisoara
253
Fagaras
Bucharest
f(n) = 366
176
329
Oradea
Sibiu
Zerind
380
374
253
14
Exercise
So is Arad->Sibiu->Fagaras->Bucharest optimal?
CS 2710 Informed Search
15
Not optimal.
Not complete.
Space Complexity
Time Complexity
16
Heuristic Functions
Example: 8-Puzzle
Average solution cost for a random
puzzle is 22 moves
Branching factor is about 3
Empty tile in the middle -> four moves
Empty tile on the edge -> three moves
Empty tile in corner -> two moves
17
Heuristic Functions
18
Heuristic Functions
h1 = 7
h2 = 4+0+3+3+1+0+2+1 = 14
19
Admissible Heuristics
20
Heuristic Functions
Is h1
admissible?
consistent?
Is h2
(Manhattan distance)
admissible?
consistent?
21
Dominance
then h2 dominates h1
h2 is better for search
22
Heuristic Functions
23
8-Puzzle
Original
Relaxations
Move from A to B
24
25
A* Search
f(n) = h(n)
26
A* Search
27
A* Search
Complete
Yes, unless there are infinitely many nodes with f <= f(G)
Time
Space
Optimal
28
Route Finding
29
A* Example
30
A* Search
Arad
Sibiu
Arad
646
393
f(n) = 0 + 366
Timisoara
=140+253
Fagaras
415
447
Oradea
Zerind
671
449
Things are
different
now!
31
A* Search Continued
Arad
646
Fagaras
415
Oradea
671
Bucharest
Sibiu
Craiova
Pitesti
Sibiu
450
591
526
417
553
Bucharest
Craiova
Rimnicu Vilcea
418
615
607
32
A* Search; complete
A* is complete.
A* builds search bands of increasing f(n)
At all points f(n) < C*
Eventually we reach the goal contour
Optimally efficient
Most times exponential growth occurs
CS 2710 Informed Search
33
34
Local Search /
Optimization
Idea
is to find the best state.
35
global
max
local
max
shoulder
State Space
CS 2710 Informed Search
36
Problem Formulation
Complete-state formulation
n-queens problem
37
Problem Formulation
38
n-Queens
4
3
5 2
3 3
5
3
4
2
3
39
Hill climbing
Simulated annealing
Local beam search
Genetic Algorithms
40
State Space
CS 2710 Informed Search
41
42
State Space
CS 2710 Informed Search
43
n-Queens
4
3
5 2
3 3
5
3
4
2
3
44
Possible Improvements
Random-restart
Execute hill climbing several times, choose best
result.
If p is probability of a search succeeding, then
expected number of restarts is 1/p.
CS 2710 Informed Search
45
Simulated Annealing
46
Simulated Annealing
Algorithm
Success
47
Traveling Salesperson
Problem
Tour of cities
Visit each one exactly once
Minimize distance/cost/etc.
48
49
50
Concentrates on
promising paths
51
52
Genetic Algorithms
53
Genetic Algorithms
54
A Genetic Algorithm
55