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

  • 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 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 :

    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.


    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    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.