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 arity)
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 arity)
Sets the arity (number of chromosomes drawn to the tournament).
|
public TournamentSelection(int arity)
arity
- how many chromosomes will be drawn to the tournamentpublic ChromosomePair select(Population population) throws MathIllegalArgumentException
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 arity)
arity
- arity of the tournamentCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.