GA 내부 들여다 - Seoul National Universitysoar.snu.ac.kr/course/ga/2018/lecture5.pdf · 함 --...

Post on 26-May-2020

6 views 0 download

Transcript of GA 내부 들여다 - Seoul National Universitysoar.snu.ac.kr/course/ga/2018/lecture5.pdf · 함 --...

GA 내부 들여다 보기

chromosome = solution

schema: chromosome에 포함된 패턴

1 0 1 1 0 0 0 1 1 1 0 1 0 1

* * * * 0 0 * 1 1 1 * * * * 길이 n 인 chromosome에는 2n 개의 schema가 있다

* : don’t care symbol defining length = 5 order = 5

0, 1: specific symbols

order: # of specific symbols

기본적인 GA 용어들

Assuming a proportional roulette-wheel selection and single point crossover on a generational GA,

Schema Theorem

𝑚(𝐻, 𝑡 + 1) ≥ 𝑚(𝐻, 𝑡) ∙𝑓(𝐻, 𝑡)

𝑓(𝑡)1 − 𝑃𝑐

𝛿 𝐻

𝑛 − 1− 𝑜 𝐻 𝑃𝑚

where

𝑚(𝐻, 𝑡): # of chromosomes containing schema 𝐻 at generation 𝑡

𝐴(𝑡): the population at a given time step 𝑡

𝑓(𝐻, 𝑡): the average fitness of chromosomes

containing the schema 𝐻 in 𝐴(𝑡)

𝑓(𝑡): the average fitness of chromosomes in 𝐴(𝑡)

𝛿 𝐻 : the defining length of schema 𝐻

𝑜 𝐻 : the order of schema 𝐻

𝑃𝑐: crossover rate

𝑃𝑚: mutation rate 1 −𝛿 𝐻

𝑛−1: survival probability of schema 𝐻

w.r.t. a single-point crossover

* * * * * * * * * * * * * * * * * * * * * * * * * * 1 0 * * * * * 0 0 * * * * *

* * * * * * 1 0 * * * * * * * * * * * * 파손!

* * * * * * * * * * * * * * * * * * * * * * * * * * 1 0 * * * * * 0 0 * * * * *

* * * * * * 1 0 * * * * * 0 0 * * * * * 보존!!

Schema의 파손/보존

품질이 좋은 schema가 확률적으로 잘 살아남으면 좋다

Juxtaposition of small schemata to large ones

Schema 생성

Reminder: Building-Block Hypothesis

• GA seeks near optimal performance through the juxtaposition of short, low-order, high-quality schemata

• GA는 작은 패턴들로부터 시작해서 점점 더 큰 고품질의 패턴을 찾아나가는 거대한 패턴 짜맞추기 게임이다

Reminder: 창발성 (Emergence)

• 하위구조들의 결합으로 상위구조가 이루어짐

• 하위구조에 존재하지 않는 개념이 상위구조에서 발생함 -- 창발!

• 복잡계의 대표적 특성

• GA의 작동 메커니즘 자체가 복잡계다

Schemata and Space

0 0 0

1 0 0

0 1 0

0 0 1

1 0 1

1 1 1

1 1 0

0 1 1

1 1 *

* 1 *

1 * *

1 0 *

schema = hyperplane

3 20 1 684 1 2 2 0 2 4 2 8

3 20 1 684 1 2 2 0 2 4 2 8

3 20 1 684 1 2 2 0 2 4 2 8

스키마 ****1의 대응 공간 스키마 **1*1의 대응 공간

스키마 1****의 대응 공간

𝑓 𝑥 = 𝑥2, 𝑥 ∈ [0,31]

𝑥 ∈ 0,1 5

1-point crossover

𝑃 = 1 −𝛿 𝐻

𝑛−1

Survival Probabilities of Schemata

𝑘-point crossover

Observation

Remind the equivalence relation 𝑅𝑒 . For a

schema 𝐻 to survive all specific symbols have to

belong to the same equivalence class w.r.t. 𝑅𝑒. That is, for any specific symbol pair (𝑥, 𝑦) to be

