Class CrossoverPermutationBucket

  • All Implemented Interfaces:
    org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.PermutationGenotype<?>>, Crossover<org.opt4j.core.genotype.PermutationGenotype<?>>, CrossoverPermutation

    public class CrossoverPermutationBucket
    extends java.lang.Object
    implements CrossoverPermutation

    Crossover for the PermutationGenotype.

    The bucket operator randomly runs through to permutation from the beginning to the end, and fill the current element into the new permutation if not existent.

    Given two permutations

    1 2 3 4 5 6 7 8 and 8 7 6 5 4 3 2 1

    this results, for instance, in

    1 8 2 7 3 6 4 5 or 8 7 1 2 3 6 5 4.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Random random  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Pair<org.opt4j.core.genotype.PermutationGenotype<?>> crossover​(org.opt4j.core.genotype.PermutationGenotype<?> p1, org.opt4j.core.genotype.PermutationGenotype<?> p2)
      Performs a crossover for two Genotype parents.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • random

        protected final java.util.Random random
    • Constructor Detail

      • CrossoverPermutationBucket

        @Inject
        public CrossoverPermutationBucket​(org.opt4j.core.common.random.Rand random)
        Constructs a new CrossoverPermutationBucket.
        Parameters:
        random - the random number generator
    • Method Detail

      • crossover

        public Pair<org.opt4j.core.genotype.PermutationGenotype<?>> crossover​(org.opt4j.core.genotype.PermutationGenotype<?> p1,
                                                                              org.opt4j.core.genotype.PermutationGenotype<?> p2)
        Description copied from interface: Crossover
        Performs a crossover for two Genotype parents. The resulting pair of Genotype offspring is returned.
        Specified by:
        crossover in interface Crossover<org.opt4j.core.genotype.PermutationGenotype<?>>
        Parameters:
        p1 - The first parent genotype for the crossover
        p2 - The second parents genotype for the crossover
        Returns:
        The resulting pair of offspring genotypes