The central idea in running of a genetic algorithm is that it would start off with a randomly selected population of candidate solutions to a problem. Let us call each one of the members of such a population as an individual. Although the individual may also be called as a genome, member or a candidate solution depending upon the jargon.The algorithm checks each of the individuals for its suitability to solve the given problem and assigns it a rank accordingly. Just as it is expected to happen in Darwinian natural selection, the individuals that have better ranks are supposed to stand better chances at giving rise to progeny. To this end, the algorithm iteratively selects individuals from the population according to their ranks and creates new offspring accordingly. Offspring is created by applying genetic operators. Normally these are crossover and mutation. When the desired number of offspring individuals are produced the algorithm starts over again in evaluating the individuals of the newly formed population and ranking them and so on. This process of creating, evaluating and ranking newer populations keeps on going until the desired solution to the problem at hand is found. The algorithm stops at this stage. Following is a pseudo-code of a typical genetic algorithm:
- Create an initial population of individuals of size n.
- Evaluate each individual on the given problem and assign it a rank R.
- Randomly choose pairs of individuals as some function of R.
- Apply genetic operators of crossover and mutation on the chosen individuals to form a pair of offspring.
- Repeat step 4 until a new population is formed.
- Go to step 2 and keep repeating till this point until the desired solution is found.
Psyops by PsyopsPrime is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Based on a work at http://www.psyops.tk/.
Permissions beyond the scope of this license may be available at http://www.psyops.tk/.