Knowledge Representation IV Inference in First-Order Logic CSE 473.
Informed Search CSE 473 University of Washington.
-
date post
21-Dec-2015 -
Category
Documents
-
view
215 -
download
0
Transcript of Informed Search CSE 473 University of Washington.
© Daniel S. Weld 2
Last Time
• Agents• Problem Spaces• Blind Search
DFS BFS Iterative Deepening Iterative Broadening
© Daniel S. Weld 3
Best-first SearchGeneralization of breadth first searchPriority queue of nodes to be exploredCost function f(n) applied to each node
Add initial state to priority queueWhile queue not empty Node = head(queue) If goal?(node) then return node
Add children of node to queue
© Daniel S. Weld 4
Old Friends
• Breadth first = best first With f(n) = depth(n)
• Dijkstra’s Algorithm = best first With f(n) = g(n) Where g(n) = sum of edge costs from start to
n Space bound (stores all generated nodes)
© Daniel S. Weld 5
A* Search
• Hart, Nilsson & Rafael 1968 Best first search with f(n) = g(n) + h(n) Where g(n) = sum of edge costs from start to n And h(n) = estimate of lowest cost path n-->goal If h(n) is admissible then search will find optimal
Underestimates cost of any solution which can reached from node{
Space bound since must maintain queue
© Daniel S. Weld 16
Iterative-Deepening A*• Like iterative-deepening depth-first, but...• Depth bound modified to be an f-limit
Start with limit = h(start) Prune any node if f(node) > f-limit Next f-limit=min-cost of any node pruned
a
b
c
d
e
fFL=15
FL=21
© Daniel S. Weld 17
IDA* Analysis
• Complete & Optimal (ala A*)• Space usage depth of solution• Each iteration is DFS - no priority queue!• # nodes expanded relative to A*
Depends on # unique values of heuristic function In 8 puzzle: few values close to # A* expands In traveling salesman: each f value is unique
1+2+…+n = O(n2) where n=nodes A* expandsif n is too big for main memory, n2 is too long to wait!
• Generates duplicate nodes in cyclic graphs
© Daniel S. Weld 18
SMA*• Problem with IDA*: f-limit 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• Keeps bounded-size priority queue• When needs memory, drops node with highest f-cost• In ancestor of forgotten nodes, retains cost of best path which
has been dropped. This focuses regeneration. Duplicates minimal work Optimal in a number of nice ways
© Daniel S. Weld 20
No
O(b^d)
O(b + N)
Beam Search
• Idea Best first but only keep N best items on
priority queue• Evaluation
Complete?
Time Complexity?
Space Complexity?
© Daniel S. Weld 21
Hill Climbing• Idea
Always choose best child; no backtracking
Beam search with |queue| = 1
• Problems? Local maxima
Plateaus
Diagonal ridges
“Gradient ascent”
© Daniel S. Weld 22
Randomizing Hill Climbing
• Randomly disobeying heuristic• Random restarts
• [Add something on heavy tailed distribution]
© Daniel S. Weld 23
Simulated Annealing• Objective: avoid local minima• Technique:
For the most part use hill climbing When no improvement possible
• Choose random neighbor• Let be the decrease in quality• Move to neighbor with probability e --/T
Reduce “temperature” (T) over time• Pros & cons
Optimal?
temp
If T decreased slowly enough, will reach optimal state
• Widely used• See also
WalkSAT
© Daniel S. Weld 24
Limited Discrepancy Search
• Discrepancy bound indicates how often to violate heuristic
• Iteratively increase...
a
b
c
d
e
f
g
h
Assume that heuristic says go left
© Daniel S. Weld 25
174611094281174629844710
Genetic Algorithms • Start with random population
Representation serialized States are ranked with “fitness function”
• Produce new generation Select random pair(s):
• probability ~ fitness Randomly choose “crossover point”
• Offspring mix halves Randomly mutate bits
776511094281 776529844710
164611094281
776029844210
Crossover Mutation