Questions related to teaching genetic or evolutionary algorithms. Genetic algorithms are algorithms based upon Darwin's theory of evolution. They are used to find a good solution from an evolving population of solutions.

Genetic Algorithms use Darwin's theory of evolution to model a solution to a problem, then combine solutions in a population of solutions in order to find the most fitting solution.

The main points of Genetic Algorithms are:

  • Individual: a representation of a solution to a problem. The representation can be expressed as a binary sequence (known as genes). Individuals have a fitness which is a set of rules\requirements predefined by the programmer. The fitness is a measure of how good the solution is.
  • Population: a collection (with fixed size) of individuals. Initialized randomly.
  • Mutation and Crossover: An individual's genes can be slightly modified with a small probability, thus mutating the individual. Crossover is the process of combining the genes of two individuals (there are multiple ways to perform Mutation and Crossover).

The algorithm is iterative, and in each iteration, the fitness of individuals in the population is calculated and the most fitting solutions are selected, and perform a Crossover. After this, a new population is generated, and the average (and overall) fitness is greater than that of the previous population.

More explanation and an implementation in Java can be found here.

A visualization can be seen here