Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

org.evolvica.core.select
Class TournamentSelector

java.lang.Object
  extended byorg.evolvica.engine.AbstractOperator
      extended byorg.evolvica.core.common.AbstractGeneticOperator
          extended byorg.evolvica.core.select.AbstractSelector
              extended byorg.evolvica.core.select.TournamentSelector
All Implemented Interfaces:
IGeneticOperator, IOperator, IProcessor, java.io.Serializable

public class TournamentSelector
extends AbstractSelector

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.4.0
Version:
$Revision: 1.8 $ $Date: 2004/05/26 11:58:18 $
Author:
Andreas Rummler
See Also:
Serialized Form

Field Summary
protected  IIndividualComparator comparator
          Individual comparator for use in tournament.
protected  int tournamentSize
          Number of individuals attending a tournament.
 
Fields inherited from class org.evolvica.core.select.AbstractSelector
allowMultipleSelection, numberPerSelection
 
Fields inherited from class org.evolvica.engine.AbstractOperator
descriptor, element, id, name
 
Constructor Summary
TournamentSelector()
          Constructor.
TournamentSelector(int numberPerSelection, int tournamentSize, IIndividualComparator comparator)
          Constructor with number per selection, tournament size and individual comparator.
 
Method Summary
 IIndividualComparator getComparator()
          Returns the comparator.
 int getTournamentSize()
          Gets the current tournament size.
 IIndividual[] select(IIndividual[] pool)
          Selects individuals out of a given selection pool.
protected  IIndividual selectWinner(IIndividual[] pool)
          Selects a winner.
 void setComparator(IIndividualComparator comparator)
          Sets the comparator.
 void setTournamentSize(int tournamentSize)
          Sets a new tournament size.
 
Methods inherited from class org.evolvica.core.select.AbstractSelector
getNumberPerSelection, process, setNumberPerSelection
 
Methods inherited from class org.evolvica.engine.AbstractOperator
attachDescriptor, attachElement, descriptor, element, getId, getName, setId, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.evolvica.engine.IOperator
attachDescriptor, attachElement, descriptor, element, getId, getName, setId, setName
 

Field Detail

tournamentSize

protected int tournamentSize
Number of individuals attending a tournament.


comparator

protected IIndividualComparator comparator
Individual comparator for use in tournament.

Constructor Detail

TournamentSelector

public TournamentSelector()
Constructor.


TournamentSelector

public TournamentSelector(int numberPerSelection,
                          int tournamentSize,
                          IIndividualComparator comparator)
Constructor with number per selection, tournament size and individual comparator.

Parameters:
numberPerSelection - number how many individuals are selected
tournamentSize - size of the tournament
comparator - individual comparator to use for comparisons
Method Detail

select

public IIndividual[] select(IIndividual[] pool)
Description copied from class: AbstractSelector
Selects individuals out of a given selection pool.

Specified by:
select in class AbstractSelector
Parameters:
pool - selection pool
Returns:
selected individuals
See Also:
AbstractSelector.select(org.evolvica.core.IIndividual[])

selectWinner

protected IIndividual selectWinner(IIndividual[] pool)
Selects a winner.

Parameters:
pool - tournament attendees
Returns:
winner

setTournamentSize

public void setTournamentSize(int tournamentSize)
                       throws java.beans.PropertyVetoException
Sets a new tournament size.

Parameters:
tournamentSize - new tournament size
Throws:
java.beans.PropertyVetoException - thrown in case the property cannot be set

getTournamentSize

public int getTournamentSize()
Gets the current tournament size.

Returns:
current tournament size

getComparator

public IIndividualComparator getComparator()
Returns the comparator.

Returns:
comparator

setComparator

public void setComparator(IIndividualComparator comparator)
Sets the comparator.

Parameters:
comparator - comparator

Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

Copyright © 2000-2004 Technical University of Ilmenau, Department Electronic Circuits and Systems