Home Artificial Intelligence From Biology to Computing: An Introduction to Genetic Algorithms Background Notation & Terminology Algorithm Applications Weaknesses Summary & Thoughts References & Further Reading Connect With Me!

From Biology to Computing: An Introduction to Genetic Algorithms Background Notation & Terminology Algorithm Applications Weaknesses Summary & Thoughts References & Further Reading Connect With Me!

From Biology to Computing: An Introduction to Genetic Algorithms
Notation & Terminology
Summary & Thoughts
References & Further Reading
Connect With Me!

Photo by Warren Umoh on Unsplash

When Charles Darwin developed his within the nineteenth century little did he know that this theory would have a profound impact on computational algorithms

The ideas of natural selection, survival of the fittest, mutation, and cross-overall result in the ‘best’ variants surviving and carrying the ‘best’ traits forward. John Henry Holland took these concepts and pioneered the in 1975 to unravel mathematical optimizationproblemsThis shouldn’t be the primary time biological processes have influenced machine learning. Perhaps essentially the most notable is Frank Rosenblattdeveloping the in 1958inspired by the true neurons within the brain.

Most genetic algorithms are used to unravel problems where the is intractable resulting from the sheer magnitude of permutations and mixtures. Example include the and problems.

In the event you are a Data Scientist, chances are high you’ll come across problems like these in your profession, due to this fact it’s price understanding the right way to approach them and this post will cover probably the greatest and most typical methods. We’ll dive into the idea, methodology, and general uses of genetic algorithms to indicate how you may implement them to unravel almost any optimization problem.

Much of the terminology for genetic algorithms derive from its corresponding biological process:

  • : Mapping the issue to a conveniently numerical format for the algorithm to utilize. Common techniques include
  • A set of possible solutions.
  • A single possible solution.
  • A positional representation of 1 element within the chromosome.
  • : The worth of a Gene.
  • A rating is given to every solution to find out its ‘fitness’ to the optimization problem.

These different terms could be visually demonstrated below:

Diagram by writer.


The algorithm begins by generating an initial population for the issue. This must be adequately diverse with a variety of solutions from the possible search space with a complete number within the or ideally.


After we’ve our population, we’d like to solutions (parents) to take forward to supply offspring for the subsequent generation. The parents are chosen based on their fitness to make sure the ‘best’ genes are passed on.

Some techniques for selection are:

  • Select a certain variety of solutions in the present population with the most effective fitness function.
  • Sample from a probability distribution of the solutions (chromosomes) in the present population where each solution’s probability, , is proportional to its fitness rating, :
Equation generated by writer in LaTeX.
  • This involves choosing solutions at random and running tournaments with these subset solutions where the winner is the one with the most effective fitness rating.

There are lots of other methods for the choice process and different variants of the techniques listed above. It’s also possible to mix selection procedures to generate hybrid methods as well. There isn’t any ‘one size suits all’ and it’s best to experiment with various types.


Now that we’ve our parents, we’d like to mix their genetic material to supply offspring to generate a latest fitter population. Similarly to the choice stage, there exists sundry to perform crossover, and it is rather depending on the sort of encoding for the issue.

Let’s undergo a number of the most typical:

  • Swap the genes from a particular point on the parents’ chromosomes:
Diagram by writer.
  • Swap the genes from two chosen points on the parents’ chromosomes:
Diagram by writer.
  • Each gene is randomly chosen from the corresponding genes from the 2 parents:
Diagram by writer.

These techniques are valid for binary-encoded chromosomes and for other different encodings other operators will probably be required. There may be an incredible article linked that provides a comprehensive list of some more complex crossover operators.


The ultimate step within the algorithm is . That is analogous to where offspring can have a random alteration to its DNA. A mutation is a slight modification to the genes in an answer with a small probability. If the probability is high, then the genetic algorithm becomes a The principal motivation behind the mutation operator is to diversify the population and reduce the prospect of .

Diagram by writer.

Lets run through some easy and straightforward to use mutations:

Iterate through the genes in a chromosome and with each pass randomly flip a bit with a small probability:

Diagram by writer.
  • Select two genes, with low probability, within the chromosome and swap them:
Diagram by writer.

Linked is an extra list of mutation operators.

Similarly to crossover, the above mutation operators are valid for binary-encoded problems, due to this fact will not be appropriate for other kinds of problems and encodings.


The algorithm can end resulting from several reasons that are as much as the users’ discretion:

  • A certain variety of generations reached
  • A desired fitness is achieved
  • Computational resource exhausted
  • Fitness rating has plateaued

Genetic algorithms are utilized in an assorted range of fields, including but not limited to:

  • Scheduling in production planning
  • Vehicle routing problems
  • Financial markets and portfolio optimization
  • Training neural networks
  • Image processing

Some vulnerabilities of the genetic algorithm are:

  • Scalability shouldn’t be pretty much as good as other optimization algorithms, hence can have an extended computing time
  • Difficulty to adequately fine-tune hyperparameters similar to mutation and selection can result in non-convergence or useless results
  • Doesn’t guarantee finding the worldwide optimum, nonetheless, that is the trade-off of all meta-heuristic methods
  • An expensive and complicated fitness function also can result in long computation durations

The genetic algorithm derives its name from the analogous process in evolutionary biology. It’s a meta-heuristic optimization algorithm that starts from an initial population and iteratively uses the most effective solutions from the population to create latest and higher solutions (offspring) through the operators of selection, crossover, and mutation. It will probably be utilized in many areas similar to medicine and provide chain but can suffer from long compute times depending on the evaluation metric and the hyperparameters are chosen.

(All emojis designed by OpenMoji — the open-source emoji and icon project. License: CC BY-SA 4.0)



Please enter your comment!
Please enter your name here