Evolutionary Algorithms

Genetic Algorithm

A genetic algorithm is a class of Evolutionary Algorithms.

Darwininian Natural Selection

  1. Heredity: Children receive the properties of their parents
  2. Variation: Variety of traits present in the population or a means with which to introduce variation
  3. Selection (survival of the fittest)

Steps for Code

Step 1: Initialize. Create a population of N elements, each with randomly generated DNA. LOOP:

  • Step 2: Selection. Evaluate the fitness of each element of the population and build a mating pool.
  • Step 3: Reproduction. Repeat N times:
    • a) Pick two parents with probability according to relative fitness.
    • b) Crossover—create a “child” by combining the DNA of these two parents.
    • c) Mutation—mutate the child’s DNA based on a given probability.
    • d) Add the new child to a new population.
  • Step 4. Replace the old population with the new population and return to Step 2.

Algorithms