Local Search: walksat, ant colonies, and genetic algorithms.
-
Upload
janis-carr -
Category
Documents
-
view
213 -
download
0
Transcript of Local Search: walksat, ant colonies, and genetic algorithms.
![Page 1: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/1.jpg)
Local Search:walksat, ant colonies, and genetic algorithms
![Page 2: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/2.jpg)
Tonight
Course evaluations Local search Final exam
![Page 3: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/3.jpg)
Issue
How to search really large spaces 10^30,000 + states systematic search hopeless!
Local search iterative repair, hill climbing, gradient
descent, … guess a start state repeat until satisfied: make small
change move to a local neighbor
![Page 4: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/4.jpg)
Examples Learning weights in a neural network
Space: set of weights Neighborhood: small delta
Learning CPT’s in a Bayesian network EM algorithm
These are optimization problems… what about local search for decision problems?
![Page 5: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/5.jpg)
N-Queens
N-Queens Demo
![Page 6: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/6.jpg)
GSAT
Guess a random truth assignment
while (#unsat clauses > 0){flip a variable that minimizes number of unsatisfied clauses
}
![Page 7: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/7.jpg)
![Page 8: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/8.jpg)
Room for improvement Less dramatic performance on
structured problems (e.g. planning) Too greedy – can become stuck in local
minima Solution: allow some “uphill” moves –
many different strategies possible… Simulated annealing Tabu lists Alternate GSAT + random flips
![Page 9: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/9.jpg)
Random Walk
Guess a random truth assignment
while (#unsat clauses > 0){pick an unsat clause
flip any variable in the clause
} Suppose clauses are of length 2;
what is probably a flip is “correct”? Solves 2-SAT in O(n^2) time!
![Page 10: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/10.jpg)
Greediness + Randomness
If clause length > 2, then pure random walk is very unlikely to converge
Suppose we random walk greedily?
![Page 11: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/11.jpg)
Walksat
Guess a random truth assignment
while (#unsat clauses > 0){pick an unsat clause
with probability p {
flip a variable that minimizes number of newly-unsatisfied clauses }
otherwise {
flip any variable in clause }
![Page 12: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/12.jpg)
![Page 13: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/13.jpg)
Walksat results Best known method for many problems
graph coloring (certain) planning problems hard random problems
For many (all?) other domains, can mix random walk & backtrack search run backtrack DPLL until time out restart with new random seed for choosing
branching variables
![Page 14: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/14.jpg)
Stochastic Backtrack Search
Quasigroup Completion Demo
![Page 15: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/15.jpg)
Parallel local search
Techniques considered so far only look at one point on the search space at a time…
Easy to run many copies in parallel with different random seeds Called portfolio approach Often gives super-linear speedup!
![Page 16: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/16.jpg)
Run time distributions
Often there is a great variability in run time depending on random seeds…
As parallel processes are added, probability of getting a “lucky” short run can increase quickly!
![Page 17: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/17.jpg)
Informed parallel search
Can we further improve performance by exchanging information between the parallel processes? Genetic algorithms Ant colony algorithms
![Page 18: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/18.jpg)
Genetic algorithms Idea: the genetic code of an individual
is a point in the search space a gene = a dimension in the search space
Reproduction = local moves Asexual reproduction (mutation) = create a
child by a small change in the parent Sexual reproduction = create a child by
mixing genes of two parents
![Page 19: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/19.jpg)
19
The GA Cycle of Reproduction
reproduction
population evaluation
modification
discard
deleted members
parents
children
modifiedchildren
evaluated children
![Page 20: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/20.jpg)
20
A Simple Example
The Traveling Salesman Problem:
Find a tour of a given set of cities so that each city is visited only once the total distance traveled is minimized
![Page 21: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/21.jpg)
21
Representation
Representation is an ordered list of city
numbers known as an order-based GA.
1) London 3) Dunedin 5) Beijing 7) Tokyo
2) Venice 4) Singapore 6) Phoenix 8) Victoria
CityList1 (3 5 7 2 1 6 4 8)
CityList2 (2 5 7 6 8 1 3 4)
![Page 22: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/22.jpg)
22
Crossover
Crossover combines inversion and
recombination:
* *
Parent1 (3 5 7 2 1 6 4 8)
Parent2 (2 5 7 6 8 1 3 4)
Child (5 8 7 2 1 6 3 4)
This operator is called the Order1 crossover.
![Page 23: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/23.jpg)
23
Mutation involves reordering of the list:
* *
Before: (5 8 7 2 1 6 3 4)
After: (5 8 6 2 1 7 3 4)
Mutation
![Page 24: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/24.jpg)
24
TSP GA Demo http://cs.felk.cvut.cz/~xobitko/ga/tspexa
mple.html
![Page 25: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/25.jpg)
25
TSP Example: 30 Cities
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
![Page 26: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/26.jpg)
26
Solution i (Distance = 941)
TSP30 (Performance = 941)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
![Page 27: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/27.jpg)
27
Solution j(Distance = 800)
44626967786462544250404038213567606040425099
TSP30 (Performance = 800)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
![Page 28: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/28.jpg)
28
Solution k(Distance = 652)
TSP30 (Performance = 652)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
![Page 29: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/29.jpg)
29
Best Solution (Distance = 420)
423835262135327
3846445860697678716967628494
TSP30 Solution (Performance = 420)
0
20
40
60
80
100
120
0 10 20 30 40 50 60 70 80 90 100
x
y
![Page 30: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/30.jpg)
30
Overview of Performance
TSP30 - Overview of Performance
0
200
400
600
800
1000
1200
1400
1600
1800
1 3 5 7 9 11
13
15
17
19
21
23
25
27
29
31
Generations (1000)
Dis
tan
ce
Best
Worst
Average
![Page 31: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/31.jpg)
Practical Applications Design of small sorting circuits Optimization of code fragments
Used in Windows kernel??? Training neural networks
Can outperform backprop Airport scheduling (Generally) unanswered questions:
Would other local search techniques work just as well?
Is crossover really key?
![Page 32: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/32.jpg)
Ant colony optimization Idea:
Each ant in a colony is local search process
Ants (processes) communicate by laying down phenoromes at visited states (“this place looked good to me”)
When deciding where to move, ants prefer (with some probability) to follow trail left by other ants
Phenorome eventually “evaporates”
![Page 33: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/33.jpg)
Real ants
![Page 34: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/34.jpg)
Why might it work?
More “intelligent” noise
Ant B @ t10
Ant A @ t3
gradient
gradient
not gradient, but a good alternative
![Page 35: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/35.jpg)
Beyond phenomerones Combine local gradients to get more global
view
Ant B @ t10
Ant A @ t10
gradient
gradient
move by weighted sum of B’s own gradient and A’s gradient
![Page 36: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/36.jpg)
Does it work?
Many successful applications in engineering & science
Appears to outperform single-thread local search procedures for quadratic programming
More work needed to determine exactly why metaphor works when it does!
![Page 37: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/37.jpg)
Summary Local search is an important tool for
large, complex optimization and decision problems Ideas: Iterative repair Noise to escape local optima
Much work on parallel local search Portfolios Genetic algorithms Ant colony optimization
![Page 38: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/38.jpg)
So….
End of the course. Is that all there is??? Where was the artificial
intelligence??!!
![Page 39: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/39.jpg)
In my view… AI is the study of general problem-
solving strategies “Meta” algorithms 101 Life: one damned problem after
another Strategies evolve at many levels
Genetic – “real” evolution Individual human – logical thinking Society – spread of innovation
![Page 40: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/40.jpg)
Unity
A relatively small number of concepts various state-space search strategies syntactic structure (both formal logic &
natural language) learning strategies – minimizing entropy,
error, complexity
arise over and over again in biological and artificial systems
![Page 41: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/41.jpg)
Why? This unity of
thought biology computationis a cause for wonder …
Work in AI is one way of working on the ultimate questions Why? Why here? Why now? Why us?
![Page 42: Local Search: walksat, ant colonies, and genetic algorithms.](https://reader030.fdocuments.in/reader030/viewer/2022013101/56649ef65503460f94c099d6/html5/thumbnails/42.jpg)
As the Dali Lama once said…
“But if anything I have said is not helpful to you…
… then just forget about it!”