org.encog.ml.ea.opp.selection
public class TournamentSelection extends Object implements SelectionOperator, 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(Random rnd,
Species species)
Selects an unfit genome.
|
int |
performSelection(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 SelectionOperator
public int performAntiSelection(Random rnd, Species species)
performAntiSelection
in interface SelectionOperator
rnd
- A random number generator.species
- The species to select the genome from.public int performSelection(Random rnd, Species species)
performSelection
in interface SelectionOperator
rnd
- 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.Copyright © 2014. All Rights Reserved.