Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Chapter 4
Beyond Classical Search
Jane Hsu
National Taiwan University
Acknowledgements: This presentation is created by Jane hsu based on the lecture slides from The Artificial Intelligence: A Modern Approach by Russell & Norvig, a PowerPoint version by Min-Yen Kan, as well as various materials from the web.
Beyond Classical Search © Jane Hsu 2
Outline
� Local Search Algorithms
� Hill climbing
� Simulated annealing
� Genetic algorithms
� Local search in continuous spaces
� Searching with nondeterministic actions
� Searching with partial observations
� Online Search
10/02/2012 © Jane Hsu 3
General Search Problem
� Given:
� Problem space (or state space)
� A set of nodes N (each representing a problem state)
� A successor function Next(n) defining the next states
� Start node
� Goal: a subset of N
� To find
� One path from the start node to a goal node
� All paths from the start node to any goal node
� The best path from the start to the best goal
Beyond Classical Search © Jane Hsu 4
State Representation
� A state is a “black box” – any data
structure that supports
� successor function
� heuristic function, and
� goal test
Beyond Classical Search © Jane Hsu 6
Iterative Improvement Algorithms
� In many optimization problems, path is irrelevant; the goal state itself is the solution
� State space = set of "complete" configurations
� Find optimal configuration, e.g., TSP
� Find configuration satisfying constraints, e.g., n-queens
� In such cases, we can use iterative improvement, also called local search algorithms
� keep a single "current" state, try to improve it
� Constant space
� Online or offline search
Beyond Classical Search © Jane Hsu 7
Traveling Salesperson Problem
� Start with any complete tour, perform pair-wise exchanges.
� Variants of this approach get within 1% of optimal very quickly with thousands of cities.
Beyond Classical Search © Jane Hsu 10
Hill-Climbing (Gradient Ascent/Descent)
“Like climbing Everest in thick fog with amnesia”
Beyond Classical Search © Jane Hsu 13
Problems in Hill-Climbing Search
� Consider the state space landscape
Beyond Classical Search © Jane Hsu 14
Simulated Annealing
� Idea: escape local maxima by allowing some "bad" moves
but gradually decrease their size & frequency
�
Beyond Classical Search © Jane Hsu 15
Simulated Annealing
� Idea: escape local maxima by allowing some "bad" moves
but gradually decrease their size & frequency
�
Beyond Classical Search © Jane Hsu 16
Properties of Simulated Annealing
� At fixed temperature T, state occupation probability reaches Boltzman distribution
� One can prove: If T decreases slowly enough, then simulated annealing search will find a global optimum with probability approaching 1
� Devised by Metropolis et al. (1953) for physical process modeling
� Widely used in VLSI layout, airline scheduling, etc
kT
xE
exP
)(
)(
∆
= α
Beyond Classical Search © Jane Hsu 18
Local Beam Search
� Keep track of (top) k states rather than just one� Start with k randomly generated states
� At each iteration, all the successors of all k states are generated
� If any one is a goal state, stop; else select the k best successors from the complete list and repeat.
� Question: is it k searches run in parallel?
� Problem: all k states end up on same local hill
� Solution idea: choose k successors randomly, biased towards good ones.
Beyond Classical Search © Jane Hsu 19
Genetic Algorithms
� Population: Start with k randomly generated individuals (i.e. states)
� Individual: each is represented as a string over a finite alphabet (often a string of 0s and 1s)
� Fitness function: evaluation of the “goodness”
of a given state.
� A successor is generated by combining two parents from the current population.
� Produce the next generation of states by selection, crossover, and mutation
Beyond Classical Search © Jane Hsu 20
Genetic Algorithms
� Fitness function: number of non-attacking pairs of queens (min = 0, max = 8 × 7/2 = 28)
� 24/(24+23+20+11) = 31%
� 23/(24+23+20+11) = 29% etc
Beyond Classical Search © Jane Hsu 24
Example: Airport Site Planning
� Suppose we want to place three new airports anywhere in Romania, such all cities have easy access to airports.
� 6-D state space (x1,y1),(x2,y2),(x3,y3)
� Objective function
f(x1,y1,x2,y2,x3,y3) = sum of squared distances from each city to its nearest airport
Beyond Classical Search © Jane Hsu 25
Continuous Search Spaces
� Most real-world environments are continuous.
� Successor function would return infinitely many states!
� Solution ideas
� Discretization
� Gradient of the objective function
� Empirical gradient
� Line search
� Newton-Raphson method to solve
Erratic Vacuum World
� Action: Suck
� When applied to a dirty square the action cleans the square and sometimes cleans up dirt in an adjacent square, too.
� When applied to a clean square the action sometimes deposit dirt on the carpet.
� Use a Results function that returns a set of possible outcome states.
� Solution?
Beyond Classical Search © Jane Hsu 29
Contingency Plan
� [Suck, if State=5 then [Right, Such] else []]
� Solutions for nondeterministic problems can contain nested if-then-else statements.
� Selection of actions based on contingencies arising during execution.
� Exact prediction is impossible for many real-world problems.
� People keep their eyes open while walking/driving
Beyond Classical Search © Jane Hsu 30
Slippery Vacuum World
� Original vacuum world +
� Movement actions sometimes fail, leaving the agent in the same location.
� There is no way to move reliably.
� All solutions for this problem are cyclic plans
Beyond Classical Search © Jane Hsu 34