solving function optimization problems with genetic algorithms september 26, 2001 cho, dong-yeon...

21
Solving Function Solving Function Optimization Problems with Optimization Problems with Genetic Algorithms Genetic Algorithms September 26, 2001 Cho, Dong-Yeon [email protected] 301-419, Tel: 880-1847

Upload: randall-ryan

Post on 06-Jan-2018

216 views

Category:

Documents


2 download

DESCRIPTION

© 2001 SNU CSE Biointelligence Lab 3 Representation – Binary String Code length

TRANSCRIPT

Page 1: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

Solving Function Optimization Solving Function Optimization Problems with Genetic Problems with Genetic AlgorithmsAlgorithms

September 26, 2001

Cho, [email protected]

301-419, Tel: 880-1847

Page 2: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

2

Function Optimization Function Optimization ProblemProblem Example

8.51.41.120.3

)20sin()4sin(5.21),(max

2

1

21121

xx

xyxxxxf

Page 3: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

3

Representation – Binary StringRepresentation – Binary String Code length

331518

15 ,2170002

1700010)1.48.5(10)(

18 ,21510002

15100010))0.3(1.12(10)(

21

2

1

1

1514

44min2

max2

1817

44min1

max1

xx

d

ix

x

x

llll

l

xx

l

xx

i

| 15bit | | 18bit |110111101111100101001100000010101

| 33bit |

Page 4: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

4

Mapping from a binary string to real number

12)(

minmaxmin

ixi l

iixii

xxsubstringdecimalxx

361653.5121.48.5243181.4

687960.212

)0.3(1.1254170.3

152

181

x

x

Binary Number Decimal Numberx1 000001010100101001 5417

x2 101111011111110 24318

Page 5: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

5

Framework of Simple GAFramework of Simple GAGenerate Initial Population

Evaluate Fitness

Select Parents

Generate New Offspring

Termination Condition?Yes

No

Fitness Function

Crossover, Mutation

Best Individual

Page 6: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

6

Initial PopulationInitial Population Initial population is randomly generated.

]010001010110110101010001111010011[]101110100011111101100011111100010[]100011001100100001100010010110101[]101011001110111111000101101000100[]001001011001111011000001111101010[]000111000110101100010000000101111[]001000001011100101101001001101101[]110010100100000001000011110001110[]000001010100110011000000011101011[]110111101111100101001100000010101[

10

9

8

7

6

5

4

3

2

1

vvvvvvvvvv

Page 7: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

7

Fitness EvaluationFitness Evaluation Procedure: Evaluation

Convert the chromosome’s genotype to its phenotype. This means converting binary string into relative real values.

Evaluate the objective function. Convert the value of objective function into fitness.

For the maximization problem, the fitness is simply equal to the value of objective function.

For the minimization problem, the fitness is the reciprocal of the value of objective function.

Page 8: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

8

252480.10)171908.4 ,446273.11()(401669.26)873501.4 ,671267.11()(763190.19)694977.4 ,330256.0()(

958717.17)121702.5 ,342067.9()(900541.11)174346.4 ,788084.11()(686091.15)477282.4 ,301286.2()(

406122.29)109598.4 ,159951.6()(590546.9)661461.4 ,419457.10()(370896.17)170144.4 ,474101.0()(

805119.19)3761653.5 ,687969.2()(

10

9

8

7

6

5

4

3

2

1

fvffvffvffvffvffvffvffvffvffvf

Page 9: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

9

SelectionSelection Fitness proportional (roulette wheel) selection

The roulette wheel can be constructed as follows. Calculate the total fitness for the population.

Calculate selection probability pk for each chromosome vk.

Calculate cumulative probability qk for each chromosome vk.

sizepop

kkvfF

_

1

)(

sizepopkFvfp k

k _,...,2,1 ,)(

sizepopkpqk

jjk _,...,2,1 ,

1

Page 10: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

10

Procedure: Proportional_Selection Generate a random number r from the range [0,1]. If r q1, then select the first chromosome v1; else, sele

ct the kth chromosome vk (2 k pop_size) such that q

k-1 < r qk.pk qk

1 0.111180 0.1111802 0.097515 0.2086953 0.053839 0.2625344 0.165077 0.4276115 0.088057 0.5156686 0.066806 0.5824757 0.100815 0.6832908 0.110945 0.7942349 0.148211 0.94244610 0.057554 1.000000

135372.178)(_

1

sizepop

kkvfF

Page 11: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

11

Tournament Selection Repeat below procedure two times

Randomly draw a tournament of size t from the population with replacement.

Choose fittest program to be parent.

Page 12: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

12

Genetic OperationsGenetic Operations Crossover

One point crossover Crossover rate pc

Procedure: Crossover Select two parents. Generate a random number rc from the range [0,1]. If rc < pc then perform undergo crossover.

Mutation Mutation alters one or more genes with a probability equal

to the mutation rate pm.

Page 13: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

13

]100011001100100001100010010110101[

]001000001011100101101001001101101[

m

f

v

v

]001000001011100001101000010110101[

]100011001100100101100011001101101[

m

f

v

v

]100001001100100101100011001101101[

]100011001100100101100011001101101[

p

p

v

v

Page 14: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

14

Test FunctionsTest Functions Maximization (d=5)

16.016.0,...2 , ;

10)(

111

1

1

51

i

iii

d

ii

xdixyyxy

yf x

Page 15: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

15

Minimization (d=5) Ackley’s function

Rastrigin’s function

Schwefel’s (sine root) function

768.32768.32

20)2cos(1exp51exp20)(

11

2

i

d

ii

d

iiAckley

x

exd

xf x

12.512.5

)2cos(1010)(1

2

i

d

iiiRastrigin

x

xxdf x

0.5000.500

sin9829.418)(1

i

d

iiiSchwefel

x

xxdf x

Page 16: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

16

Experiments Experiments (Minimum (Minimum Requirements)Requirements) At least two test functions

Maximization Problem One of the Minimization Problems

Various experimental setup Termination condition: maximum_generation 2 Selection Method 3 settings 10 runs

Proportional: Crossover and Mutation rate (pc, pm) Tournament: Tournament size (t)

Elitism The best chromosome of the previous population is just copied.

Page 17: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

17

ResultsResults For each test function

Result table for the best solution and your analysis

Present the optimal value and its input for the function. Both genotype and phenotype

Draw a learning curve for the run where the best solution was found.

Proportional TournamentAverage SD

Best Worst Average SD

Best Worst

Setting 1Setting 2Setting 3

Page 18: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

18

Page 19: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

19

ReferencesReferences Source Codes

Simple GA coding GA libraries (C, C++, JAVA, …) MATLAB Tool box

Web sites Books

Genetic Algorithms and Engineering Design, Mitsuo Gen and Runwei Cheng, pp. 1-15, John Wiley & Sons, 1997.

Genetic algorithms in search, optimization, and machine learning, David E. Goldberg, Addison-Wesley, 1989.

Page 20: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

20

Pay Attention!Pay Attention! Due (October 17, 2001): By the end of class Submission

Source code and executable file(s) Proper comments in the source code Via e-mail

Report: Hardcopy!! Running environments Results for many experiments with various parameter settings Analysis and explanation about the results in your own way

Page 21: Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon 301-419, Tel: 880-1847

© 2001 SNU CSE Biointelligence Lab

21

Bonus ProblemsBonus Problems Maximization (d=30)

3-deceptive function

Minimization (d=5) Rosenbrock’s function

048.2048.2

)1()(100)(2

21

221

i

d

iiiiRosenbrock

x

xxxf x

}1,0{

otherwise0.12 if01 if8.00 if9.0

)( ),()(

31323

313233

3/

13132333

i

kkk

kkk

d

iiiideceptive

xxxxu

uuu

xxxfxxxff x