in 𝑅𝑒, there should be an even # of cut points

between 𝑥 and 𝑦. Given an 𝑚𝑡ℎ-order schema,

index the specific symbols from 0(leftmost) to 𝑚 − 1(rightmost).

***…#**… # ... # …# … … …

𝐿𝑖: the length between 0𝑡ℎ specific symbol and the 𝑖𝑡ℎ specific symbol

𝑃𝑚(𝑘): the probability that (𝑥, 𝑦) ∈ 𝑅𝑒 for all specific-symbol pairs

in the 𝑚𝑡ℎ order schema by a 𝑘-point crossover operator

0𝑡ℎ (𝑖 + 1)𝑡ℎ 𝑖𝑡ℎ

𝐿𝑖

𝐿𝑖+1

***…#**… # ... # …# … # … … # … # … ***

0𝑡ℎ (𝑖 + 1)𝑡ℎ 𝑖𝑡ℎ

𝐿𝑖

𝐿𝑖+1

#**… # ... # …# … # … … # … # … ******… 𝐿𝑖

𝐿𝑖+1

𝐿𝑚

가정

맨끝

(𝑚 − 1)𝑡ℎ

𝑃𝑚 𝑘 = 𝑛𝑘

𝐿𝑚−1

𝐿𝑚

2𝑖 𝐿𝑚−𝐿𝑚−1

𝐿𝑚

𝑘−2𝑖𝑃𝑚−1(2𝑖)

𝑘

2

𝑖=0

This assumes that all cut points are independent (not true).

But it is a reasonable approximation when 𝑘 ≪ 𝑛.

#**… # ... # …# … # … … # … # … ******…

𝐿𝑚−1

𝐿𝑚

맨끝 짝수개

길이 3인 스키마들의 Cut Point 수(𝑘)에 따른 생존 확률

Fact

In odd-point xovers, 𝑃𝑚(𝑘) is approximately antiproportional to the defining length

In even-point xovers, long defining lengths do not affect negatively on 𝑃𝑚(𝑘)

𝒌 = 𝟏

𝒌 = 𝟐

𝒌 = 𝟒

𝒌 = 𝟓

𝒌 = 𝟔

𝒌 = 𝟑

𝑃3(𝑘)

Uniform Xover와의 상대적 비교

Uniform Crossover에서 𝑃0값 변화에 따른 생존 확률 변화

𝒌 = 𝟏

𝒌 = 𝟐

C-Schemata

[Definition]

𝑞𝑡ℎ degree c-schema is defined to be 𝐷0𝐶1𝐷1 ∙∙∙ 𝐶𝑞𝐷𝑞

where 𝐶𝑖 ∈ 0,1+, 𝑖 = 1,2, … , 𝑞

𝐷𝑖 ∈ ∗+, 𝑖 = 1,2, … , 𝑞 − 1 and 𝐷0𝐷𝑞 ∈ ∗

* Any schema of order 𝑟 can be represented by a c-schema of degree 𝑞 s.t. 𝑞 ≤ 𝑟.

𝐷0 𝐶1 𝐷1 𝐶2 𝐷2 𝐶3 𝐷3𝐶4 𝐷4

*… …*#*… …*###*... …*####**#*… …*

𝑃𝑘 𝐷0𝐶1𝐷1…𝐶𝑞𝐷𝑞 : probability that c-schema 𝐷0𝐶1𝐷1…𝐶𝑞𝐷𝑞 is not disrupted

by a 𝑘-point crossover

𝑃𝑘 𝐷0𝐶1𝐷1…𝐶𝑞𝐷𝑞 =

𝐷1 +12𝑖1

|𝐷2|+12𝑖2…|𝐷𝑞−1|+1

2𝑖𝑞−1

|𝐷0𝐷𝑞|

𝑘−2(𝑖1+⋯+𝑖𝑞−1)

𝑛−1𝑘

𝑖1+⋯+𝑖𝑘−1≤𝑘2

← a schema of order 𝑟

← corresponding c-schema

of degree 4

Fact

∙ With the same order, low-degree c-schemata tend to have high survival probabilities.

