Next: About this document ...
Artificial Intelligence I
CS473 -- Autumn 2001
Lectures # 9 - 10
Today: Local Search
R&N Sec. 4.4, Sec. 6.4, Exer. 6.15, Sec. 20.8
Next: Knowledge Representation
R&N Ch. 6, 7, selected parts of Ch. 8, 9, 10
Henry Kautz
A Different Approach
So far, we have considered methods that systematically
explore the full search space, possibly using
principled pruning (A* etc.).
The current best such algorithms (IDA* / SMA*) can handle
search spaces of up to 1#1 states / around
500 binary valued variables.
(These are ``ballpark '' figures only!)
What if we have 10,000 or 100,000 variables / search spaces
of up to 2#2 states?
A completely different kind of method is called for:
Local Search Methods or
Iterative Improvement Methods
Local Search Methods
Approach quite general: any NP-complete problem / CSP.
Other examples: planning, scheduling, TSP, graph coloring,
and time-tabling.
In fact, many (most?) large Operations Research problems
are solved using local search.
E.g. Delta airlines (near-optimal!)
Q. What's the ``competitor'' in OR?
Key idea (suprisingly simple)
(a) Select (random) initial state
(initial guess at solution)
(b) Make local modification to try
to improve current state.
(c) repeat (b) till goal state found
(or out of time).
Example
Graph coloring.
(a) start with random coloring of nodes
(b) change the coloring of one of the nodes to reduce
conflicts
(c) repeat (b)
3#3
#1 #2 #3 #4 || # conflicts
R R B R || 3
Notes
``successor'' normally called ``neighbor''
You search in the neighborhood of current state.
When does Hill-Climbing stop?
Current approaches: Often simply keep going!
Use: time limit.
Simple method: very fast, uses minimal memory,
surprisingly effective!
6#6 variables, 7#7 constraints.
Example
A wide variety of key CS problems can be translated into a
propositional logical formalization
e.g., (A 8#8 B 8#8 C) 9#9 (10#10B 9#9 C 8#8 D) 9#9 (A 8#8 10#10C 8#8 D)
and solved by finding a truth assignment to the propositional
variables (A, B, C,...) that makes it true, i.e., a model.
If a formula has a model, we say that it is ``satisfiable''.
Conjunctive Normal Form (CNF)
Special kind of CSP.
Applications:
planning and scheduling
circuit diagnosis and synthesis
deductive reasoning
software testing
etc.
Satisfiability Testing
Best-known method: Davis-Putnam Procedure (1960)
Backtrack search (DFS) through the space of
truth assignments
Arc consistency for CNF is called unit-propagation
Q. How would that work?
0in
11#11
To date, Davis-Putnam still the fastest sound and
complete method.
Used in verification, planning...
However, there are classes of formulas where the procedure
scales badly.
Consider an incomplete local search procedure.
Greedy Local Search -- GSAT
Begin with a random truth assignment (assume CNF).
Flip the value assigned to the variable that
yields the
greatest number of satisfied clauses.
(Note: Flip even if there is no improvement.)
Repeat until a model is found, or have performed
a specified maximum number of flips.
If a model is still not found, repeat the entire process,
starting from a different initial random assignment.
12#12 |
13#13 |
14#14 |
15#15 |
9#9 |
16#16 |
9#9 |
17#17 |
Score |
F |
F |
F |
18#18 |
|
19#19 |
|
19#19 |
2 |
F |
F |
T |
19#19 |
|
19#19 |
|
18#18 |
2 |
F |
T |
T |
19#19 |
|
19#19 |
|
19#19 |
3 |
(Selman, Levesque, and Mitchell 1992)
How well does it work?
First intuition: It will get stuck in local minima,
with a few unsatisfied clauses.
Note we are not interested in almost satisfying assignments
E.g., a plan with one ``magic'' step is useless.
Contrast with optimization problems.
Surprise: It often finds global minimum!
I.e., finds satisfying assignments.
form. |
GSAT |
Davis-Putnam |
vars |
m.flips |
retries |
time |
choices |
depth |
time |
50 |
250 |
6 |
0.5 sec |
77 |
11 |
1 sec |
70 |
350 |
11 |
1 sec |
42 |
15 |
15 sec |
100 |
500 |
42 |
6 sec |
20#20 |
19 |
3 min |
120 |
600 |
82 |
14 sec |
21#21 |
22 |
18 min |
140 |
700 |
53 |
14 sec |
22#22 |
27 |
5 hrs |
150 |
1500 |
100 |
45 sec |
-- |
-- |
-- |
200 |
2000 |
248 |
3 min |
-- |
-- |
-- |
300 |
6000 |
232 |
12 min |
-- |
-- |
-- |
500 |
10000 |
996 |
2 hrs |
23#23 |
24#24 |
25#25 yrs |
Search space
Improvements to Basic Local Search
26#26
Simulated Annealing
27#27
Sim. Annealing introduced as analogue to a physical process.
Way to grow crystals.
Kirkpatrick et al. 1982; Metropolis et al. 1953
Physical analogy remains elusive.
Can prove that with exponential schedule will converge to
global optimum.
Difficult to be more precise about convergence rate.
See recent work on rapidly mixing Markov chains.
Key aspect: upwards moves / sideways moves.
Expensive, but if you have time can be best.
(hundreds of papers per year / many applications)
Random Walk
28#28
Mixing Random Walk with Greedy Local Search
29#29
Inside-out: Walksat
30#30
Experimental Results: Hard Random 3CNF
|
GSAT |
Simul. Ann. |
|
basic |
walk |
|
vars |
time |
eff. |
time |
eff. |
time |
eff. |
100 |
.4 |
.12 |
.2 |
1.0 |
.6 |
.88 |
200 |
22 |
.01 |
4 |
.97 |
21 |
.86 |
400 |
122 |
.02 |
7 |
.95 |
75 |
.93 |
600 |
1471 |
.01 |
35 |
1.0 |
427 |
.3 |
800 |
* |
* |
286 |
.95 |
* |
* |
1000 |
* |
* |
1095 |
.85 |
* |
* |
2000 |
* |
* |
3255 |
.95 |
* |
* |
31#31 Time in seconds (SGI Challenge).
31#31 Effectiveness: probability that random initial assignment leads to a solution.
31#31 Complete methods, such as DP, up to 650 variables.
31#31 Mixed Walk (or Walksat) better than
Simul. Ann. better than
Backtracking (Davis-Putnam).
Local Minima
- local minimum (maximum): rate of change is positive (negative) in
all directions
(maze problem --
may have to move away from goal to find the (best) solution)
- plateaus: all of the local steps look the same
True local minima are rare in high dimension space.
Term often relaxed to include plateaus.
Approaches
- Simulated annealing (done)
- Mixed-in random walk (done)
- Random restarts
- Tabu search
- Genetic algorithms / programming
- Random restarts: simply restart at a new random state after
a pre-defined number of local steps.
- Tabu: prevent returning quickly to same state.
Implementation: Keep fixed length queue (``tabu list''): add most
recent step to queue; drop ``oldest'' step. Never make step that's
currently on the tabu list.
32#32
Tabu quite powerful; competitive with simulated annealing and random walk (depends on domain).
Genetic algorithm
Approach mimics evolution.
See Section 20.8 R&N.
Often presented using rich new vocabulary:
fitness function, population, inviduals,
``genes'', crossover, mutations, etc.
Still, can be viewed quite directly in terms of
standard local search.
Note: in some sense, natural evolution performs a local
search to improve species: ``survival of the fittest'',
``local search in the gene pool''
What is the evaluation function?
What are some of the special aspect of the
evolutionary search process?
(Friedberg 1958; Holland 1975; Koza 1992)
31#31 High degree of parallelism
31#31 New individuals (``next state / neighboring states'')
derived from ``parents''
31#31 (Greedy) selection next generation:
Survival of the fittest.
General Idea
Maintain a population of strings (states / individuals /
candidate solutions)
Generate a sequence of generations:
From the current generation, select pairs of strings
(based on fitness) to generate new strings,
using crossover.
Introduce some noise through random mutations.
Average and maximum fitness increases over time.
Graph Coloring
33#33
#1 #2 #3 #4 #5 fitness
1 G B G R B
2 R G G R B
3 R R R G B
4 G G R R B
generation 1
Remarks
In practice, several 100 to 1000's of strings.
What if you have only mutations?
What makes this work for graph coloring?
Could this work for SAT testing (GSAT etc.)?
Remarks
In practice, several 100 to 1000's of strings.
What if you have only mutations?
Parallel noisy local search
What makes this work for graph coloring?
Locality!
Could this work for SAT testing (GSAT etc.)?
Depends on geometry of ``near solutions''
Insert genetic-algorithms.ps slides here:
4, 7, 12, 13, 14, 15, 16, 20, 21
Perspective
Jury still out on Genetic Algorithms in general,
but nature suggests it can be a highly powerful
mechanism for evolving highly complex systems.
Schema theory starts to allow analysis,
but still far from deep understanding
of formal properties.
Local Search -- Summary
Surprisingly efficient search method.
Wide range of applications.
any type of optimization / search task
Formal properties elusive.
Why do so many naturally-occuring problems
have ``near-convex'' search spaces?
Often best method evailable for poorly understood
problems -- How evolution built us 35#35.
Next: About this document ...
Don Patterson
2001-12-14