# Algorithms

```Algorithms
Traditional steady state genetic algorithm used to serve as a benchmark for other variants.
Using gray code, a mutation rate Pm =1/l, and crossover Pc = 0.9. The population size is
N=60. The chromosome length will be 200 bits except f5 will be 60 bits, which consists
of 10x20 =200 bits (10x60=60 for f5) for ten function variables (dimension n=20).
Uniform crossover used and bit flip mutation.
{
initialize population;
evaluate population;
while termination condition not a achieved
{
select two parents by tournament selection;
if crossover
{
create two children by crossover the parents;
mutate children;
evaluate children;
delete the worst two chromosomes in the population;
}
else
{
create two children by mutate the parents;
evaluate children;
delete the worst two chromosomes in the population;
}
}
}
Self-adaptive crossover, mutation, and population size of genetic algorithm
Self-adaptive mutation rate is encoded in extra bits at the end of each chromosome, and
the same for crossover as well. The crossover bits and mutation bits go under crossover
and mutation as the variable function bits. Back [] followed Arabas [] method to selfadapt population size. Arabas proposed to assign remaining life time (RLT) for each
chromosome in the population based on its fitness. The RLT determines how many
generations that chromosome should live before it is destroyed.
Self-Adaptive Crossover Mutation Population Size Genetic Algorithm ()
{
chromosome structure = variables bits + mutation bits + crossover bits;
initialize population;
evaluate population;
evaluate the life time of the chromosomes in the population;
while termination condition not achieved
{
select two parents by tournament selection;
crossover rate one = decode crossover bits of the first parents;
crossover rate two = decode crossover bits of the second parents;
if crossover one &amp;&amp; crossover two
{
create two children’s by crossover the parents;
mutate children’s()
{
value = decode the mutation bits;
mutate the mutation bits only on base of value ;
mutation rate = decode the mutation bits;
mutate chromosome bits on base of mutation rate;
evaluate children’s;
}
next round select two parents;
}
else if crossover one &amp;&amp; ! crossover two
{
hold parents one to the next round;
next round select one parents;
create child by mutate second parents ();
evaluate child;
}
else if crossover two &amp;&amp; ! crossover one
{
hold parents two to the next round;
next round select one parents;
create child by mutate first parents ();
evaluate child;
}
else
{
create two children’s by mutate parents();
evaluate children’s;
next round select two parents;
}
decrement the life time of the old members of the population;
evaluate the life time of the children’s;
}
}
Adaptive Genetic Algorithm by Reproduction and Competition
Parameters are determined by the reproduction and competition rules among
Cp
chromosomes. There is a meeting probability Pm 
“ C p , M p current population
Mp
size and maximum population size respectively” control the reproduction and
monoreproduction.
Adaptive Genetic Algorithm by Reproduction and Competition ()
{
initialize population;
evaluate population;
while termination condition not achieved
{
for i=1 to population size
{
select i chromosome as first parents;
randomly select second parents;
calculate meeting probability;
if meeting
{
if reproduction
{
bisexual reproduction()
{
create two children’s by crossover;
evaluate children’s;
}
}
else
fight()
the weaker is removed from population
}
else
{
monosexual reproduction()
{
create child by mutation;
evaluate child;
}
}
}
}
}
Adaptive population size of genetic algorithm
The idea of lobo is to establish a race among populations of various sizes. Lobo gives
priority to the smaller population by giving them more function evaluations. When the
smaller population starts to drift too much it will be cached by the larger one, and then
the smaller population is destroyed.
Adaptive Population Size of Genetic Algorithm()
{
initialize population with small size;
evaluate population;
initialize base 4 counter;
while termination condition not achieved
{
increment base 4 counter;
monitor the position of the most significant digit
of base 4 counter that change during the increment;
if population of position not created yet
{
create population of position with size equal
the double size of the population of position-1;
run population of position()
{
select chromosome for next population;
perform crossover and mutation;
evaluate population;
}
}
else
{
run population of position()
{
select chromosome for next population;
perform crossover and mutation;
evaluate population;
}
}
if average population of larger size greater than smaller one
{
destroyed the smaller one;
reset the base 4counter;
}
}
}
Deterministic mutation rate of genetic algorithm
The mutation rate controlled by a formula depends on the number of generations and the
1
l2 

.t  ”l, t, and T are the chromosome’s length,
chromosome’s length. Pm   2 
T 1 

current generations, and maximum number of generations respectively”.
Genetic Algorithm With Deterministic Mutation ()
{
initialize population;
evaluate population;
while termination condition not achieved
{
select one parents by tournament selection;
calculate mutation rate in base of deterministic formula;
create child by mutate parent;
evaluate child;
delete the worst chromosome in population;