Class TournamentSelection

  • All Implemented Interfaces:
    SelectionFunction

    public class TournamentSelection
    extends java.lang.Object
    implements SelectionFunction
    Tournament Selection chooses the best organisms from n random subsets of a given population. Currently it assumes a maximization problem. Perhaps this could be selected depending on the Genetic Algorithm utilized.
    Author:
    Susanne Merz
    • Constructor Detail

      • TournamentSelection

        public TournamentSelection()
        Default constructor: sets the selection pressure to the value of 10.
    • Method Detail

      • setSelectionPressure

        public void setSelectionPressure​(int numberOfIndividuals)
        sets the parameter controlling selection pressure
        Parameters:
        numberOfIndividuals - the number of Individuals the best is selected from, ranges from 1 (random selection) to the size of the population (elitism)
      • selectNIndividuals

        public Population selectNIndividuals​(Population pop,
                                             GeneticAlgorithm ga,
                                             int n)
        This method selects n Organism from the population it is given, using the tournament selection method
        Parameters:
        pop - the population to select from
        ga - the GeneticAlgorithm this selection belongs to
        n - number of individuals to be selected.
        Returns:
        nextgen a Population containing the selected Organisms