random search - kaistrandom search • the polar opposite to the deterministic, examine- everything,...

28
Random Search Shin Yoo CS454, Autumn 2018, School of Computing, KAIST

Upload: others

Post on 20-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Random SearchShin Yoo

CS454, Autumn 2018, School of Computing, KAIST

Page 2: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Random Search

• The polar opposite to the deterministic, examine-everything, search.

• Within the given budget, repeatedly generate a random solution, compare its fitness to the known best, and keep the best one.

Page 3: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Pros and Cons

• VERY easy to implement, inherently automatable, no bias at all.

• Depending on the problem, it may be extremely effective.

• No guidance at all: depending on the problem, it may take forever to obtain a meaningful solution.

Page 4: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Usage of Random Search

• The lack of any guidance provides two useful scenarios.

• First, random search should always be the default sanity check against your own search methodology: if it does not no better than random search, you are doing something wrong.

Page 5: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Usage of Random Search• Somewhat ironically, random search is effective

when the underlying problem does not give any guidance to begin with. For example:

• “Search for the input to program A that will result in program crash”

• In general, given an arbitrary program, you cannot measure the distance between the current program state and a crash!

Page 6: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Fuzz Testing• Infinite Monkey Theorem: “Thousand monkeys at a

thousand typewriters will eventually type out the entire works of Shakespeare"

• Basic idea: provide a stream of random input to the program, until it crashes (=our Shakespeare).

• Either a stream of really random bits (naive), or

• Well-formed input randomly mutated (more effective)

Page 7: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Local SearchShin Yoo

CS492D, Fall 2015, School of Computing, KAIST

Page 8: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

If your problem forms a fitness landscape, what is

optimisation?

Page 9: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Local Search Loop

• Start with a single, random solution

• Consider the neighbouring solutions

• Move to one of the neighbours if better

• Repeat until no neighbour is better

Page 10: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Local Search

Random start

Page 11: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Hill Climbing Algorithm

• This particular variation is also known as the steepest-ascent hill climbing.

• Why? :)

• What other versions are there?

HillClimbing()(1) climb True(2) s GetRandom()(3) while climb(4) N GetNeighbours(s)(5) climb False(6) foreach n 2 N(7) if Fitness(n) ¿ Fitness(x)(8) climb True(9) s n(10) return s

<latexit sha1_base64="cvkCQWPoq5mfgAtK8Qh0aORGgMA=">AAADo3icdVJdb9MwFHUTPkb46uCRF4umEk9TuwfgCSomjUlI1ZjabVJTVY57k1hznMh2GJWVH8RP4pVfgt2mpV2HpSgn59x7bu71jUvOlO71frc8/8HDR48PngRPnz1/8bJ9+OpSFZWkMKYFL+R1TBRwJmCsmeZwXUogeczhKr45cfrVD5CKFWKkFyVMc5IKljBKtKVmh61fUQwpE4bwtJBMZ3kdRBYLkoM5Y5yfcJbHTKS1scImVJO4DkLqNBxxSDSRsrjFI1lBGEVBqLZZ50cJ5+Yr6Asi5kVuzVyYE24zxsEsneoA43D4v8whsDSLbd+qNmqZbqP3/uCUcAUr0SUnhR0GzUwocMQEHoauxkpiidnYnzItQFljUeNPeJ/+Wa/y7qu47rnRdzoXa8FZgpgH/9D2W4KupLBdBZGlNvNdfzT3Mmt3eke95cH7oN+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wa/y7qu47rnRdzoXa8FZgpgH/9D2W4KupLBdBZGlNvNdfzT3Mmt3eke95cH7oN+ADmrO+az9J5oXtMpBaMqJUpN+r9RTQ6RmlIP1rxSUhN6QFCYWuitXU7PcqRp3LTPHdn72ERov2e0MQ3KlFvbScDcnOlN3NUfep00qnXycGibKSoOgq0JJxbEusFtQPGcSqOYLCwi1nTOKaUYkodqu8W4Vnrqh9O+OYB9cHh/1Lf5+3Bl8acZzgN6gt+gd6qMPaIDO0DkaI+q1vffeZ2/gd/1v/oU/WoV6rSbnNdo5/vQvQVwpnw==</latexit>

