Skip to content

Genetic Algorithm

What's Genetic Algorithm?

Genetic algorithm is based on natural selection theory, that the fittest individuals will survive and they are selected for reproduction.

Each optimization pass is considered as an individual, and their fitness score is used to determine how fit they are against other individuals (optimization passes).

The algorithm uses two of the most fit optimization passes to create a new pass, the new pass parameters will be a combination of the parent passes.

Genetic Algorithm needs an initial population to work, for that optimizer will run several different passes with randomized parameters to create the initial population for the algorithm.

After creation of the initial population the genetic algorithm starts it's process of finding the fittest optimization passes until the fitness score of child passes start stagnating and converging, then it's stopped.

Genetic Algorithm Stages

Genetic Algorithm is a recursive algorithm that has three different stages:


In this stage the algorithm finds two fittest optimization passes, it uses the fitness score for that.


After finding the top two fittest optimization passes algorithm uses them to create new offspring passes, by using combination of both parent passes parameter values.


If your cBot has 4 different parameters for optimization, it gets the values of first and second parameters of offspring from one parent and the third and fourth parameters from the second parent.


In this stage the algorithm mutates the offspring passes parameter values, by changing the values of one or more parameters randomly.

After mutation stage optimizer will run the new offspring optimization pass, and then it repeats the whole stages if the offspring fitness score was better that the last fittest optimization pass, otherwise it will increase the stagnation counter.

If stagnation counter reached the value of algorithm Stagnation Period parameter value then the optimization process will be stopped.

If the offspring optimization pass fitness score was better than the last fittest pass then it means there can be more room for improvement and the optimization will continue by repeating the above three stages.

Genetic Algorithm Parameters

Genetic Algorithm have several parameters that it uses during it's lifetime.

The Genetic Algorithm Parameters are not predefined, but in future we might consider to allow you change their values.

Population Size

The maximum size of a population/generation or the maximum number of individuals (passes) on each optimization iteration.

Max Iterations Count

The maximum number of optimization iterations/generations that will be performed.

Stagnation Period

The maximum value that algorithm will tolerate stagnation before stopping the optimization process.

Elite Percentage

This value will be used to select x% of individuals with highest fitness score from current iteration as survivors to next iteration generation.

Tournament Size Percentage

This value will be used to select x% of individuals from an iteration for finding parents.

Migrans Percentage

This value will be used to add x% of randomly created individuals/passes on each new iteration/generation population.

Mutation Percentage

This is the percentage of offspring individual parameters that will be mutated.

Mutation Probability Percentage

Percentage of offspring's that will be mutated, others will not go through mutation stage after crossover.

Last update: June 26, 2022