### Evolution Strategies and Binary Genetic Algorithm Comparison (New Version)

Hello, my friends!!

Here I am again to show you some Evolutionary Computation Simulations. :D

Today we will see a little comparison between an Evolution Strategy (ES) and a Binary Genetic Algorithm. I applied the algorithms to optimize three function: Easom Function, Michalewicz Function and Schaffer Function. All these are minimization problems.

Let me tell you about the configuration of each algorithm:

1-Binary Genetic Algorithm:

a) String Lenght: 25 bits

b) Probability of Crossover: 0.7

c) Probability of Mutation: 0.03

d) Elitism: Ok

e) Population Size: 100 chromossomes

f) Number of generations: 1000 Schaffer Function F7; 3000 Easom Function; 3000 Michalewicz Function

g) Selection Method: Stochastic Tournament (2 chromossomes)

2-Evolution Strategy(ES):

a) Type of Evolution Strategy: (mu+lambda)-ES

b) Number of Parents (mu) : 15

c) Number of offspring (lamda): 35

d) Mutation: Ok.

e) Crossover: Ok.

f) Number of Generations: 1000 Schaffer Function F7; 45 Easom Function; 45 Michalewivz Function

In the Graphs the Red Line is the Binary Genetic Algorithm and the Blue Line is the Evolution Strategy.

First Function: Easom Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [-100:100]

Optima Variables: x1 = x2 = pi

Optimum Function Value: f(x1,x2) = -1

Best Initial Values of GA:

x1 = -11.977538823412026

x2 = 1.2930781034552485

f(x1,x2) = -3.975239915042439e-102

Best Final Values of GA(after 3000 generations):

x1 = 3.1249971128999325

x2 = 3.1249971128999325

f(x1,x2) = 0.99917409269409185

Simulation Time: 28.381 s

Best Initial Values of ES:

x1 = 21.300842203805615

x2 = 14.823566430631823

f(x1,x2) = -1.6190289343389992e-203

Best Final Values of ES(after 45 generations):

x1 = 3.1415926474802367

x2 = 3.1415926550537772

f(x1,x2) = -1

Simulation Time: 0.07 s

Below there is an image of the best fitness versus generations

A closer image:

Second Function: Michalewicz' Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [0:pi]

Optima Variables: x1 = x2 = pi/2

Optimum Function Value: f(x1,x2) = -2

Best Initial Values of GA:

x1 = 1.5210479820083809

x2 = 1.4612604610821343

f(x1,x2) = -1.5408508750355414

Best Final Values of GA(after 3000 generations):

x1 = 1.5707962799815152

x2 = 1.5707962799815152

f(x1,x2) = -1.9999999999999978

Simulation Time: 42.411 s

Best Initial Values of ES:

x1 = 1.7029091414282871

x2 = 1.6858213688002974

f(x1,x2) = -1.019403305540362

Best Final Values of ES(after 45 generations):

x1 = 1.5707963401440286

x2 = 1.5707963200922377

f(x1,x2) = -2

Simulation Time: 0.101 s

Below there is a graph/chart showing us the comparison for that function:

Below we can see a closer view:

Algthough the GA have began closer to the global optimum(its variables are very near from pi/2), the GA did a good search but did not find the global optimum. However, the ES got the answers and is interesting to note that the ES began the search less close to optima variables than the GA did.

Third Function: Schaffer Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [-100:100]

Optima Variables: x1 = x2 = 0

Optimum Function Value: f(x1,x2) = 0

Best Initial Values of GA:

x1 = -3.1670779933654662

x2 = -6.9732697896143732

f(x1,x2) = 2.9646431665317086

Best Final Values of GA(after 1000 generations):

x1 = -2.9802323275873732e-006

x2 = -2.9802323275873732e-006

f(x1,x2) = 0.0036238913066679486

Simulation Time: 9.42 s

Best Initial Values of ES:

x1 = 8.4105629978750667

x2 = 7.3227216058050848

f(x1,x2) = 4.6930482262207818

Best Final Values of ES(after 1000 generations):

x1 = 1.3362218153590791e-162

x2 = -2.8625317383361051e-163

f(x1,x2) = 0

Simulation Time: 3.21 s

Below we can see the graph:

Até Mais!!

[]´s

Marcelo

Here I am again to show you some Evolutionary Computation Simulations. :D

Today we will see a little comparison between an Evolution Strategy (ES) and a Binary Genetic Algorithm. I applied the algorithms to optimize three function: Easom Function, Michalewicz Function and Schaffer Function. All these are minimization problems.

