public class TournamentSelection extends java.lang.Object implements SelectionOperator, java.io.Serializable
| Constructor and Description |
|---|
TournamentSelection(EvolutionaryAlgorithm theTrainer,
int theRounds)
Construct a tournament selection.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getRounds() |
EvolutionaryAlgorithm |
getTrainer() |
int |
performAntiSelection(java.util.Random rnd,
Species species)
Selects an unfit genome.
|
int |
performSelection(java.util.Random rnd,
Species species)
Selects an fit genome.
|
void |
setRounds(int rounds)
Set the number of rounds.
|
void |
setTrainer(EvolutionaryAlgorithm trainer)
Set the trainer.
|
public TournamentSelection(EvolutionaryAlgorithm theTrainer, int theRounds)
theTrainer - The trainer.theRounds - The number of rounds to use.public int getRounds()
public EvolutionaryAlgorithm getTrainer()
getTrainer in interface SelectionOperatorpublic int performAntiSelection(java.util.Random rnd,
Species species)
performAntiSelection in interface SelectionOperatorrnd - A random number generator.species - The species to select the genome from.public int performSelection(java.util.Random rnd,
Species species)
performSelection in interface SelectionOperatorrnd - A random number generator.species - The species to select the genome from.public void setRounds(int rounds)
rounds - The number of rounds.public void setTrainer(EvolutionaryAlgorithm trainer)
trainer - The trainer.