Class AbstractGeneticAlgorithm<S,Result>

java.lang.Object
org.uma.jmetal.algorithm.impl.AbstractEvolutionaryAlgorithm<S,Result>
org.uma.jmetal.algorithm.impl.AbstractGeneticAlgorithm<S,Result>
All Implemented Interfaces:
Serializable, Runnable, Algorithm<Result>

public abstract class AbstractGeneticAlgorithm<S,Result> extends AbstractEvolutionaryAlgorithm<S,Result>
Abstract class representing a genetic algorithm
Author:
Antonio J. Nebro <antonio@lcc.uma.es>
See Also:
  • Field Details

  • Constructor Details

    • AbstractGeneticAlgorithm

      public AbstractGeneticAlgorithm(Problem<S> problem)
      Constructor
      Parameters:
      problem - The problem to solve
  • Method Details

    • setMaxPopulationSize

      public void setMaxPopulationSize(int maxPopulationSize)
    • getMaxPopulationSize

      public int getMaxPopulationSize()
    • getSelectionOperator

      public SelectionOperator<List<S>,S> getSelectionOperator()
    • getCrossoverOperator

      public CrossoverOperator<S> getCrossoverOperator()
    • getMutationOperator

      public MutationOperator<S> getMutationOperator()
    • createInitialPopulation

      protected List<S> createInitialPopulation()
      This method implements a default scheme create the initial population of genetic algorithm
      Specified by:
      createInitialPopulation in class AbstractEvolutionaryAlgorithm<S,Result>
      Returns:
    • selection

      protected List<S> selection(List<S> population)
      This method iteratively applies a SelectionOperator to the population to fill the mating pool population.
      Specified by:
      selection in class AbstractEvolutionaryAlgorithm<S,Result>
      Parameters:
      population -
      Returns:
      The mating pool population
    • reproduction

      protected List<S> reproduction(List<S> population)
      This method iteratively applies a CrossoverOperator a MutationOperator to the population to create the offspring population. The population size must be divisible by the number of parents required by the CrossoverOperator; this way, the needed parents are taken sequentially from the population. No limits are imposed to the number of solutions returned by the CrossoverOperator.
      Specified by:
      reproduction in class AbstractEvolutionaryAlgorithm<S,Result>
      Parameters:
      population -
      Returns:
      The new created offspring population
    • checkNumberOfParents

      protected void checkNumberOfParents(List<S> population, int numberOfParentsForCrossover)
      A crossover operator is applied to a number of parents, and it assumed that the population contains a valid number of solutions. This method checks that.
      Parameters:
      population -
      numberOfParentsForCrossover -