Let me tell you about the configuration of each algorithm:

1-Binary Genetic Algorithm:

a) String Lenght: 25 bits

b) Probability of Crossover: 0.7

c) Probability of Mutation: 0.03

d) Elitism: Ok

e) Population Size: 100 chromossomes

f) Number of generations: 1000 Schaffer Function F7; 3000 Easom Function; 3000 Michalewicz Function

g) Selection Method: Stochastic Tournament (2 chromossomes)

2-Evolution Strategy(ES):

a) Type of Evolution Strategy: (mu+lambda)-ES

b) Number of Parents (mu) : 15

c) Number of offspring (lamda): 35

d) Mutation: Ok.

e) Crossover: Ok.

f) Number of Generations: 1000 Schaffer Function F7; 45 Easom Function; 45 Michalewivz Function

In the Graphs the Red Line is the Binary Genetic Algorithm and the Blue Line is the Evolution Strategy.

First Function: Easom Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [-100:100]

Optima Variables: x1 = x2 = pi

Optimum Function Value: f(x1,x2) = -1

Best Initial Values of GA:

x1 = -11.977538823412026

x2 = 1.2930781034552485

f(x1,x2) = -3.975239915042439e-102

Best Final Values of GA(after 3000 generations):

x1 = 3.1249971128999325

x2 = 3.1249971128999325

f(x1,x2) = 0.99917409269409185

Simulation Time: 28.381 s

Best Initial Values of ES:

x1 = 21.300842203805615

x2 = 14.823566430631823

f(x1,x2) = -1.6190289343389992e-203

Best Final Values of ES(after 45 generations):

x1 = 3.1415926474802367

x2 = 3.1415926550537772

f(x1,x2) = -1

Simulation Time: 0.07 s

Below there is an image of the best fitness versus generations

A closer image:

Second Function: Michalewicz' Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [0:pi]

Optima Variables: x1 = x2 = pi/2

Optimum Function Value: f(x1,x2) = -2

Best Initial Values of GA:

x1 = 1.5210479820083809

x2 = 1.4612604610821343

f(x1,x2) = -1.5408508750355414

Best Final Values of GA(after 3000 generations):

x1 = 1.5707962799815152

x2 = 1.5707962799815152

f(x1,x2) = -1.9999999999999978

Simulation Time: 42.411 s

Best Initial Values of ES:

x1 = 1.7029091414282871

x2 = 1.6858213688002974

f(x1,x2) = -1.019403305540362

Best Final Values of ES(after 45 generations):

x1 = 1.5707963401440286

x2 = 1.5707963200922377

f(x1,x2) = -2

Simulation Time: 0.101 s

Below there is a graph/chart showing us the comparison for that function:

Below we can see a closer view:

Algthough the GA have began closer to the global optimum(its variables are very near from pi/2), the GA did a good search but did not find the global optimum. However, the ES got the answers and is interesting to note that the ES began the search less close to optima variables than the GA did.

Third Function: Schaffer Function

Number of Variables: 2

Number of optima: 1

Variables' Range: x1 = x2 = [-100:100]

Optima Variables: x1 = x2 = 0

Optimum Function Value: f(x1,x2) = 0

Best Initial Values of GA:

x1 = -3.1670779933654662

x2 = -6.9732697896143732

f(x1,x2) = 2.9646431665317086

Best Final Values of GA(after 1000 generations):

x1 = -2.9802323275873732e-006

x2 = -2.9802323275873732e-006

f(x1,x2) = 0.0036238913066679486

Simulation Time: 9.42 s

Best Initial Values of ES:

x1 = 8.4105629978750667

x2 = 7.3227216058050848

f(x1,x2) = 4.6930482262207818

Best Final Values of ES(after 1000 generations):

x1 = 1.3362218153590791e-162

x2 = -2.8625317383361051e-163

f(x1,x2) = 0

Simulation Time: 3.21 s

Below we can see the graph:

Até Mais!!

[]´s

Marcelo

## 2 Comments:

I enjoyed your Blog.

My Site / Blog is a tai chi related site which covers health related problems check it out if you get time.

Regards John

Blogs part of media future

Political Internet forums are gaining popularity, especially during the Virginia governor's race.

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a birthday gift delivery site. It pretty much covers birthday gift delivery related information.

Come and check it out if you get time :-)

Post a Comment

## Links to this post:

Create a Link

<< Home