public class TournamentSelection extends Object implements SelectionPolicy
arity
random
chromosomes without replacement from the population, and then selecting the
fittest chromosome among them.Constructor and Description |
---|
TournamentSelection(int arityIn)
Creates a new TournamentSelection instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getArity()
Gets the arity (number of chromosomes drawn to the tournament).
|
ChromosomePair |
select(Population population)
Select two chromosomes from the population.
|
void |
setArity(int arityIn)
Sets the arity (number of chromosomes drawn to the tournament).
|
public TournamentSelection(int arityIn)
arityIn
- how many chromosomes will be drawn to the tournamentpublic ChromosomePair select(Population population)
arity
random chromosomes without replacement from the
population, and then selecting the fittest chromosome among them.select
in interface SelectionPolicy
population
- the population from which the chromosomes are chosen.MathIllegalArgumentException
- if the tournament arity is bigger than the population sizepublic int getArity()
public void setArity(int arityIn)
arityIn
- arity of the tournamentCopyright © 2021 CNES. All rights reserved.