Package io.jenetics

Class LinearRankSelector<G extends Gene<?,G>,C extends Comparable<? super C>>

All Implemented Interfaces:

public final class LinearRankSelector<G extends Gene<?,G>,C extends Comparable<? super C>> extends ProbabilitySelector<G,C>

In linear-ranking selection the individuals are sorted according to their fitness values. The rank N is assignee to the best individual and the rank 1 to the worst individual. The selection probability P(i) of individual i is linearly assigned to the individuals according to their rank.


Here n-/N is the probability of the worst individual to be selected and n+/N the probability of the best individual to be selected. As the population size is held constant, the conditions n+ = 2 - n- and n- >= 0 must be fulfilled. Note that all individuals get a different rank, i.e., a different selection probability, even if the have the same fitness value.

T. Blickle, L. Thiele, A comparison of selection schemes used in evolutionary algorithms, Technical Report, ETH Zurich, 1997, page 37.

  • Constructor Details

    • LinearRankSelector

      public LinearRankSelector(double nminus)
      Create a new LinearRankSelector with the given values for nminus.
      nminus - nminus/N is the probability of the worst phenotype to be selected.
      IllegalArgumentException - if nminus < 0.
    • LinearRankSelector

      Create a new LinearRankSelector with nminus := 0.5.
  • Method Details

    • probabilities

      protected double[] probabilities(Seq<Phenotype<G,C>> population, int count)
      This method sorts the population in descending order while calculating the selection probabilities.
      Specified by:
      probabilities in class ProbabilitySelector<G extends Gene<?,G>,C extends Comparable<? super C>>
      population - The unsorted population.
      count - The number of phenotypes to select. This parameter is not needed for most implementations.
      Probability array. The returned probability array must have the length population.size() and must sum to one. The returned value is checked with assert(Math.abs(math.sum(probabilities) - 1.0) < 0.0001) in the base class.
    • toString

      public String toString()
      toString in class Object