public class TournamentSelector<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object implements Selector<G,C>
Constructor and Description |
---|
TournamentSelector()
Create a tournament selector with sample size two.
|
TournamentSelector(int sampleSize)
Create a tournament selector with the give sample size.
|
Modifier and Type | Method and Description |
---|---|
int |
getSampleSize()
Return the sample size of the tournament selector.
|
ISeq<Phenotype<G,C>> |
select(Seq<Phenotype<G,C>> population,
int count,
Optimize opt)
Select phenotypes from the Population.
|
String |
toString() |
public TournamentSelector(int sampleSize)
sampleSize
- the number of individuals involved in one tournamentIllegalArgumentException
- if the sample size is smaller than two.public TournamentSelector()
public int getSampleSize()
public ISeq<Phenotype<G,C>> select(Seq<Phenotype<G,C>> population, int count, Optimize opt)
Selector
select
in interface Selector<G extends Gene<?,G>,C extends Comparable<? super C>>
population
- The population to select from.count
- The number of phenotypes to select.opt
- Determines whether the individuals with higher fitness values
or lower fitness values must be selected. This parameter determines
whether the GA maximizes or minimizes the fitness function.© 2007-2019 Franz Wilhelmstötter (2019-06-23 15:39)