Skip to content
Tutorials Center
My learning

Topics

Lesson 12 of 36 ยท Selection

Rank, Truncation and Boltzmann Selection

Learn rank-based, truncation and Boltzmann selection, plus fitness scaling (windowing, sigma scaling), to control selection pressure independent of raw fitness values.

Roulette selection breaks when fitness values are skewed, huge or offset. Tournament selection fixes that by comparing only. This lesson covers other methods that also care about order, not magnitude: rank selection and truncation selection. It also covers the older repair kit for roulette, fitness scaling, and Boltzmann selection, which makes pressure change over the run.

Rank selection

Instead of using fitness itself, sort the population from worst to best and assign each individual a rank 1..N (best = N). Then run a roulette wheel on the ranks. A fitness of 1,000,000 versus 3 no longer matters, only the order does.

Linear ranking gives individual with rank i the probability

p_i = (2 - s)/N + 2 * i * (s - 1) / (N * (N - 1))

where s is the selection pressure parameter between 1.0 (everyone equal) and 2.0 (best individual is expected to get twice the average number of children, the worst none). A simpler version sets the weights directly to the ranks.

Python Rank-based versus fitness-proportional probabilities

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Under proportional selection the first three individuals have almost no chance (under 0.2 % each), and the last two share everything. Under ranking each keeps a reasonable probability, and the best is only moderately favored. Rank selection therefore prevents domination by a super-individual and keeps pressure steady late in a run, when fitness values bunch up. The cost is sorting (O(N log N)) and the loss of information: a hugely better individual gets no extra credit than a slightly better one.

Truncation selection

Truncation selection is the bluntest method: sort, keep the top fraction T (for example 50 %), and choose parents uniformly from that group. Anyone below the cut gets zero chance.

It is typical in:

  • Evolution strategies (the (mu, lambda) scheme keeps the best mu of lambda children),
  • Breeding programs (breed the top 20 % of a herd),
  • Large-scale searches where simplicity and speed matter.

The truncation threshold T is the pressure knob: smaller T is stronger. Very small T collapses diversity quickly.

Python Truncation selection and diversity

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With a weak cut (80 %) progress is slow, with a strong cut (5 %) the best fitness is reached fast but only a handful of distinct individuals remain, which is the diversity cost of strong pressure.

Fitness scaling

Before comparison-based methods were popular, designers repaired roulette selection by scaling raw fitness before the wheel. Scaling changes the numbers, not the ordering.

  • Windowing: subtract the minimum (or a rolling minimum over a few generations) from every fitness: f' = f - f_min. Removes constant offsets so differences matter again.
  • Linear scaling: f' = a * f + b, with a and b chosen so the average is unchanged and the best gets, say, 2 times the average.
  • Sigma scaling: f' = max(0, f - (mean - c * sigma)) with c about 2, using the standard deviation sigma. Handles varying spread in the population.
  • Power law scaling: f' = f ** k for a constant k, raising or lowering pressure.
Python Windowing and sigma scaling rescue roulette

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Windowing alone gives the worst individual a probability of exactly zero. Sigma scaling is gentler. In modern practice most people skip scaling and use tournaments or ranks.

Boltzmann selection

Boltzmann selection borrows from simulated annealing. Probability is proportional to exp(f / T), where the temperature T starts high (almost uniform choice, explore) and falls during the run (strong preference for the best, exploit). The schedule T(g) acts as a built-in way to raise the pressure over time.

Python Boltzmann probabilities cool down

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

At T = 10 all four are nearly equally likely; at T = 0.3 the best individual is chosen almost every time.

Methods that ignore raw scale

Tournament Best of k at random
Rank Wheel on the ranks
Truncation Top fraction only
Boltzmann Cooling temperature

Order matters more than the exact numbers.

1 / 2

Which to choose?

  • Default: tournament of size 2 to 5.
  • Values with wild or shifting scale and you want smooth pressure: linear rank.
  • Real-valued ES-style search or breeding-like setups: truncation.
  • You want pressure to rise during a run: Boltzmann or a growing tournament size.
  • If you must use roulette: SUS with fitness scaling.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does rank selection use to compute selection probabilities?

    Probabilities are assigned by rank, so a huge fitness gap and a tiny one lead to the same selection probabilities.
  2. 2. In truncation selection with threshold T = 0.2, which individuals can be parents?

    Truncation keeps just the top fraction T and chooses parents uniformly from it.
  3. 3. What does windowing (subtracting the minimum fitness) fix?

    Removing the offset restores the ratios between individuals, so the wheel's slices reflect real differences.
  4. 4. In Boltzmann selection, what happens as the temperature T decreases?

    exp(f / T) grows sharply with f as T falls, so the best individuals take nearly all the probability.

Summary

  • Rank selection uses sorted positions, so it resists skewed or offset fitness and keeps steady pressure.
  • Truncation selection keeps the top fraction T; smaller T is stronger and loses diversity faster.
  • Scaling methods (windowing, linear, sigma, power law) repair proportional selection.
  • Boltzmann selection raises pressure over time through a cooling temperature.
  • Prefer tournament or rank selection unless you have a reason not to.

Next: Selection Pressure and Elitism