mss.ea.sel
Class TournamentSelection
java.lang.Object
|
+--mss.ea.core.GeneticOperator
|
+--mss.ea.sel.Selection
|
+--mss.ea.sel.TournamentSelection
- All Implemented Interfaces:
- SingleStreamProcessor, StreamProcessor
- Direct Known Subclasses:
- FitnessTournamentSelection, ScoreTournamentSelection
- public class TournamentSelection
- extends Selection
Tournament Selection.
This class implements a tournament selection. In this variant tournaments are executed between random
individuals. The best individual wins the tournament and is selected.
- Since:
- 0.1
- Version:
- $Revision: 1.10 $ $Date: 2001/12/11 13:17:38 $
- Author:
- Andreas Rummler
Constructor Summary |
TournamentSelection(int numberPerSelection)
Constructor with number per selection. |
TournamentSelection(int numberPerSelection,
int tourSize)
Constructor with number per selection and tournament size. |
TournamentSelection(int numberPerSelection,
int tourSize,
IndividualComparator comp)
Constructor with number per selection, tournament size and individual comparator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
tournamentSize
protected int tournamentSize
- Number of individuals attending a tournament.
rand
protected java.util.Random rand
- Random generator.
comparator
protected IndividualComparator comparator
- Individual comparator for use in tournament.
TournamentSelection
public TournamentSelection(int numberPerSelection)
- Constructor with number per selection.
- Parameters:
numberPerSelection
- number how many individuals are selected
TournamentSelection
public TournamentSelection(int numberPerSelection,
int tourSize)
- Constructor with number per selection and tournament size.
- Parameters:
numberPerSelection
- number how many individuals are selectedtourSize
- size of the tournament
TournamentSelection
public TournamentSelection(int numberPerSelection,
int tourSize,
IndividualComparator comp)
- Constructor with number per selection, tournament size and individual comparator.
- Parameters:
numberPerSelection
- number how many individuals are selectedtourSize
- size of the tournamentcomp
- individual comparator to use for comparisons
setTournamentSize
public void setTournamentSize(int tourSize)
- Sets a new tournament size.
- Parameters:
tourSize
- new tournament size
getTournamentSize
public int getTournamentSize()
- Gets the current tournament size.
- Returns:
- current tournament size
select
public IndividualStream select(IndividualStream is)
throws SelectionException
- Selects individuals from a stream.
- Overrides:
select
in class Selection
- Parameters:
is
- stream to select individuals from- Returns:
- stream with selected individuals
- Throws:
SelectionException
- thrown in case the selection mechanism fails
selectByCompare
protected IndividualStream selectByCompare(IndividualStream is)
- Selects individuals by calling the compare() method.
- Parameters:
is
- stream to select individuals from- Returns:
- stream with selected individuals
selectByComparator
protected IndividualStream selectByComparator(IndividualStream is)
- Selects individuals by use of the previously set individual comparator.
- Parameters:
is
- stream to select individuals from- Returns:
- stream with selected individuals
Copyright © 2000-2001 Technical University of Ilmenau, Department ESS