# Introduction to Evolutionary Computation and Evolutionary by itlpw9937

VIEWS: 171 PAGES: 29

• pg 1
```									Exercise 6                     EA with Real Implementation (Matlab code)   Summary

Introduction to Evolutionary Computation and Evolutionary
Computation Module
Tutorial 5

V. Landassuri-Moreno
v.landassuri-moreno@cs.bham.ac.uk

School of Computer Science
University of Birmingham

November 23, 2009

1/11
Exercise 6                    EA with Real Implementation (Matlab code)   Summary

Outline

Exercise 6

EA with Real Implementation (Matlab code)

Summary

2/11
Exercise 6                             EA with Real Implementation (Matlab code)     Summary

Q1. Weakness in a Repair Algorithm

Repair Algorithm:
Repair algorithms let us map infeasible individuals into feasible ones

Exercise 6                                                                                  3/11
Exercise 6                             EA with Real Implementation (Matlab code)         Summary

Q1. Weakness in a Repair Algorithm

Repair Algorithm:
Repair algorithms let us map infeasible individuals into feasible ones

Weakness:
The main issue here is that for a particular problem, you need to design a repair
algorithm
There is not a general equation that could be applied
Depending of the problem at hand, the Repair algorithm could be as difﬁcult as to
solve the original problem

Exercise 6                                                                                       3/11
Exercise 6                           EA with Real Implementation (Matlab code)         Summary

Q2. Main differences between Niching and Speciation

Niching:
Finds and maintain subpopulation of solutions around multiple optima (ﬁnding
different peaks)

Exercise 6                                                                                    4/11
Exercise 6                            EA with Real Implementation (Matlab code)         Summary

Q2. Main differences between Niching and Speciation

Niching:
Finds and maintain subpopulation of solutions around multiple optima (ﬁnding
different peaks)

Speciation:
Makes a parallel search in each optima to ﬁnd multiple solutions at the same time
(identifying the actual peak in each area)

Exercise 6                                                                                       4/11
Exercise 6                     EA with Real Implementation (Matlab code)        Summary

Q3. Landscapes and Energy surfaces
Fitness landscape and energy surface describe the relationships between variables in
an EA and the solutions in the population.

Exercise 6                                                                               5/11
Exercise 6                              EA with Real Implementation (Matlab code)               Summary

Q3. Landscapes and Energy surfaces
Fitness landscape and energy surface describe the relationships between variables in
an EA and the solutions in the population.
Landscape:
Analogy with natural biology
If you plot the objective function you will creates the Landscape of the function to
optimize
Then you have the search space plotted in a given range (which is a
n-dimensional hyperplane)
It can have some peaks, troughs, and ﬂat areas (valleys)
If you take an individual (a potential solution) it corresponds to a point in the
hyperplane

Exercise 6                                                                                             5/11
Exercise 6                              EA with Real Implementation (Matlab code)               Summary

Q3. Landscapes and Energy surfaces
Fitness landscape and energy surface describe the relationships between variables in
an EA and the solutions in the population.
Landscape:
Analogy with natural biology
If you plot the objective function you will creates the Landscape of the function to
optimize
Then you have the search space plotted in a given range (which is a
n-dimensional hyperplane)
It can have some peaks, troughs, and ﬂat areas (valleys)
If you take an individual (a potential solution) it corresponds to a point in the
hyperplane

Energy surface:
Speciﬁc form of landscape
Come from chemical/physical problems
Here the Energy of a solution determinate the ﬁtness of the objective function
Usually they are problems of minimization

Exercise 6                                                                                             5/11
Exercise 6                              EA with Real Implementation (Matlab code)   Summary

Q4. List of ﬁtness sharing and implicit ﬁtness sharing from paper: Every
niching method has its niche (lecture 06)

Fitness sharing
Small population
It can ﬁnd the optima with larger basins of attractions
Less distracted by peaks with small basin of attraction

Exercise 6                                                                                 6/11
Exercise 6                              EA with Real Implementation (Matlab code)          Summary

Q4. List of ﬁtness sharing and implicit ﬁtness sharing from paper: Every
niching method has its niche (lecture 06)

Fitness sharing
Small population
It can ﬁnd the optima with larger basins of attractions
Less distracted by peaks with small basin of attraction

Implicit ﬁtness sharing
Covers optima more comprehensively even with small basin of attraction
It is needed a large population to form species at each peak of interest

Exercise 6                                                                                        6/11
Exercise 6                               EA with Real Implementation (Matlab code)               Summary

Q4. List of ﬁtness sharing and implicit ﬁtness sharing from paper: Every
niching method has its niche (lecture 06)

Fitness sharing
Small population
It can ﬁnd the optima with larger basins of attractions
Less distracted by peaks with small basin of attraction

Implicit ﬁtness sharing
Covers optima more comprehensively even with small basin of attraction
It is needed a large population to form species at each peak of interest

But, what happen if the population is not so large or not cover all the peaks?
How could you determinate it?

Exercise 6                                                                                              6/11
Exercise 6                                 EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

From the simple EA implemented in C, you needed to change:
Change the function to generate random binary strings (population) to real
number
Use other method for Crossover and Mutation suitable for real representation e.g.
Crossover: Intermediate recombination
xi     x1i   1     x2i      0 1
Mutation: Gaussian or Cauchy Mutation

EA with Real Implementation (Matlab code)                                                     7/11
Exercise 6                                 EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

EA with Real Implementation (Matlab code)                                                     8/11
Exercise 6                                          EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4      10, f5        100

EA with Real Implementation (Matlab code)                                                              8/11
Exercise 6                                          EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4      10, f5        100
fi     10        which is incorrect

EA with Real Implementation (Matlab code)                                                              8/11
Exercise 6                                             EA with Real Implementation (Matlab code)    Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4         10, f5        100
fi     10        which is incorrect

Another option is to take the abs fi giving:
f1        100, f2        5, f3        5, f4       10, f5        100;         fi      220

EA with Real Implementation (Matlab code)                                                                  8/11
Exercise 6                                             EA with Real Implementation (Matlab code)    Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4         10, f5        100
fi     10        which is incorrect

Another option is to take the abs fi giving:
f1        100, f2          5, f3      5, f4       10, f5        100;         fi      220
fi
Calculating                fi

EA with Real Implementation (Matlab code)                                                                  8/11
Exercise 6                                             EA with Real Implementation (Matlab code)              Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4         10, f5        100
fi     10        which is incorrect

Another option is to take the abs fi giving:
f1        100, f2          5, f3      5, f4       10, f5        100;         fi      220
fi
Calculating                fi
p1        0 4545, p2               0 0227, p3           0 0227, p4             0 0455, p5   0 4545

EA with Real Implementation (Matlab code)                                                                            8/11
Exercise 6                                             EA with Real Implementation (Matlab code)              Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4         10, f5        100
fi     10        which is incorrect

Another option is to take the abs fi giving:
f1        100, f2          5, f3      5, f4       10, f5        100;         fi      220
fi
Calculating                fi
p1        0 4545, p2               0 0227, p3           0 0227, p4             0 0455, p5   0 4545
As you can see there are some problems too, nevertheless we can continue in
this way and develop a metric that works

EA with Real Implementation (Matlab code)                                                                            8/11
Exercise 6                                             EA with Real Implementation (Matlab code)              Summary

Q5. Implement the simple EA with real representation

We can not use directly the Roulette wheel selection with negative numbers
[-1024,1024]

e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4         10, f5        100
fi     10        which is incorrect

Another option is to take the abs fi giving:
f1        100, f2          5, f3      5, f4       10, f5        100;         fi      220
fi
Calculating                fi
p1        0 4545, p2               0 0227, p3           0 0227, p4             0 0455, p5   0 4545
As you can see there are some problems too, nevertheless we can continue in
this way and develop a metric that works
On the other hand we can use a Rank selection to modify the ﬁtness and make it
easy

EA with Real Implementation (Matlab code)                                                                            8/11
Exercise 6                                 EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals

EA with Real Implementation (Matlab code)                                                     9/11
Exercise 6                                          EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals
e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3   5, f4      10, f5        100

EA with Real Implementation (Matlab code)                                                              9/11
Exercise 6                                           EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals
e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3    5, f4      10, f5           100
New ﬁtness
f1      5, f2       4, f3          3, f4    2, f5       1;        fi     15

EA with Real Implementation (Matlab code)                                                               9/11
Exercise 6                                           EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals
e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3    5, f4      10, f5           100
New ﬁtness
f1      5, f2       4, f3          3, f4    2, f5       1;        fi     15
Do you know why they have been ranked in reverse order?

EA with Real Implementation (Matlab code)                                                               9/11
Exercise 6                                           EA with Real Implementation (Matlab code)   Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals
e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3    5, f4      10, f5           100
New ﬁtness
f1      5, f2       4, f3          3, f4    2, f5       1;        fi     15
Do you know why they have been ranked in reverse order?
fi
Calculating                fi

EA with Real Implementation (Matlab code)                                                               9/11
Exercise 6                                           EA with Real Implementation (Matlab code)                       Summary

Q5. Implement the simple EA with real representation

Using Rank ﬁrst and then roulette wheel to select the individuals
e.g.
Having 5 individuals with ﬁtness:
f1         100, f2                5, f3    5, f4      10, f5           100
New ﬁtness
f1      5, f2       4, f3          3, f4    2, f5       1;        fi     15
Do you know why they have been ranked in reverse order?
fi
Calculating                fi

p1       0 3333, p2                0 2667, p3         0 2, p4          0 1333, p5       0 0667 ;   fi   1

EA with Real Implementation (Matlab code)                                                                                   9/11
Exercise 6                                 EA with Real Implementation (Matlab code)   Summary

Q5.

Given that one of the objectives of the module is to show how to implement EAs
in different languages, here is presented another version of a simple EA that
optimize a given function with real representation, the code could be use as a
base to a bigger implementation or to plug more complex functions (e.g.
Hypermutation).
The code is in the web page of the module.
With this algorithm, you have seen examples of EA in different programming
languages.

EA with Real Implementation (Matlab code)                                                    10/11
Exercise 6                         EA with Real Implementation (Matlab code)         Summary

Summary

It has been reviewed the exercise 6
The last question required that you implement an EA with real representation.
Here was given another version in Matlab showing how to perform that
It was used rank and roulette wheel selection to change the ﬁtness and select the
individual when we have negative ﬁtness
I could be a good idea if you improve this code.

Summary                                                                                    11/11

```
To top