1. Overview

In this tutorial, we’ll study the roulette wheel selection method for genetic algorithms.

2. Genetic Algorithms

The selection of chromosomes for recombination is a mandatory step in a genetic algorithm. The latter is, in turn, an algorithm that’s inspired though not reducible to the evolutionary process of biological species.

Genetic algorithms find important applications in machine learning. For example, we use them in the selection of policies in reinforcement learning. But also, in the optimization of parameters for deep learning, in the subset sum problem, in pathfinding, or, in general, in the solution to many search problems in reasoning and learning.

The real-world problems that they help solve span from the discovery of new materials to the identification of biomarkers in computational biology. But also, the disease screening and drug discovery in medicine. Therefore, they’re important tools in the toolbox of any data scientist.

For genetic algorithms to work as intended, it’s necessary however to solve the related problem of recombination between chromosomes first.

3. Recombination

A typical definition of a chromosome considers it as a fixed-length array that contains a binary variable:

Rendered by QuickLaTeX.com

Each bit of the variable then maps to a parameter or characteristic of some type. In this manner, we can describe an individual possessing a finite set of binary characteristics exclusively in terms of a chromosome. The chromosome, then, allows the representation of a population that contains as many as 2^n different types of individuals.

This lets us represent complex agents composed of multiple subsystems. In the case of policies for reinforcement learning, for example, the chromosome normally corresponds to either the agent’s perceptual system, or its movement controller, or both.

All individuals, each with their own chromosome, start to operate in the environment. As they do, each receives a measure of fitness f_i, according to its performances. Then, after we compute the fitness for all individuals in a population, we proceed with the recombination phase.

During this phase, we select some individuals to act as parents. These parents, in turn, mix their chromosomes according to a procedure called crossover or recombination.

4. Selecting by Fitness

We thus need a method for identifying the parents whose chromosome we subject to recombination:


This method needs to use the fitness of individuals in the population. Or otherwise, there’s no learning between one generation and the next.

There are two main categories of methods for using fitness in order to support selection:

  • deterministic methods
  • stochastic methods

Deterministic methods involve, for example, the selection of the \boldsymbol{n}-most fit individuals in a population for recombination. They’re generally discredited because they tend to develop a population that reaches a local maximum and then stops evolving.

Alternatively, we can also use stochastic methods for selecting parents. The most extreme of these methods select individuals randomly with uniform probability, and thus completely disregards their individual fitness.

A good middle way, instead, is the roulette wheel selection, which creates a discrete probability distribution from which we identify the chromosomes for crossover.

5. Principles of Roulette Selection

Roulette selection is a stochastic selection method, where the probability for selection of an individual is proportional to its fitness. The method is inspired by real-world roulettes but possesses important distinctions from them. As we know from the movies on casinos and gamblings, roulettes always have slots with the same size:

roulette 1

That means, however, that all slots have the same probability of being selected. Instead, we can implement a weighted version of the roulette. With it, the larger the fitness of an individual is, the more likely is its selection:


The first component of the roulette selection method is, therefore, that individual fitness is proportional to its likelihood of selection.

This isn’t sufficient though. This is because, if the population has n individuals, then the summation of probabilities \sum_{i=1}^n p_i of their selections equals one. As a consequence, we have to also normalize all values for the individual probabilities to the interval [0,1].

6. Roulette Wheel Selection

Finally, we can sum up the considerations made above and develop a method that satisfies the requirements we set.

In a population with n individuals, for each chromosome x with a corresponding fitness value f_x, we compute the corresponding probability p_x of selection as:

p_x = \frac {f_x} {\sum_{i=1}^{n} f_i}

We can then simply treat the probability distribution P = \{p_1, p_2, ..., p_n\} as the one from which we sample the parents we choose for recombination.

7. Conclusion

In this article, we studied how to perform roulette selection for genetic algorithms.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.