public abstract class AbstractGeneticAlgorithm<S,Result> extends AbstractEvolutionaryAlgorithm<S,Result>
| Modifier and Type | Field and Description |
|---|---|
protected CrossoverOperator<S> |
crossoverOperator |
protected int |
maxPopulationSize |
protected MutationOperator<S> |
mutationOperator |
protected SelectionOperator<List<S>,S> |
selectionOperator |
population, problem| Constructor and Description |
|---|
AbstractGeneticAlgorithm(Problem<S> problem)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
protected List<S> |
createInitialPopulation()
This method implements a default scheme create the initial population of genetic algorithm
|
CrossoverOperator<S> |
getCrossoverOperator() |
int |
getMaxPopulationSize() |
MutationOperator<S> |
getMutationOperator() |
SelectionOperator<List<S>,S> |
getSelectionOperator() |
protected List<S> |
reproduction(List<S> population)
This methods iteratively applies a
CrossoverOperator a MutationOperator to the population to
create the offspring population. |
protected List<S> |
selection(List<S> population)
This method iteratively applies a
SelectionOperator to the population to fill the mating pool population. |
void |
setMaxPopulationSize(int maxPopulationSize) |
evaluatePopulation, getPopulation, getProblem, getResult, initProgress, isStoppingConditionReached, replacement, run, setPopulation, setProblem, updateProgressclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDescription, getNameprotected int maxPopulationSize
protected SelectionOperator<List<S>,S> selectionOperator
protected CrossoverOperator<S> crossoverOperator
protected MutationOperator<S> mutationOperator
public void setMaxPopulationSize(int maxPopulationSize)
public int getMaxPopulationSize()
public SelectionOperator<List<S>,S> getSelectionOperator()
public CrossoverOperator<S> getCrossoverOperator()
public MutationOperator<S> getMutationOperator()
protected List<S> createInitialPopulation()
createInitialPopulation in class AbstractEvolutionaryAlgorithm<S,Result>protected List<S> selection(List<S> population)
SelectionOperator to the population to fill the mating pool population.selection in class AbstractEvolutionaryAlgorithm<S,Result>population - protected List<S> reproduction(List<S> population)
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.reproduction in class AbstractEvolutionaryAlgorithm<S,Result>population - protected void checkNumberOfParents(List<S> population, int numberOfParentsForCrossover)
population - numberOfParentsForCrossover - Copyright © 2018. All rights reserved.