22
GENETIC ALGORITHM Population parameters Diversity parameters Population size 30 Number of bits per parameter 30 Maximum number of generations 50 Mutation probability 0.1 Number of parameters 2 Cross over probability 0.3 Possibilities per parameter 32768 Creep mutation probability 0.04 Maximum parameter value 1 Minimum parameter value 0 Selection Parameters Random number generator seed 30 Number of children 2 Stopping criterion Minimum fitness improvement M 0.0500% Number of repetitions 50 Modified GA EXPERIMENTATION Minimum fitness improvement M 3.000% Parameter to explore Seed Number of Generations control 2 Increment 100 population increase control ( 2 Experiments 3 Population injections 10 Ploting options seed Objective Function Evaluations ations Uniform crossover Elitism Creep mutation micro-GA Use niching Plot the best from each generatio Parameters Required in Injection Option Parameters Required in Experimentation Option

GA Example

Embed Size (px)

DESCRIPTION

Genetic algorithms example

Citation preview

Page 1: GA Example

GENETIC ALGORITHM Population parameters Diversity parameters Population size 30 Number of bits per parameter 30 Maximum number of generations 50 Mutation probability 0.1 Number of parameters 2 Cross over probability 0.3 Possibilities per parameter 32768 Creep mutation probability 0.04 Maximum parameter value 1 Minimum parameter value 0

Selection Parameters Random number generator seed 30 Number of children 2

Stopping criterionMinimum fitness improvement MFI 0.0500%Number of repetitions 50

Modified GA EXPERIMENTATION Minimum fitness improvement MFI 3.000% Parameter to explore Seed Number of Generations control (t) 2 Increment 100 population increase control (times) 2 Experiments 3 Population injections 10

Ploting options

seed ObjectiveFunction

Evaluations

0 50 100 150 200 2500

200

400

600

800

1000

1200

1400

1600

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Uniform crossover

Elitism

Creep mutation

micro-GA

Use niching

Plot the best from each generation

Parameters Required in Injection Option

Parameters Required in Experimentation Option

D5
Maximum # of individuals, i.e. max population size
J5
Number of bits used to represent each parameter or variable.
D6
Maximum number of generations to be executed before the program stops. G > N*l Where: G: # of generations N: number of individuals l: string length
J6
Pm ~ 1/N N: population size Pm: probability of mutation
D7
Number of parameters or variables to be optimized
J7
Pc <=(s-1)/s s: number of individuals competing in tournament selection.
D8
array of integer number of possibilities per parameter. For optimal code efficiency set nposibl=2**n, i.e. 2, 4, 8, 16, 32, 64, etc.
J8
pcreep The creep mutation probability. Typically set this = (nchrome/nparam)/npopsiz.
D9
Is used to set the search domain or interval. This is the maximum value that each variable can take
D10
Is used to set the search domain or interval. This is the minimum value that each variable can take
F10
Activate the option of using uniform crossover. Otherwise one point crossover is used
H10
Must be checked in order to use creep mutation
J10
Must be checked in order to use niching
J12
Introduce the initial seed to used in solving the problem.
D13
1 for one child per pair of parents 2 for two children per pair of parents
A15
Flag to allow the use of elitism.
C15
When this Flag is activated the micro-GA is used. If using the microga option, the following input variables are reseted pmutate = 0# pcreep = 0# itourny = 1 ielite = 1 iniche = 0 nchild = 1 If (iunifrm = 0) Then pcross = 1# Else pcross = 0.5 End If
J15
Indicates the minimum expected improvement in fitness value at each generation.
J16
Maximum allow number of generations with a fitness increase less than MFI.
H18
This option implements the concepts of population injection
B19
This section allows the user to experiment, for each problem, with population sizes, random seed, problem dimension, crossover and mutation operators and/or probabilities.
J19
Indicates the minimum expected improvement in fitness value at each population size.
D20
The parameter to experiment with must be selected from the supplied list.
J20
The number of generations for a particular population size is calculated as t*l l: string length
D21
Indicate the increase to be applied to the parameter being investigated
J21
The new population is calculated as follows: NewPop=times*OldPop
D22
Number of trials to be run in order to explore the GA behavior when the GA parameter being explored is changed.
J22
Maximum number of population injections
Page 2: GA Example

30 1500 0.9974856130 1500 0.9982135230 1500 0.999074

0 50 100 150 200 2500

200

400

600

800

1000

1200

1400

1600

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Page 3: GA Example
Page 4: GA Example

SIMPLE GENETIC ALGORITHM Population parameters Population size 40 Parameters controlling diversity Maximum number of generations 800 Mutation probability 0.07 Number of variables 2 Cross over probability 0.5 Number of binary digits 10 Minimum parameter value 4 Maximum parameter value 6 Initial seed 3000

Stoping criterion EXPERIMENTATION Minimum fitness improvement MF 0.0500% Parameter to explore Seed Number of repetitions 50 Increment 100 Experiments 2

Ploting options

Function evaluations 2400 Maximum 1

seed objective

3000 2760 0.5053483100 2400 1

function evaluations

2980 3000 3020 3040 3060 3080 3100 31202200

2300

2400

2500

2600

2700

2800

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Plot the best from each generation

Parameters Required in Experimentation Option

D5
Maximum # of individuals, i.e. max population size
D6
Maximum number of generations to be executed before the program stops. G > N*l Where: G: # of generations N: number of individuals l: string length
J6
Pm ~ 1/N N: population size Pm: probability of mutation
D7
Number of parameters or variables to be optimized
J7
Pc <=(s-1)/s s: number of individuals competing in tournament selection.
D8
Number of bits used to represent each parameter or variable.
D9
Is used to set the search domain or interval. This is the maximum value that each variable can take
D10
Is used to set the search domain or interval. This is the minimum value that each variable can take
J10
Introduce the initial seed to used in solving the problem.
J13
Indicates the minimum expected improvement in fitness value at each generation.
D14
The parameter to experiment with must be selected from the supplied list.
J14
Maximum allow number of generations with a fitness increase less than MFI.
D15
Indicate the increase to be applied to the parameter being investigated
D16
Number of trials to be run in order to explore the GA behavior when the GA parameter being explored is changed.
Page 5: GA Example

2980 3000 3020 3040 3060 3080 3100 31202200

2300

2400

2500

2600

2700

2800

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Page 6: GA Example

DIFFERENTIAL EVOLUTION ALGORITHM Population characteristics Population size 50 Parameters controlling diversity Maximum number of generations 1000 Stepsize F from interval [0, 2] 0.8 Number of variables 2 crossover probability 0.5 Xvmin -2 Strategy 2 Xvmax 2 Convergence criteria 1.00E-08 Initial seed 30

Ploting options

Modified DEMinimum fitness improvement MFI 0.080%

EXPERIMENTATION Number of Generations control (N) 20 Parameter to explore Seed population increase control (times) 2 Increment 1 Population injections 4 Experiments 2

Function evaluations 2700 Maximum 7.390926E-09

seed Objective

30 3400 4.836841E-0931 2700 7.390926E-09

function evaluations

29.8 30 30.2 30.4 30.6 30.8 31 31.20

500

1000

1500

2000

2500

3000

3500

4000

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Plot the best from each generation

Parameters Required in Experimentation Option

Parameters Required in Injection Option

D5
number of population members
D6
maximum number of iterations (generations)
J6
DE-stepsize F from interval [0, 2]
D7
Number of parameters of the objective function Problem dimension (D)
J7
crossover probability constant from interval [0, 1]
D8
XVmin vector of lower bounds XVmin(1) ... XVmin(D) of initial population *** note: these are not bound constraints!! ***
J8
Strategy 1 --> DE/best/1/bin 2 --> DE/rand/1/bin 3 --> DE/rand-to-best/1/bin 4 --> DE/best/2/bin 5 --> DE/rand/2/bin
D9
XVmax vector of upper bounds XVmax(1) ... XVmax(D) of initial population *** note: these are not bound constraints!! ***
D10
"Value To Reach" the algorithm will stop its minimization if either the maximum number of iterations "itermax" is reached or the best parameter vector "bestmem" has found a value f(bestmem,y) <= VTR.
J10
Introduce the initial seed to used in solving the problem.
H12
This option implements the concepts of population injection
J13
Indicates the minimum expected improvement in fitness value at each population size.
J14
The number of generations for a particular population size is calculated as N*D D: string length
D15
The parameter to experiment with must be selected from the supplied list.
J15
The new population is calculated as follows: NewPop=times*OldPop
D16
Indicate the increase to be applied to the parameter being investigated
J16
Maximum number of population injections
D17
Number of trials to be run in order to explore the GA behavior when the GA parameter being explored is changed.
Page 7: GA Example

29.8 30 30.2 30.4 30.6 30.8 31 31.20

500

1000

1500

2000

2500

3000

3500

4000

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Page 8: GA Example

SIMULATED ANNEALING ALGORITHM General Information Number of parameters 2 Cooling schedule Step size 1 Initial temperature 50 Iterations at each temperature 5 Temperature reduction 0.5 Cycles per iteration 20 Minimum parameter value 4 Maximum parameter value 6 Initial seed 30 Total function evaluations 20000 Stopping criteria (repetitions) 8

EXPERIMENTATION Parameter to explore Seed Increment 5 Ploting options Experiments 3

Function evaluations 3801 Minimum -1

seed Evaluations Objective30 3401 -135 2401 -140 3801 -1

28 30 32 34 36 38 40 420

500

1000

1500

2000

2500

3000

3500

4000

EXPERIMENT RESULTS

seed

Fu

ncti

on

Evalu

ati

on

s

Plot the best from each generation

Parameters Required in Experimentation Option

D5
Maximum # of individuals, i.e. max population size
H5
The cooling schedule of a simulated annealing algorithm consists of four components. • Starting Temperature • Final Temperature • Temperature Decrement • Iterations at each temperature
J6
The starting temperature must be hot enough to allow a move to almost any neighbourhood state. If this is not done then the ending solution will be the same (or very close) to the starting solution. Alternatively, we will simply implement a hill climbing algorithm.
D7
number of iteration to be performed in a particular temperature
J7
Geometric decrement where T = Tα where α < 1. Experience has shown that α should be between 0.8 and 0.99, with better results being found in the higher end of the range. Of course, the higher the value of α, the longer it will take to decrement the temperature to the stopping criterion
D8
number of cycles per iteration
D9
Lower bound for variables
D10
Upper bound for variables
J10
Introduce the initial seed to used in solving the problem.
D11
maximun number of function evaluations
J11
maximun number of temperature reductions without considerable improvement in fitness
D14
The parameter to experiment with must be selected from the supplied list.
D15
Indicate the increase to be applied to the parameter being investigated
D16
Number of trials to be run in order to explore the GA behavior when the GA parameter being explored is changed.
Page 9: GA Example

28 30 32 34 36 38 40 420

500

1000

1500

2000

2500

3000

3500

4000

EXPERIMENT RESULTS

seed

Fu

ncti

on

Evalu

ati

on

s

Page 10: GA Example

Generation Average fitness Maximum Function evals Best fitness Best individual1 0.054080139846 0.83644926548 1500 0.999073982239 0.0663472414022 0.100395649672 0.990944802761 0.0678121298553 0.07964450866 0.9909448027614 0.087495900691 0.9909448027615 0.081682011485 0.9909448027616 0.079100884497 0.9909448027617 0.102888189256 0.9909448027618 0.105679087341 0.9909448027619 0.124293647707 0.990944802761

10 0.173792257905 0.99094480276111 0.17962603271 0.99094480276112 0.197637811303 0.99094480276113 0.099046200514 0.99094480276114 0.103207968175 0.99874132871615 0.125505045056 0.99874132871616 0.154545083642 0.99874132871617 0.160544261336 0.99874132871618 0.082174286246 0.99874132871619 0.136733114719 0.99874132871620 0.104014746845 0.99874132871621 0.12085480243 0.99874132871622 0.084054633975 0.99874132871623 0.135230392218 0.99874132871624 0.192223235965 0.99874132871625 0.127027362585 0.99874132871626 0.137405663729 0.99874132871627 0.164078265429 0.99874132871628 0.146615982056 0.99874132871629 0.196901634336 0.99874132871630 0.139695435762 0.99874132871631 0.150956839323 0.99874132871632 0.142944037914 0.99874132871633 0.201223298907 0.99874132871634 0.221900045872 0.99878543615335 0.184005305171 0.99878543615336 0.090767018497 0.99878543615337 0.072908990085 0.99878543615338 0.059858050197 0.99878543615339 0.120692275465 0.99907398223940 0.073036558926 0.99907398223941 0.090278163552 0.99907398223942 0.114286735654 0.99907398223943 0.146480798721 0.99907398223944 0.245500743389 0.99907398223945 0.202510461211 0.99907398223946 0.114572629333 0.99907398223947 0.143346965313 0.99907398223948 0.15784651041 0.99907398223949 0.115194015205 0.999073982239

Page 11: GA Example

50 0.128154024482 0.999073982239

Page 12: GA Example

Results for Carroll GA

Page 13: GA Example

seed Function Evaluations Objective30 1500 0.99748557806

130 1500 0.998213469982230 1500 0.999073982239

0 50 100 150 200 2500

200

400

600

800

1000

1200

1400

1600

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Page 14: GA Example

0 50 100 150 200 2500

200

400

600

800

1000

1200

1400

1600

EXPERIMENT RESULTS

seed

Fu

nc

tio

n E

va

lua

tio

ns

Page 15: GA Example

0 200 400 600 800 1000 1200 1400 16000.75

0.8

0.85

0.9

0.95

1

1.05

BEST FITNESS

NUMBER OF FUNCTION EVALUATIONS

FIT

NE

SS