Page 12: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Hill Climbing Algorithm

Steepest Ascent First Ascent

HillClimbing()(1) climb True(2) s GetRandom()(3) while climb(4) N GetNeighbours(s)(5) climb False(6) foreach n 2 N(7) if Fitness(n) ¿ Fitness(x)(8) climb True(9) s n(10) return s

<latexit sha1_base64="cvkCQWPoq5mfgAtK8Qh0aORGgMA=">AAADo3icdVJdb9MwFHUTPkb46uCRF4umEk9TuwfgCSomjUlI1ZjabVJTVY57k1hznMh2GJWVH8RP4pVfgt2mpV2HpSgn59x7bu71jUvOlO71frc8/8HDR48PngRPnz1/8bJ9+OpSFZWkMKYFL+R1TBRwJmCsmeZwXUogeczhKr45cfrVD5CKFWKkFyVMc5IKljBKtKVmh61fUQwpE4bwtJBMZ3kdRBYLkoM5Y5yfcJbHTKS1scImVJO4DkLqNBxxSDSRsrjFI1lBGEVBqLZZ50cJ5+Yr6Asi5kVuzVyYE24zxsEsneoA43D4v8whsDSLbd+qNmqZbqP3/uCUcAUr0SUnhR0GzUwocMQEHoauxkpiidnYnzItQFljUeNPeJ/+Wa/y7qu47rnRdzoXa8FZgpgH/9D2W4KupLBdBZGlNvNdfzT3Mmt3eke95cH7oN+ADmrO+az9J5oXtMpBaMqJUpN+r9RTQ6RmlIP1rxSUhN6QFCYWuitXU7PcqRp3LTPHdn72ER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J5oXtMpBaMqJUpN+r9RTQ6RmlIP1rxSUhN6QFCYWuitXU7PcqRp3LTPHdn72ERov2e0MQ3KlFvbScDcnOlN3NUfep00qnXycGibKSoOgq0JJxbEusFtQPGcSqOYLCwi1nTOKaUYkodqu8W4Vnrqh9O+OYB9cHh/1Lf5+3Bl8acZzgN6gt+gd6qMPaIDO0DkaI+q1vffeZ2/gd/1v/oU/WoV6rSbnNdo5/vQvQVwpnw==</latexit>

HillClimbing()(1) climb True(2) s GetRandom()(3) while climb(4) N GetNeighbours(s)(5) climb False(6) foreach n 2 N(7) if Fitness(n) ¿ Fitness(x)(8) climb True(9) s n(10) break(11) return s

<latexit sha1_base64="dtNOwIZ3HqrxX3D3lQFymrNfGWM=">AAADtXicdVJbT9swFHaTXVh2K9vjXiwI0p5Qyws8TWhIrE8VIApITVU5zkli1XEi2xmrrPyy/ZK97pfMbkNpKTtSlM/fdy4+xyeuOFO61/vT8fwXL1+93nkTvH33/sPH7u6nG1XWksKIlryUdzFRwJmAkWaaw10lgRQxh9t4dub0258gFSvFtZ5XMClIJljKKNGWmu52fkcxZEwYwrNSMp0XTRBZLEgBZsA4P+OsiJnIGmOFlasmcROE1Gk44pBqImV5j69lDWEUBaFaZ10+Sjg3P0BfEZGUhU3m3JxwnzMOZpGpCTAOh/+LHALL8tj2rRqjFuHWe+sG54QrWIouOC3tMGhuQoEjJvAwdDWWEkvNKv050wKUTSwa/A1v07+aZdxzFR96bvWNzsWj4JLG9jKzlnFnEEnwiNb/EnQthe0ziCy1mvjDoX2paXe/d9hbGN4G/Rbso9Yupt2/UVLSugChKSdKjfu9Sk8MkZpRDjZ/raAidEYyGFvolkBNzGLLGnxgmQTbidpPaLxg1yMMKZSa22fEBwXRuXqqOfI5bVzr9GRimKhqDYIuC6U1x7rEbmVxwiRQzecWEGo7ZxTTnEhCtV3szSo8c0PpPx3BNrg5OuxbfHm0f/q9Hc8O+oL20FfUR8foFA3QBRoh6u15A+/Su/KP/Ymf+OnS1eu0MZ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g5OuxbfHm0f/q9Hc8O+oL20FfUR8foFA3QBRoh6u15A+/Su/KP/Ymf+OnS1eu0MZ/RhvnlP4DPL2o=</latexit>

