Max One
Max One
Mohammed Wahbi
Business Plan
Algorithms in Nature
Genetic algorithms
A genetic algorithm conceptually follows
steps inspired by the biological
processes of evolution.
Genetic Algorithms follow the idea of
SURVIVAL OF THE FITTEST- Better and
better solutions evolve from previous
generations until a near optimal solution
is obtained.
What is GA
A genetic algorithm (or GA) is a search technique used
in computing to find true or approximate solutions to
optimization and search problems.
(GA)s are categorized as global search heuristics.
(GA)s are a particular class of evolutionary algorithms
that use techniques inspired by evolutionary biology
such as inheritance, mutation, selection, and crossover
(also called recombination).
What is GA Cont...
The evolution usually starts from a population of
randomly generated individuals and happens in
generations.
Vocabulary
Individual - Any possible solution
Population - Group of all individuals
Fitness Target function that we are optimizing (each
individual has a fitness)
Trait - Possible aspect (features) of an individual
Genome - Collection of all chromosomes (traits) for an
individual.
=1 ,
Algorithm Psedudocode
generation = 0;
Initialization (popSize); // at random or from a file
while(!TerminationCondition())
{
generation = generation + 1;
Illustration
Suppose we want to maximize the number of ones in a
string of l binary digits Is it a trivial problem?
Illustration cont.
An individual is encoded (naturally) as a string of l binary
digits
initialization
We toss a fair coin 60 times and get the following initial
population:
s1 = 1111010101
f (s1) = 7
s2 = 0111000101
f (s2) = 5
s3 = 1110110101
f (s3) = 7
s4 = 0100010011
f (s4) = 4
s5 = 1110111101
f (s5) = 8
s6 = 0100110000
f (s6) = 3
Selection
We randomly (using a biased coin) select a subset of the
individuals based on their fitness:
Area is
Proportional
to fitness
value
n
3
4
Selected set
Suppose that, after performing selection, we get the
following population:
Crossover (Step2 )
Next we mate strings for crossover. For each couple we
first decide (using some pre-defined probability, for
instance 0.6) whether to actually perform the crossover
or not
Crossover result
s1` = 1111010101 s2` = 1110110101 Before crossover:
After crossover:
s1`` = 1110110101 s2`` = 1111010101
Step 3: mutations
Initial strings
s1`` =
1110110101
s2`` =
1111010101
s3`` =
1110111101
s4`` =
0111000101
s5`` =
0100011101
s6`` =
1110110011
After mutating
s1``` =
1110100101
s2``` =
1111110100
s3``` =
1110101111
s4``` =
0111000101
s5``` =
0100011101
s6``` =
1110110001
iterate
In one generation, the total population fitness changed
from 34 to 37, thus improved by ~9%
Complexity Analysis
Thanks