Encoding Methods in Genetic Algorithm
Biological Background :
Chromosome : All living organisms consists of cells. In each cell there is a same set of Chromosomes. Chromosomes are strings of DNA and consists of genes, blocks of DNA. Each gene encodes a trait, for example color of eyes.
Reproduction : During reproduction, combination (or crossover) occurs first. Genes from parents combine to form a whole new chromosome. The newly created offspring can then be mutated. The changes are mainly caused by errors in copying genes from parents. The fitness of an organism is measured by the success of the organism in its life.
Operation of Genetic Algorithms :
Two important elements required for any problem before a genetic algorithm can be used for a solution are
Basic principles :
Algorithmic Phases :

Simple_Genetic_Algorithm()
{
Initialize the population;
Calculate Fitness Function;
while(Fitness Value != Optimal Value)
{
Selection; //Natural Selection, survival of fittest
Crossover; //Reproduction, propagate favorable characteristics
Mutation;
Calculate Fitness Funtion;
}
}
Encoding using string :
Encoding of chromosomes is the first step in solving the problem and it depends entirely on the problem heavily. The process of representing the solution in the form of a string of bits that conveys the necessary information. just as in a chromosome, each gene controls a particular characteristics of the individual, similarly, each bit in the string represents a characteristics of the solution.
Encoding Methods :
- Binary Encoding : Most common methods of encoding. Chromosomes are string of 1s and 0s and each position in the chromosome represents a particular characteristics of the problem.

- Permutation Encoding : Useful in ordering such as the Travelling Salesman Problem (TSP). In TSP, every chromosome is a string of numbers, each of which represents a city to be visited.

- Value Encoding : Used in problems where complicated values, such as real numbers, are used and where binary encoding would not suffice. Good for some problems, nut often necessary to develop some specific crossover and mutation techniques for these chromosomes.

Recommended Posts:
- Crossover in Genetic Algorithm
- Python | Single Point Crossover in Genetic Algorithm
- Genetic Algorithm for Reinforcement Learning : Python implementation
- ML | One Hot Encoding of datasets in Python
- ML | Label Encoding of datasets in Python
- Introduction to Resampling methods
- ML | K-means++ Algorithm
- ML | ECLAT Algorithm
- ML | Expectation-Maximization Algorithm
- Different Types of Clustering Algorithm
- Inductive Learning Algorithm
- Gradient Descent algorithm and its variants
- Facebook News Feed Algorithm
- k-nearest neighbor algorithm in Python
- ML | Frequent Pattern Growth Algorithm
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

