You are on page 1of 24

Genetic Algorithms

Presented To : Dr. Sherin Youssof

Presented By : Ahmad Abdullatif Goudah


Out-line

• 2.1. A Brief History of Evolutionary Computation


• 2.2. Biological Terminology
• 2.3. Search Spaces and Fitness Landscapes
• 2.4. Elements of Genetic Algorithms
• 2.5. A Simple Genetic Algorithm
• 2.6. Flowchart for a schematic genetic operation
• 2.7. Encoding a Problem for a Genetic Algorithm
(Binary and non-binary encoding)
• 2.8. Examples of different problem encoding
schemes
• 2.9. Selection Methods
2.1. A Brief History of Evolutionary
Computation
• Evolutionary Computation is the field of study
devoted to the design, development, and
analysis is problem solvers based on natural
selection (simulated evolution).

• Idea of evolutionary computing was introduced in


the 1960s by Professor Dr. Ingo Rechenberg in
his work "Evolution strategies" .

• Genetic Algorithms (GAs) were invented by John


Holland and lead to Holland's book "Adaption in
Natural and Artificial Systems" published in 1975.

• In 1992 "genetic programming" (GP) method


used by John Koza to evolve programs to
perform certain tasks.
2.1. A Brief History of Evolutionary
Computation (cont.)
Evolutionary Computation has been successfully
applied to a wide range of problems including:
• Aircraft Design • Strike Force Allocation
• Routing in Communications • Theme Park Tours
Networks (Disney Land/World)
• Tracking Wind shear • VLSI Circuit Layout
• Game Playing (Checkers [Fogel]) • Market Forecasting
• Robotics • Egg Price Forecasting
• Air Traffic Control • Design of Filters and
• Design Barriers
• Scheduling • Data-Mining
• Machine Learning • User-Mining
• Pattern Recognition • Resource Allocation
• Job Shop Scheduling • Path Planning
• Etc...
2.1. A Brief History of Evolutionary
Computation (cont.)

• Evolutionary computation comprises the four main areas of


Genetic Algorithms, Evolution Strategies, Genetic
Programming and Simulated Annealing
2.2. Biological Terminology
• Chromosome:
All living organisms
consist of cells. In
each cell there is the
same set of
chromosomes.

Chromosomes are
strings of DNA and
serves as a model for
the whole organism.
2.2. Biological Terminology (cont.)
• A chromosome consist of genes, blocks of DNA. Each gene encodes
a particular protein. Basically can be said, that each gene encodes a
trait , for example color of eyes. Possible settings for a trait (e.g. blue,
brown) are called alleles. Each gene has its own position in the
chromosome. This position is called locus.

• Complete set of genetic material (all chromosomes) is called genome.


Particular set of genes in genome is called genotype. The genotype is
with later development after birth base for the organism's phenotype,
its physical and mental characteristics, such as eye color, intelligence
etc.

• During reproduction, first occurs recombination (or crossover). The


new created offspring can then be mutated. Mutation means, that the
elements of DNA are a bit changed. The fitness of an organism is
measured by success of the organism in its life.
2.2. Biological Terminology (cont.)
• Summary ..
– 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 of an individual
– Allele - Possible settings for a trait
– Locus - The position of a gene on the chromosome
– Genome - Collection of all chromosomes for an individual
2.3. Search Spaces and Fitness
Landscapes
• search space ( state space ) : The space of all
feasible solutions
– Each point in the search space represent one feasible
solution.
– Each feasible solution can be "marked" by its value or
fitness for the problem.
2.3. Search Spaces and Fitness
Landscapes (cont.)
• fitness landscape : In order to use evolutionary
optimization, one has to define for every possible solution s
to the problem of interest how 'good' it is. This is done by
introducing a scalar-valued function f(s) which is called the
fitness function or fitness landscape.
• A high f(s) implies that s is a good solution
• The best solution found can survive to end of run which is
Darwinian principle of “survival of the fittest “
2.4. Elements of Genetic Algorithms

1. a population of candidate solutions (CSs) is randomly generated.

2. Each of the CSs is evaluated and assigned a fitness based on a


user specified evaluation function to determine the ‘goodness’ of
a CS.

3. A number of individuals are then selected to be parents based on


their fitness.

4. The Select_Parents method must be one that balances the urge


