Title: Search in Artificial Intelligence
1Search in Artificial Intelligence
- Find the next move in chess, checkers.
- Scheduling finding a good class schedule.
- Theorem proving given a set of axioms and
inference rules, find a proof of a theorem. - Planning find a sequence of actions to achieve a
goal for a robot. - Natural language understanding find the best
parse of a sentence.
2Dimensions of Search Problems
- In its general form find a desired object among
a set of objects. - Sometimes, you dont even know if the object
exists or not. - In other cases, the goal is to find the best
object. - Blind vs. informed search.
3Specifying a search problem?
- What are states (nodes in graph)?
- What are the operators (arcs between nodes)?
- Initial state?
- Goal test
- Metric (e.g., distance to goal)
1 2 3
7 2 3
4 5 6
4 1 6
E.g., Eight Puzzle
7 8
8 5
4Search
- Types of Search
- Blind
- Heuristic optimization
- Adversary Search
- Analysis
- Completeness
- Time complexity
- Space Complexity
- Guaranteed to find best solution?
- Guaranteed to find the closest solution?
5Search Strategies
- Blind Search
- Generate test
- Depth first search
- Breadth first search
- Iterative deepening search
- Iterative broadening search
- Heuristic search
- Optimizing search
6Depth First Search
- Maintain stack of nodes to visit
- Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
Not for infinite spaces
a
O(bd)
b
e
O(d)
g
h
c
d
f
7Breadth First Search
- Maintain queue of nodes to visit
- Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
Yes
a
O(bd)
b
c
O(bd)
g
h
d
e
f
8Iterative Deepening Search
- DFS with limit incrementally grow limit
- Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
Yes
a
b
e
O(bd)
c
d
f
i
O(d)
L
g
h
j
k
9Search Strategies
?
- Blind Search
- Heuristic Search
- Best-first
- Beam
- Hill climbing
- Simulated annealing
- Optimizing Search
10Heuristic Search
- A heuristic (metric) is
- Function from a state to a real number
- Low number means state is close to goal
- High number means state is far from the goal
Designing a good heuristic is very
important! (And hard) More on this in a bit...
11Best First Search
- Idea
- Breadth first but use priority queue instead of a
queue - Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
a
b
e
No
c
d
f
i
O(bd)
L
g
h
j
k
O(bd)
12Beam Search
- Idea
- Best first but only keep N best items on priority
queue - Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
a
b
e
No
c
d
f
i
O(bd)
L
g
h
j
k
O(b N)
13Hill Climbing
- Idea
- Always choose best child no backtracking
- Evaluation
- Complete?
- Time Complexity?
- Space Complexity?
a
b
e
No - suffers from plateau, local maxima, ridges
c
d
f
i
O(bd) but only in pathological cases
L
g
h
j
k
O(b)
14Simulated Annealing
- Objective avoid local minima
- Technique
- For the most part use hill climbing
- Occasionally take non-optimal step
- Reduce probability(non-optimal) over time
- Comparison to Hill Climbing
- Completeness?
- Speed?
- Space Complexity?
temp
15Search Strategies
?
- Blind Search
- Heuristic Search
- Optimizing Search
- A
- IDA
- SMA
?
Objective is to find the very best solution.
16A Search
Underestimates cost of any solution which can
reached from node
- Idea
- Best first search with admissible heuristic
- Plus keep checking until all possibilities look
worse - Evaluation
- Finds optimal solution?
- Time Complexity?
- Space Complexity?
Yes
O(bd)
O(bd)
17Admissible Heuristics
- f(x) g(x) h(x)
- g cost so far
- h underestimate of remaining costs
e
12
8
d
a
f
10
8
For eight puzzle?
14
20
b
15
c
18Importance of Heuristics
- h1 number of tiles in wrong place
- h2 sum of distances of tiles from correct loc
D IDS A(h1) A(h2) 2 10
6 6 4 112 13 12 6
680 20 18 8 6384 39 25 10
47127 93 39 12 364404 227
73 14 3473941 539 113 18
3056 363 24 39135 1641
19Iterative Deepening A
- Like iterative deepening depth first, but...
- Depth bound modified to be an f-cost limit
- Contour lines bounding search
e
d
a
f
b
c
20SMA
- Problem is f-cost bound increases slowly
- Must do iterative search again and again
- Storing little state between each iteration
- Just one number next highest contour level
- SMA
- Uses all available memory to store state
- Duplicates minimal work
- Optimal in a number of nice ways
21Adversary Search
- Game playing want to make the move for which the
opponent cannot respond well.
a
b
e
max
c
d
f
i
min
L
g
h
j
k
max
-1
min
c
c
c
c
1
f
f
f
f
-1
1
1
max
g
h
h
g
g
h
1
-1
-1
-1
22Alpha-beta Pruning
a
max
b
e
min
c
d
f
i
max
L
g
h
j
k
min
c
c
c
c
f
f
f
f
max