∙ In even-point overs, c-schemata with high variances of 𝐷1 , 𝐷2 , … , 𝐷𝑞−1 , 𝐷0𝐷𝑞

tend to have high survival probabilities.

𝑃𝑘 𝐷0𝐶1𝐷1…𝐶𝑞𝐷𝑞 =

𝐷1 +12𝑖1

|𝐷2|+12𝑖2…|𝐷𝑞−1|+1

2𝑖𝑞−1

|𝐷0𝐷𝑞|

𝑘−2(𝑖1+⋯+𝑖𝑞−1)

𝑛−1𝑘

𝑖1+⋯+𝑖𝑘−1≤𝑘2

Note! There is no 𝐶𝑖 here!

Don’t-care symbol cluster가 확률을 결정한다.

H1: ***#***#***#***#***#***#***#***#***

H2: ***###*#*******************#*###***

∙ 1-point crossover

∙ 2-point crossover

survival prob. of 𝐻1 = survival prob. of 𝐻2

survival prob. of 𝐻1 = 19/187

survival prob. of 𝐻2 = 69/187

∙ Difference between 𝐻1 and 𝐻2

- specific-symbol clustering ~ don’t-care symbol clustering

- degree of corresponding c-schemata

High survival probability is not a necessary or sufficient condition for high-

performance GAs. The important thing is protecting high-quality schemata.

Survival Probabilities of c-schemata w/ the Same Order

* Length = 50. Order = 20.

(a) Odd cut points (b) even cut points

Survival Probabilities of c-schemata w.r.t. the Variances of |𝐷𝑖|𝑠

(a) |D0Dq|가 모든 |Di|들보다 큰 경우 (b) 그렇지 않은 경우

앞 페이지 첫 그림을 두 경우로 나누어 본 것

*********************************** *********************************** ********#*#************************ ****************#****************** **********#***************#******** ***************##****************** *********************************** *********#***************#********* *********#************************* *********************************** *********************************** ***************#******************* *********************************** *********************************** *********************************** *********************************** ***********************************

이차원 schema의 예

𝛿𝑥(𝐻)

𝛿𝑦(𝐻) 단 하나의 cut line을 쓸 경우의

생존 확률 = 1 −𝛿𝑥 𝐻 +𝛿𝑦(𝐻)

2(𝑙−1)

▪ Multi-line xover에서는