for selecting the best performing CSs with the need for population
diversity.
2.5. A Simple Genetic Algorithm
BEGIN
Generate initial population;
Compute fitness of each individual;
REPEAT /* New generation /*
FOR population_size / 2 DO
Select two parents from old generation;
/* biased to the fitter ones */
Recombine parents for two offspring;
Compute fitness of offspring;
Insert offspring in new generation
END FOR
UNTIL population has converged
END
2.6. Flowchart for a schematic genetic
operation
2.7. Encoding a Problem for a Genetic
Algorithm (Binary and non-binary encoding)
• Encoding of chromosomes is one of the problems, when you are starting to
solve problem with GA. Encoding very depends on the problem.
– Binary Encoding
• every chromosome is a string of bits, 0 or 1.
• 2.8. Example of Problem: Knapsack problem
The problem: There are things with given value and size. The
knapsack has given capacity. Select things to maximize the
value of things in knapsack, but do not extend knapsack
capacity.
Encoding: Each bit says, if the corresponding thing is in
knapsack.
2.7. Encoding a Problem for a Genetic
Algorithm (Binary and non-binary encoding)
(cont.)
– Permutation Encoding
• every chromosome is a string of numbers
• 2.8. Example of Problem: Travelling salesman problem (TSP)
The problem: There are cities and given distances between
them.Travelling salesman has to visit all of them, but he does not
to travel very much. Find a sequence of cities to minimize travelled
distance.
Encoding: Chromosome says order of cities, in which salesman
will visit them.
2.7. Encoding a Problem for a Genetic
Algorithm (Binary and non-binary encoding)
(cont.)
– Value Encoding
• every chromosome is a string of some values.
• Values can be anything connected to problem, form numbers, real
numbers or chars to some complicated objects.
• 2.8. Example of Problem: Finding weights for neural network
The problem: There is some neural network with given
architecture. Find weights for inputs of neurons to train the
network for wanted output.
Encoding: Real values in chromosomes represent
corresponding weights for inputs.
2.7. Encoding a Problem for a Genetic
Algorithm (Binary and non-binary encoding)
(cont.)
– Tree Encoding
• every chromosome is a tree of some
objects, such as functions or
commands in programming
language.
• 2.8. Example of Problem: Finding a
function from given values
The problem: Some input and
output values are given. Task is to
find a function, which will give the
best (closest to wanted) output to all
inputs.
Encoding: Chromosome are
functions represented in a tree.
2.9. Selection Methods

• chromosomes are selected from the population to be


parents to crossover.
• There are many methods how to select the best
chromosomes, for example :
• Roulette wheel selection.
• Boltzman selection.
• Tournament selection.
• Rank selection.
• Steady state selection.
• …
2.9. Selection Methods (cont.)
• Roulette wheel selection
• Parents are selected according to their fitness.
• The better the chromosomes are, the more chances to be
selected they have.
• Imagine a roulette wheel where are placed all
chromosomes in the population, every has its place big
accordingly to its fitness function
• will have problems when the fitnesses differs very much
2.9. Selection Methods (cont.)

• Rank Selection
• Rank selection first ranks the
population .
• Every chromosome receives
fitness from this ranking.
• The worst will have fitness 1,
second worst 2 etc.
• The best will have fitness N
(number of chromosomes in
population) .
• But this method can lead to
slower convergence, because
the best chromosomes do not
differ so much from other
ones.
2.9. Selection Methods (cont.)

• Steady-State Selection
• Main idea of this selection is that big part of
chromosomes should survive to next generation.

• In every generation are selected a few (good - with


high fitness) chromosomes for creating a new offspring

• Then some (bad - with low fitness) chromosomes are


removed and the new offspring is placed in their place.

• The rest of population survives to new generation.


2.9. Selection Methods (cont.)

• Boltzmann selection
• In Boltzmann selection, a method inspired by the
technique of simulated annealing, selection pressure is
slowly increased over evolutionary time to gradually
focus the search.

• Given a fitness of f, Boltzmann selection assigns a new


fitness, f0, according to a differentiable function.
2.9. Selection Methods (cont.)
• Tournament Selection
• Involves running several "tournaments" among a few
individuals chosen at random from the population .
• The winner of each tournament (the one with the best
fitness) is selected for crossover
• If the tournament size is larger, weak individuals have
a smaller chance to be selected.
• Tournament selection pseudo code:

• (k=1) selection is equivalent to random selection.


• Deterministic tournament selection selects the best
individual (when p=1) in any tournament
Thanks

You might also like