Page 13: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Hill Climbing Algorithm

First Ascent

HillClimbing()(1) s GetRandom()(2) while True(3) N GetNeighbours(s)(4) N 0 {n 2 N |Fitness(n) > Fitness(s)}(5) if |N 0| > 0(6) s RandomPick(N 0)(7) else(8) break(9) return s

Random Ascent

HillClimbing()(1) climb True(2) s GetRandom()(3) while climb(4) N GetNeighbours(s)(5) climb False(6) foreach n 2 N(7) if Fitness(n) ¿ Fitness(x)(8) climb True(9) s n(10) break(11) return s

<latexit sha1_base64="dtNOwIZ3HqrxX3D3lQFymrNfGWM=">AAADtXicdVJbT9swFHaTXVh2K9vjXiwI0p5Qyws8TWhIrE8VIApITVU5zkli1XEi2xmrrPyy/ZK97pfMbkNpKTtSlM/fdy4+xyeuOFO61/vT8fwXL1+93nkTvH33/sPH7u6nG1XWksKIlryUdzFRwJmAkWaaw10lgRQxh9t4dub0258gFSvFtZ5XMClIJljKKNGWmu52fkcxZEwYwrNSMp0XTRBZLEgBZsA4P+OsiJnIGmOFlasmcROE1Gk44pBqImV5j69lDWEUBaFaZ10+Sjg3P0BfEZGUhU3m3JxwnzMOZpGpCTAOh/+LHALL8tj2rRqjFuHWe+sG54QrWIouOC3tMGhuQoEjJvAwdDWWEkvNKv050wKUTSwa/A1v07+aZdxzFR96bvWNzsWj4JLG9jKzlnFnEEnwiNb/EnQthe0ziCy1mvjDoX2paXe/d9hbGN4G/Rbso9Yupt2/UVLSugChKSdKjfu9Sk8MkZpRDjZ/raAidEYyGFvolkBNzGLLGnxgmQTbidpPaLxg1yMMKZSa22fEBwXRuXqqOfI5bVzr9GRimKhqDYIuC6U1x7rEbmVxwiRQzecWEGo7ZxTTnEhCtV3szSo8c0PpPx3BNrg5OuxbfHm0f/q9Hc8O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x7rEbmVxwiRQzecWEGo7ZxTTnEhCtV3szSo8c0PpPx3BNrg5OuxbfHm0f/q9Hc8O+oL20FfUR8foFA3QBRoh6u15A+/Su/KP/Ymf+OnS1eu0MZ/RhvnlP4DPL2o=</latexit>

Page 14: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Local Search

Random start

Page 15: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Ascent Strategy• Not possible to know which one is better.

• IF the current solution is near a local optimum, slowing down the ascent may (or may not) be better.

• Regardless of strategy, hill climbing monotonically climbs, until it reaches local/global optimum; it never goes down.

Page 16: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Pros/Cons

• Pros:cheap (fewer fitness evaluations compared to GAs), easy to implement, repeated applications can give insights into the landscape, suitable for solutions that need to be built through small incremental changes

• Cons: more likely to get stuck in local optima, unable to escape local optima

Page 17: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Simulated Annealing• Big question: how do we escape local optima, if we

