Open In App

Encoding Methods in Genetic Algorithm

Last Updated : 05 Jan, 2023
Like Article

Biological Background :

Chromosome: All living organisms consist of cells. In each cell, there is the same set of Chromosomes. Chromosomes are strings of DNA and consist of genes, blocks of DNA. Each gene encodes a trait, for example, the color of the eye. 
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 

  • Method for representing a solution ex: a string of bits, numbers, character ex: determination total weight.
  • Method for measuring the quality of any proposed solution, using a fitness function.

Basic principles :

  • An individual is characterized by a set of parameters: Genes
  • The genes are joined into a string: Chromosome
  • The chromosome forms the genotype
  • The genotype contains all information to construct an organism: Phenotype
  • Reproduction is a “dumb” process on the chromosome of the genotype 
  • Fitness is measured in the real world (‘Struggle for life’) of the phenotype.

Algorithmic Phases : 

     Initialize the population;
     Calculate Fitness Function;

     while(Fitness Value != Optimal Value)
          Selection;  //Natural Selection, survival of fittest
          Crossover;  //Reproduction, propagate favorable characteristics
          Calculate Fitness Function;

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 particular characteristics of the individual, similarly, each bit in the string represents 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 solution. 

  • 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, but often necessary to develop some specific crossover and mutation techniques for these chromosomes. 

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads