Package io.jenetics

Class ExponentialRankSelector<G extends Gene<?,​G>,​C extends Comparable<? super C>>

  • All Implemented Interfaces:
    Selector<G,​C>

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

    An alternative to the "weak" LinearRankSelector is to assign survival probabilities to the sorted individuals using an exponential function.

    P(i)=\left(c-1\right)\frac{c^{i-1}}{c^{N}-1},

    where c must within the range [0..1).

    A small value of c increases the probability of the best phenotypes to be selected. If c is set to zero, the selection probability of the best phenotype is set to one. The selection probability of all other phenotypes is zero. A value near one equalizes the selection probabilities.

    This selector sorts the population in descending order while calculating the selection probabilities.

    Since:
    1.0
    Version:
    5.0
    • Method Detail

      • 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>>
        Parameters:
        population - The unsorted population.
        count - The number of phenotypes to select. This parameter is not needed for most implementations.
        Returns:
        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.