are one?

• Thought 1: we never know whether we are climbing a local or a global optimum!

• Thought 2: assuming that there are more local than global optima, it makes sense to escape.

• Thought 3: but not always - when we stop, we want to stop near the top of SOME optimum.

Page 18: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Annealing (풀림)

• Keep metal in a very high temperature for a long time, and then slowly cool down: it then becomes more workable.

• At high temperature, atoms are released from internal stress by the energy; during the cool-down, they form new nucleates without any strain, becoming softer.

Page 19: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Simulated Annealing• Introduce “temperature” into local search: start with

a high temperature, and slowly cool down.

• When the temperature is high, the solution (like atom) is unstable and can make random moves (i.e. escapes).

• As the temperature decreases, the energy level gradually gets lower, and escapes become more infrequent.

Page 20: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Simulated AnnealingSimulatedAnnealing()(1) s = s0(2) T T0

(3) for k = 0 to n(4) snew GetRandomNeighbour(s)(5) if P (F(s),F(snew), T ) � random(0, 1) then s

snew(6) T Cool(T )(7) return s

P(F (s),F (snew), T )(1) if F (snew) > F (s) then return 1.0

(2) else return eF (snew)�F (s)

T

Page 21: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Acceptance Probability• Borrowed from metallurgy

• When new solution is better (F(snew) > F(s)), always accept (P > 1)

• When new solution is equally good, accept

• When new solution is worse:

• more likely to accept small downhill movement

• gets smaller as temperature drops

-1.0 -0.5 0.0 0.5 1.0

0.0

1.0

2.0

3.0

P = eF (snew)�F (s)

T

Page 22: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Cooling ScheduleTemperature at time step t as a function of t:

• Linear: T (t) = T0 � ↵t

• Exponential: T (t) = T0↵t(0 < ↵ < 1)

• Logarithmic: T (t) = clog (t+d)

• With large c, this can be very slow cooling • There is an existence proof that says logarithmic will find

the global optimum in infinite time… huh? • It becomes essentially a random search • Theoretically interesting, but practically not so much.

Page 23: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Tabu Search

• Another attempt to escape local optima

• Two exceptions to local search:

• It is possible to accept a worse move

• Remember “visited” solutions and avoid coming back

Page 24: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Tabu SearchTabuSearch()(1) s s0(2) sbest s(3) T [] // tabu list(4) while not stoppingCondition()(5) cbest null(6) foreach c 2 GetNeighbours(s)(7) if (c /2 T ) ^ (F (c) > F (cbest)) then cbest c(8) s cbest(9) if F (cbest) > F (sbest) then sbest cbest(10) append(T , cbest)(11) if |T | > maxTabuSize then removeAt(T , 0)(12) return sBest

Tabu list is a FIFO queue: with the maxTabuSize we can control the memory span of the search.

Page 25: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Random Restart

• Search budget is usually given in limited time (“terminate after 5 minutes”) or in number of fitness evaluation (“terminate after 5000 fitness evaluations”)

• If a local search reaches optima and budget remains? Start again from another random solution and keep the best answer across multiple runs.

Page 26: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Search Radius

• For local search algorithms to be effective: the search space may be large, but the search radius should be reasonably small

• Search radius: the number of moves required to go across the search space

Page 27: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Search Radius: TSP• Travelling Salesman Problem: what is the shortest

path that visits all N cities?

• Search Space: N! (e.g 2,432,902,008,176,640,000 when N = 20)

• Search Radius: at most N(N-1)/2 swaps to change any permutation of cities to any other (e.g. 190 when N=20)

Page 28: Random Search - KAISTRandom Search • The polar opposite to the deterministic, examine- everything, search. • Within the given budget, repeatedly generate a random solution, compare

Summary• Local search: direct use of fitness landscape

concept, with various mechanism to escape local optima.

• Easy to implement, easy to understand what is going on; good for insights into landscape

• Design of search space (especially discrete one) affects the performance of search