Pr(∀specific symbol pair 𝑥, 𝑦 , (𝑥, 𝑦) ∈ 𝑅𝑒) = Pr(∀ #𝑖 , #𝑖+1 , #𝑖 , #𝑖+1 ∈ 𝑅𝑒)

s1

s2

o f fs p r in g

이차원 교차의 한 예

Gene Reordering의 효과

유전자 재배치를 전후한 스키마의 길이 변동

Epistasis

In biology – phenomenon that a gene’s presence suppresses the effect of a

gene at another locus (masking or switching effect)

In GA – interaction among genes

𝑵𝑲-Landscape

Suggested by Start Kaufmann

N: chromosome length

K: Epistatic strength

A method to generate NK-landscape

Chromosome 𝑏 = 𝑏1𝑏2…𝑏𝑁, 𝑏𝑖 ∈ {0,1}

1. For each bit 𝑖 1 ≤ 𝑖 ≤ 𝑁 , pick 𝐾 other bits which affect the bit’s

fitness contribution (any selection of 𝐾 bits is fine.

E.g. random, 𝐾 closest bits, …)

2. Create a vector 𝑤𝑖 for each bit 𝑖 1 ≤ 𝑖 ≤ 𝑁 . The fitness contribution of bit 𝑖 depends on its own value and the combination of the values of the 𝐾

interacting bits. 𝑤𝑖 has 2𝑘+1 entries. Each entry is assigned a uniformly

distributed random number in [0,1].

3. The fitness of 𝑏

𝑓 𝑏 =1

𝑁 𝑓𝑖𝑁𝑖=1 where 𝑓𝑖 is the fitness contribution of bit 𝑖 (given by 𝑤𝑖)

1 0 0

e.g. 𝐾 = 2

0.35 0.89 0.51 0.02 0.94 0.55 0.71 0.35

000 001 010 011 110 111 101 100

K 0 1 2 4 8 16 32 48 95

#Imp 19.80 16.00 15.20 11.60 8.60 6.20 3.80 5.4 5.2

If 𝐾 = 0, 𝑓𝑖 is dependent only on 𝑏𝑖.

If 𝐾 = 𝑁 − 1, 𝑓𝑖 is dependent on all the bits.

Genitor GA로 2048 세대 동안 개선이 일어난 횟수

𝑁 = 96

Changing 𝐾 from 0 to 𝑁 − 1

- Interaction among genes increases

- # of local optima increases (highly probably)

- Harder to find global optima

단순한 결과는 단순한 구성 요소들로부터 나오고,

복잡한 결과는 복잡한 것들로부터 나온다.

But, …

Complex systems are often the result of interacting simple local systems.

관행적 믿음

Stephen Wolfram is planning a universal programming language based on cellular automata.

Conjecture (Kaufmann)

생명체의 DNA의 발현은 𝐾 = 2 정도의 𝑁𝐾-Landscape이다.

생명체에서 상이한 조직(?)의 종류는 대략 𝑁에 비례한다.

Cellular automata is a special example of

𝑁𝐾-landscape with low 𝐾.

∙ ∙

∙ ∙ ∙

∙ ∙ ∙ ∙

(𝑖, 𝑗)

𝑥𝑖,𝑗(𝑡 + 1) = 𝑓(𝑥𝑖−1,𝑗−1(𝑡), …, 𝑥𝑖+1,𝑗+1(𝑡)) Game of life

Theorem (Weinberger)

𝑁𝐾 optimization problem with adjacent neighborhoods is solvable

in 𝑂(2𝐾𝑁) steps. Thus in P.

𝑁𝐾 optimization problem with random neighborhoods is NP-Complete

for 𝐾 ≥ 2.

Theorem (Thomson & Wright)

Four Classes of Systems

• Class I: Converges to a single state

• Class II: Periodic

• Class III: Chaotic

• Class IV: Non-periodic, complex local patterns

Complex systems (복잡계)

Life at the edge of chaos – Chris Langton

역동적 균형

문제공간의 모양

𝑆 = 𝑠1, 𝑠2, … , 𝑠𝑛 : 임의의 해집합

𝐹 = 𝑓1, 𝑓2, … , 𝑓𝑛 : 이 해들의 품질

𝐷 = {𝑑1, 𝑑2, … , 𝑑𝑛} : 가장 가까운 최적해까지의 거리

Fitness-Distance Correlation

𝛾 =cov(𝐹, 𝐷)

𝜎𝐹𝜎𝐷

Where cov 𝐹, 𝐷 =1

𝑛 (𝑓𝑖 − 𝑓 𝑛𝑖=1 )(𝑑𝑖 − 𝑑 )

𝜎𝐹 , 𝜎𝐷: 표준편차

𝑓 : 집합 𝐹의 해들의 적합도 평균

𝑑 : 집합 𝐷의 거리들 평균 ▪ Jones & Forrest claimed 𝛾 < −0.15 : straightforward

−0.15 ≤ 𝛾 < 0.15 : hard

0.15 ≤ 𝛾 : misleading

𝑁𝐾(12,11)

𝑁𝐾(12,3)

𝑁𝐾(12,2)

𝑁𝐾(12,1)

𝑁𝐾(12,0)

𝐹2(12)

𝐺𝐹2(12)

𝐺𝐹2(8)

𝐹2(8)

𝐺𝐹3(12)

𝐹3(12)

0

−0.1

−0.5

−0.82

𝛾

𝑥: a genetic algorithm

𝐹𝑝, 𝐹𝑐: fitnesses of parent(s) and child

Correlation Coefficient of a Genetic Algorithm

𝜌𝑥 𝐹𝑝, 𝐹𝑐 =𝐶𝑜𝑣(𝐹𝑝, 𝐹𝑐)

𝜎(𝐹𝑝)𝜎(𝐹𝑐)

An experimental result by Manderick et al. for 30-city TSP.

A good measure of genetic operators’ perturbation

Xover 𝝆 value

𝜌𝑂𝑋 0.72

𝜌𝑃𝑀𝑋 0.61

𝜌𝑐𝑥 0.57

𝜌𝐸𝑋 0.90

Suggested by Manderick et al.

Correlation Length

A stochastic process 𝑥𝑡 𝑡≥0 is said to be stationary if for all 𝑛, 𝑠, 𝑡, the random vectors 𝑥𝑡1 , … , 𝑥𝑡𝑛 and 𝑥𝑡1+𝑠, … , 𝑥𝑡𝑛+𝑠 have the same

joint distribution.

For two random variables 𝑋 and 𝑌, i) the joint cumulative probability distribution ft. of 𝑋 & 𝑌 𝐹 𝑎, 𝑏 = 𝑃 𝑋 ≤ 𝑎, 𝑌 ≤ 𝑏 ,−∞ < 𝑎, 𝑏 < ∞. ii) the point probability mass ft.

