2. Nature, science and engineering
Optimization problem
Evolutionary algorithms
Genetic algorithms
An example
Content
By Iman Ardekani
3. In the procedure of exploring the natural laws in
science for fabricating useful products in
engineering, we often face two problems:
1. Learning Problem
2. Optimization Problem
Nature, Science and Engineering
By Iman Ardekani
4. Learning Problem
Processing and classification of data in order to create
information and knowledge.
Nature, Science and Engineering
Data Information Knowledge
Learning Problem
By Iman Ardekani
5. Optimization Problem
Using data in order to find an optimal solution, e.g. the
best decision or parameters of an optimal controller.
Nature, Science and Engineering
Knowledge Best Solution
Optimization Problem
By Iman Ardekani
6. Optimization problem has a long history. When Euclid founded
Geometry (as a knowledge), he tried to solve the first
optimization problems. Examples are:
1. What is the shortest path between two points?
2. How to break a stick to make a rectangle with maximum
area?
Optimization Problem
By Iman Ardekani
8. An example for optimization problem (combinatorial):
How to place 8 queens on a chess board so that no queens
attack each other.
How to differentiate with respect to a Queen ?
Optimization Problem
By Iman Ardekani
9. An example for optimization problem (multi-objective):
How to minimize costs and maximize benefits.
There is no answer here.
Optimization Problem
By Iman Ardekani
11. There are many different EA algorithms, the basic
of which can be explained through Genetic
Algorithms.
They are all random-based solution space
searching meta-heuristic algorithms.
Evolutionary Algorithms
By Iman Ardekani
12. Mendel (1822-1884) – Philosopher and scientist
cultivated and tested about 29,000 plants between 1856 and
1863 to verify his laws of heritance. Mendel's work was rejected
at first, and was not widely accepted until after he died.
Darwin (1809-1882) – Scientist
developed his evolution theory, stating that evolution is the
change in the inherited characteristics of biological populations
over successive generations.
Evolutionary Algorithms
Evolutionary algorithms are based on the basic principles of Mendel’s
foundation of genetics and Darwin’s theory of evolution .
By Iman Ardekani
13. John Holland – Professor of psychology and Professor of
electrical engineering at the University of Michigan
The main idea of genetic algorithm is that every individual of a
species can be characterized by its abilities that help it to cope
with its environment in terms of survival and reproduction.
Genetic Algorithm
By Iman Ardekani
14. A genetic algorithm is a search heuristic algorithm that mimics
the process of natural evolution. It has 5 phases:
Genetic Algorithm
1. Population
Generation
2. Fitness
Evaluation
4. Crossover
5. Mutation 3. Selection
By Iman Ardekani
15. Phase 1: Population Generation
Individuals
1. Individuals = a sample from the solution space (each individual
is a solution)
2. Generation = a group of individuals
Genetic Algorithm
individual 1 individual 2 …. individual N
Population | Popsize = N
By Iman Ardekani
16. Phase 1: Population Generation
Population Generation Rules
1. The first generation is produced randomly.
2. Next generations are produced through breeding.
Genetic Algorithm
Generation
1
Generation
2
Generation
3
By Iman Ardekani
17. Phase 1: Population Generation
Chromosomes and Fitness
Each individual has two properties:
a) Its location (chromosome composed of genes)
b) Its quality (fitness value)
Genetic Algorithm
individual n
Chromosome
Fitness
By Iman Ardekani
18. Phase 2: Fitness Evaluation
Fitness value of an individual is usually the value of the cost-
function (to be optimized) with respect to the locations (genes)
of the individual.
Genetic Algorithm
X1: Gene 1
...
X2: Gene 2
XL: Gene 2
chromosome
F(x1,x2,…,xL) Fitness value
By Iman Ardekani
19. Phase 3: Selection
After evaluating the fitness of all individuals, we use a selection
process to generate a mating pool.
Each individual may be selected several times.
Even low quality individuals have chance to be selected.
Individuals in the mating pool are called parents.
Genetic Algorithm
By Iman Ardekani
20. Phase 3: Selection
Selection Rule:
1. Higher quality = more chance of being selected into the mating pool
Example:
Genetic Algorithm
Individual Fitness Relative
1 90 45%
2 60 30%
3 20 10%
4 30 15%
Mating pool
individual 1
individual 4
individual 1
individual 2
By Iman Ardekani
21. Phase 4: Crossover
Two parents might be selected randomly from the mating pool
to generate two offspring.
Genetic Algorithm
Mating pool
individual 1
individual 4
individual 1
individual 2
Random
selection
individual 1
individual 4
Offspring 1
Offspring 2
Crossover
By Iman Ardekani
22. Phase 4: Crossover
Crossover Rule:
1. Genes of each offspring is a certain combination of the genes
of its parents.
Genetic Algorithm
X1: Gene 1
X2: Gene 2
X4: Gene 4
Parent 1
chromosome
X3: Gene 3
Y1: Gene 1
Y2: Gene 2
Parent 2
chromosome
Y4: Gene 4
Y3: Gene 3
Offspring 1
chromosome
X1: Gene 1
X2: Gene 2
Y4: Gene 4
Y3: Gene 3
By Iman Ardekani
23. Phase 5: Mutation
There is a very low chance for (small) changes in the genes of
the offspring; however, it should be considered.
Mutation = Small changes in the genes of an offspring
Genetic Algorithm
X1: Gene 1
X2: Gene 2
Y4: Gene 4
Offspring 1
chromosome
Y3: Gene 3
X1: Gene 1
X2: Gene 2
Z : Gene 3
By Iman Ardekani
24. Phase 5: Mutation
After considering the chance for mutation, the next generation
will be formed of new offspring.
Genetic Algorithm
Current
Generation
Next
Generation
Fitness
evaluation
Selection
Crossover
Mutation
By Iman Ardekani
25. Evolution of a walking creature:
Genetic Algorithm
By Iman Ardekani
26. The problem is finding the maximal point of f(x):
f(x)=2+xsin(2x)
where the solution space is given by
-1x 2
Example
-1 -0.5 0 0.5 1 1.5 2
0
1
2
3
4
By Iman Ardekani
27. Defining chromosomes and genes
−1𝑥 2
1. We can divide the solution space into 212 sections.
2. In this case, each solution value can be represented by a 12-bit
binary number.
3. This 12-bit representation can be considered as Chromosome
4. Each bit can be considered as a gene.
By Iman Ardekani
28. Defining chromosomes and genes
𝑥 𝑚𝑖𝑛 = −1
𝑥 𝑚𝑖𝑛 = 2
𝑥 = 𝑥 𝑚𝑎𝑥 − 𝑥 𝑚𝑖𝑛
𝑖=0
11
𝑎𝑖2𝑖
212
+ 𝑥 𝑚𝑖𝑛
Example: 0.9534 can be represented by
1 0 1 0 0 1 1 0 1 0 1 1
By Iman Ardekani
30. Steps to follow:
1. 10 random value for x (individuals) leads to 10 chromosomes.
2. The fitness value of each individual can be found as y=f(x).
3. The relative fitness can be then obtained accordingly.
4. Based on the relative fitness values, a selection wheel can be
created.
5. A mating pool can be created by using the selection wheel.
6. Two individual can be selected from the mating pool as
parents.
Example
By Iman Ardekani
31. Steps to follow:
7. A random number is generated. If the random number is
higher than a certain level (crossover probability), the
crossover will happen.
8. Otherwise, two other parents will be selected and step 7 will
be repeated.
Example
1 0 1 0 0 1 1 0 1 0 1 1
0 0 1 0 0 1 0 0 1 0 0 1
Parent 1
Parent 2
By Iman Ardekani
32. Steps to follow:
7. A random number is generated. If the random number is
higher than a certain level (crossover probability), the
crossover will happen.
8. Otherwise, two other parents will be selected and step 7 will
be repeated.
Example
1 0 1 0 0 1 1 0 1 0 1 1
0 0 1 0 0 1 0 0 1 0 0 1
Parent 1
Parent 2
By Iman Ardekani
34. Steps to follow:
10. For each gene of each child, a random number will be
generated. If the number is higher than a certain value
(mutation probability – very low) then the value of the gene
will be changed. Otherwise, the gene remains untouched.
Example
1 0 1 0 0 1 0 0 1 0 0 1Child 1
1 0 1 0 0 0 0 0 1 0 0 1Child 1
mutation
By Iman Ardekani
35. Steps to follow:
11. The two children (after considering the mutation probability)
will be add to the next generation.
12. Step 7 will be repeated until the size of the new generation
becomes equal to the Popsize.
13. Step 2 will be repeated for the new generation.
Example
By Iman Ardekani
I think there are some drawbacks for evolutionay algorithm. For example, they can find an optimum solution but the process of obtaining this solution is not optimum.
Many people think that evolutionary algorithms work in the way that the evolution works in the nature. So study of these algorithms might be interesting.
Personally, I am not very keen to these algorithms but understanding them could be useful.
For example, data can be daily temperature of a region. The numbers representing daily temperature should be analyzed in order to create graphs for studying the climate of a region. The graphs or information can represent seasonal temperature or annual temperature. After collecting data and producing information for so many years we can analyze the information and create knowledge for forecasting the climate of that particular area.
Forecasting is a kind of optimization problem. Because you are going to use your knowledge for finding the best possible answer. Back to our previous example, after creating the knowledge of climate in a particular region we can move towards forecasting the climate in that area.
These are deterministic optimization problems because the problem is defined a deterministic problem with certain values for parameters. However, an optimization problem can be defined in a problem domain with high level of uncertainty. This means that some parameters can have some stochastic characteristics.
Lets have a look at the optimization problem in view point of classic mathematics. But the question here is “can we deal with all of the optimization problems using this approach?”… and unfortunately, the answer is a No.