Class SplitEvolution<T>

  • Type Parameters:
    T - The type of evolved entity dealt with by this operator.
    All Implemented Interfaces:
    EvolutionaryOperator<T>

    public class SplitEvolution<T>
    extends Object
    implements EvolutionaryOperator<T>

    Compound evolutionary operator that allows the evolution of a population to be split into two separate streams. A percentage of the population will be evolved according to one specified operator and the remainder according to another operator. When both streams have been executed, the resulting offspring will be returned as a single combined population.

    This kind of separation is common in a genetic programming context where, for example, 10% of the population is mutated and the remaining 90% undergoes cross-over independently.

    To split evolution into more than two streams, multiple SplitEvolution operators can be combined. By combining SplitEvolution operators with EvolutionPipeline operators, elaborate evolutionary schemes can be constructed.

    • Constructor Detail

      • SplitEvolution

        public SplitEvolution​(EvolutionaryOperator<T> operator1,
                              EvolutionaryOperator<T> operator2,
                              double weight)
        Parameters:
        operator1 - The operator that will apply to the first part of the population (as determined by the weight parameter).
        operator2 - The operator that will apply to the second part of the population (as determined by the weight parameter).
        weight - The proportion (as a real number between zero and 1 exclusive) of the population that will be evolved by operator1. The remainder will be evolved by operator2.
      • SplitEvolution

        public SplitEvolution​(EvolutionaryOperator<T> operator1,
                              EvolutionaryOperator<T> operator2,
                              NumberGenerator<Double> weightVariable)
        Parameters:
        operator1 - The operator that will apply to the first part of the population (as determined by the weightVariable parameter).
        operator2 - The operator that will apply to the second part of the population (as determined by the weightVariable parameter).
        weightVariable - A random variable that provides the ratio for dividing the population between the two evolutionary streams. Must only generate values in the range 0 < ratio < 1.
    • Method Detail

      • apply

        public List<T> apply​(List<T> selectedCandidates,
                             Random rng)
        Applies one evolutionary operator to part of the population and another to the remainder. Returns a list combining the output of both. Which candidates are submitted to which stream is determined randomly.
        Specified by:
        apply in interface EvolutionaryOperator<T>
        Parameters:
        selectedCandidates - A list of the candidates that survived to be eligible for evolution.
        rng - A source of randomness passed to each of the two delegate evolutionary operators.
        Returns:
        The combined results from the two streams of evolution.