𝑃 𝑥, 𝑦 = 𝑃(𝑋 = 𝑥, 𝑌 = 𝑦)

𝜌 ℎ =𝑅(ℎ)

𝜎2= 𝑅(ℎ)

𝑅(0)

Where

𝑅 ℎ = 𝐸[ 𝐹ℎ − 𝜇𝐹 𝐹0 − 𝜇𝐹 ]

𝑋𝑡 𝑡≥0 : a random process

𝐹𝑡 𝑡≥0 : corresponding fitness values

autocorrelation

Autocovariance

limℎ→∞𝑅 ℎ = 0

ℎ : distance, steps

Correlation length 𝜏

- The distance ℎ where the autocorrelation ft. 𝜌 ℎ =1

2.

K 0 1 2 4 8 16 32 48 95

τ 29.7 24.4 19.5 14.2 7.1 3.9 1.7 1.0 0.5

#Imp 19.8 16.0 15.2 11.6 8.6 6.2 3.8 5.4 5.2

𝑁 = 96

Easy Hard

The relationship bet’n 𝜏 of an 𝑁𝐾-landscape and the # of improvements

during 2048 generations of a steady-state GA. Average over 5 runs.

Not a magic number

𝜏 and 𝜌𝑜𝑝 may be used to control the strength of exploration.

Too strong an exploration makes a GA similar to a random walk.

(when 𝜌𝑜𝑝 is smaller than necessary w.r.t. 𝜏)

A large class of problems are believed to have a “big valley” of local

optima with global optima around their geographic center.

Big Valley

- For each local optimum, compute the relationship bet’n its quality

and the distance to the best global optimum

Get a large number(e.g., 2,500) of local optima of a problem.

- For each local optimum, compute the average distance to other local

optima and examine the relation to the quality.

실험적 접근 (코끼리 다리 만지기)

532-City TSP의 2,500 개 지역 최적해들을 사용한 측정 결과

100-Node Graph Bisection 문제의 2,500 개 지역 최적해들을 사용한 측정 결과

Adaptive Multi-Start Algorithm, Boese et al.

• Keep multiple solutions.

• Extract the common part of multiple solutions and tries to generate

solutions with the remaining part.

The attractiveness of the center area of problem space

Local Optimum들의 군집성

최상해로부터의 거리와 다른 지역최적해들로부터의 평균거리

중심점으로부터의 거리와 지역최적해들의 군집성

G500.005 U150.05 G250.04 U1000.10 U500.10 U500.05

지역최적해 총수

7,000 2,221 9,882 5,000 9,368 7,000

최상해 52 2 351 41 24 6

평균지역 최적해

64.5 10.04 366.9 145.1 83.8 35.9

상관계수 0.79 0.87 0.76 0.90 0.91 0.90

중점해 59 7 379 42 24 5

중점해+FM 53 2 356 41 24 5

지역 최적해들에 대한 조사 결과

문제공간 중앙 부근의 매력

