org.encog.ml.ea.opp.selection
Class TournamentSelection
- java.lang.Object
-
- org.encog.ml.ea.opp.selection.TournamentSelection
-
- All Implemented Interfaces:
- java.io.Serializable, SelectionOperator
public class TournamentSelection extends java.lang.Object implements SelectionOperator, java.io.Serializable
Tournament select can be used to select a fit (or unfit) genome from a species. The selection is run a set number of rounds. Each round two random participants are chosen. The more fit participant continues to the next round. http://en.wikipedia.org/wiki/Tournament_selection- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TournamentSelection(EvolutionaryAlgorithm theTrainer, int theRounds)Construct a tournament selection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetRounds()EvolutionaryAlgorithmgetTrainer()intperformAntiSelection(java.util.Random rnd, Species species)Selects an unfit genome.intperformSelection(java.util.Random rnd, Species species)Selects an fit genome.voidsetRounds(int rounds)Set the number of rounds.voidsetTrainer(EvolutionaryAlgorithm trainer)Set the trainer.
-
-
-
Constructor Detail
-
TournamentSelection
public TournamentSelection(EvolutionaryAlgorithm theTrainer, int theRounds)
Construct a tournament selection.- Parameters:
theTrainer- The trainer.theRounds- The number of rounds to use.
-
-
Method Detail
-
getRounds
public int getRounds()
- Returns:
- The number of rounds.
-
getTrainer
public EvolutionaryAlgorithm getTrainer()
- Specified by:
getTrainerin interfaceSelectionOperator- Returns:
- The trainer being used.
-
performAntiSelection
public int performAntiSelection(java.util.Random rnd, Species species)Selects an unfit genome.- Specified by:
performAntiSelectionin interfaceSelectionOperator- Parameters:
rnd- A random number generator.species- The species to select the genome from.- Returns:
- The selected genome.
-
performSelection
public int performSelection(java.util.Random rnd, Species species)Selects an fit genome.- Specified by:
performSelectionin interfaceSelectionOperator- Parameters:
rnd- A random number generator.species- The species to select the genome from.- Returns:
- The selected genome.
-
setRounds
public void setRounds(int rounds)
Set the number of rounds.- Parameters:
rounds- The number of rounds.
-
setTrainer
public void setTrainer(EvolutionaryAlgorithm trainer)
Set the trainer.- Parameters:
trainer- The trainer.
-
-
DMelt 3.0 © DataMelt by jWork.ORG