Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

Genetic Algorithm

May 20th 2018

Ulfah Khairiyah Luthfiyani


Department of Electrical Engineering
Korea National University of Transpotation
Why Genetic Algorithm ?

How could we obtain the maximum and minimum point of this graph ?
Genetic Algorithm

A metaheuristic inspired by the process


of natural selection that belongs to the
larger class of evolutionary
algorithms (EA).
Genetic algorithms are commonly used
to generate high-quality solutions
to optimization and search problems by
relying on bio-inspired operators such
as mutation, crossover and selection.
Genetic Algorithm’s Key Terms

• Individual - Any possible solution

• Population - Group of all individuals

• Search Space - All possible solutions to the problem

• Chromosome - Blueprint for an individual

• Trait - Possible aspect (features) of an individual

• Allele - Possible settings of trait (black, blond, etc.) Genotype:


– Particular set of genes in a genome

• Locus - The position of a gene on the chromosome Phenotype:


– Physical characteristic of the genotype (smart, beautiful, healthy, etc.)

• Genome - Collection of all chromosomes for an


individual
Initializes
How to use Genetic Algorithm ? Population
How it works:

1 Start with make initialization of population Fitness


Assignment
Evaluate by fitness function to obtain some probabilities Individual solutions are selected through a
2 fitness-based process, where fitter solutions (as measured by a fitness function) are typically more likely
to be selected.
Doing a selection. Certain selection methods rate the fitness of each solution and preferentially select the Selection
3 best solutions. Other methods rate only a random sample of the population, as this process may be very

Reproduction
time-consuming.

4
Making a new element by Crossover with combines information from the parents (selected elements Crossover
as parent)

A new element’s(N) individual characteristics will be introduced in the chromosome through Mutation
5 process. Mutation
Access the fitness of the offspring and the N elements (survival selection) will be included as a new
6 member of population
Survival
7 Output will be obtained when GA stop the loop that appropriate of expected criteria (terminate Selection
condition) such as computational time, number of fitness, etc.

Output
Factors influencing for Genetic Algorithm
1. Genetic and Fitness

Genetic Genotype Space


Representation data of genes

Phenotype Space
expression

Assignment
Evaluation
A B C D E

Fitness
Fitness Value

Genetic representation is the solution’s This process will selects the gene
coding process of the problem or chromosome that has expected
value
Factors influencing for Genetic Algorithm
2. Selection

Steady State Selection Elitist Selection Roulette Wheel Selection

Select the gens or Select all possible pairs Based on roulette wheel, the gen or
chromosome that has the among the best candidates chromosome with higher fitness value will
biggest fitness value have a big opportunity to be selected
Factors influencing for Genetic Algorithm
3. Crossover
Factors influencing for Genetic Algorithm
4. Mutation
Permutation Encoding

Binary Encoding

Doing inversion to the


selected bit

Changing two selected bit


Factors influencing for Genetic Algorithm
4. Mutation

Value Encoding Tree Encoding

(-) (+)
1.29 5.68 2.86 4.11 5.55

1.29 5.68 2.73 4.22 5.55

This mutation used in problems where


complicated value and binary encoding
wouldn’t suffice it.

The selected node will be changed


Factors influencing for Genetic Algorithm
5. Offspring

Offspring are the new


chromosomes that was
created
Factors influencing for Genetic Algorithm

6. Control Parameter
Simple Example : Finding the word “unicorn”
Random Pop Fitness Probability
How to find it ?
unijorm 5 50%
1. Create a random population of N elements. pancake 1 10%
aaaaah 0 0%
• Make some possibilities, i.e :
popcorn 4 40%
unijorm, pancake, aaaaah, popcorn
2. Doing the Reproduction Process u n i j o r m popco r n
• Pick 2 parents that has a good value
• Make a new element 1% 1% 1%

Crossover u n i co r n
Mutation 1% 1% 1% 1%

2. And repeat! - Now we have our next generation we can 50%


start again from step two until we reach a termination unijorm
condition. 10%
pancake
popcorn
40%
Implementation GA in C++
Initialization
Implementation GA in C++
Implementation GA in C++
Implementation GA in C++
Implementation GA in C++
Implementation GA in C++
Implementation GA in
C++
Implementation GA in C++
Conclusion

Genetic Algorithm (GA) can solves several complicated


problems to find the expected things. It can rapidly
locate good solutions, even for difficult search spaces.

You might also like