The Number, Distribution, and Density of Attractors

0

10

20

30

40

50

60

70

1 3 5 7 9 11 13 15 17 19 21 23 25

끌개

의개

끌개의 크기(단위 2만)

끌개의 크기 1,019

1,177

2,633

13,238

42,571

53,156

137,381

138,382

148,167

276,739

283,702

517,350

528,564

530,884

631,121

952,746

1,377,788

1,894,901

5,650,952

6,775,929

20개의 끌개를 갖는 12-City TSP에서

각 끌개의 크기

▪해의 총 수 ~ 20M

▪가장 큰 2개의 끌개가 거의 60% 차지

0

50

100

150

200

250

300

350

400

450

500

0 5 10 15 20 25 30

도 시 수

끌개

의 총

0

50

100

150

200

250

300

350

400

0 10 20 30 40 50 60 70 80 90 100

밀도

경로

의 길

끌개의 밀도와 해의 품질과의 관계

2900

3100

3300

3500

3700

3900

4100

0 50000 100000 150000

품질

( 경

로길

이)

끌개의 크기

끌개의 크기와 품질간의 관계

연산자와 문제공간

연산자가 문제공간에 미치는 영향 (TSP의 예)

2 - c h a n g e

다양한 연산자

O r-c h a n g e

3 6 9 4 1 5 8 7 2 0

3 6 5 4 1 9 8 7 2 0

S w a p - c h a n g e

3개의 연산자가 만드는 끌개의 수

2-change Or-change Swap-change

5 1.1 1.0 1.1

7 1.3 1.1 1.3

10 2.3 2.0 5.2

12 3.9 4.1 26.4

13 5.2 5.9 63

14 7.7 9.4 146

15 10.6 14.4 352

16 16.8 21.9 880

17 25 35 2,198

18 34 52 5,917

19 55 83 15,932

20 86 132 45,815

21 121 N/A N/A

22 185 N/A N/A

23 292 N/A N/A

24 439 N/A N/A

최소 거리 최대 거리 평균 거리

2-change 87 112 98.65

Or-change 107 166 136.97

Swap-change 94 153 116.27

100-City TSP의 임의의 해에서 끌개에 도달하는 데 필요한 거리(연산 횟수)

최소 경로 길이 최대 경로 길이 평균

경로 길이(품질)

2-change 8,051 9,237 8,559

Or-change 8,378 12,066 10,103

Swap-change 10,990 18,171 14,168

100-City TSP에서 연산자와 끌개의 품질

끌개의 수 추정하기

회귀함수에 의한 추정 적분에 의한 추정

문제의 크기

끌개수 시도한 초기해 수

끌개수

1 2 3 4 5 평균

회귀곡선법 19104 3245 3344 3770 6884 7,269

적분법 18856 3708 3898 4250 7369 7,616

1 2 3 4 5 평균

회귀곡선 24863 153585 157476 38275 301774 135,194

적분 19311 162775 240536 36527 423827 176,595

25-City TSP에서 Or-change가 만드는 공간의 끌개수 추정치

30-City TSP에서 Or-change가 만드는 공간의 끌개수 추정치

Sammon Mapping of Local Optima

cf. SOM, …

Traditional Plotting

With Graph U500.10

Sammon Mapping of Population

𝑑𝑝: phenotype distance, 𝑑𝑔: genotype distance

~4 clusters

~2 clusters

Sammon Mapping over Generations of a Steady-State GA

Royal Road Function

11111111********************************************************

********11111111************************************************

****************11111111****************************************

************************11111111********************************

********************************11111111************************

****************************************11111111****************

************************************************11111111********

********************************************************11111111

𝑠1: 𝑐1 = 8 𝑠2: 𝑐2 = 8

𝑠3: 𝑐3 = 8

𝑠4: 𝑐4 = 8

𝑠5: 𝑐5 = 8

𝑠6: 𝑐6 = 8

𝑠7: 𝑐7 = 8 𝑠8: 𝑐8 = 8

An example

Royal-Road Function with 8 Schemata

Sammon mapping of chromosomes containing schemata 2 and 3