JAGA Homepage

org.jaga.selection
Class TournamentSelection

java.lang.Object
  extended by org.jaga.selection.TournamentSelection
All Implemented Interfaces:
SelectionAlgorithm

public class TournamentSelection
extends java.lang.Object
implements SelectionAlgorithm

TODO: Complete these comments.

Project: JAGA - Java API for Genetic Algorithms.

Company: University College London and JAGA.Org (http://www.jaga.org).

Copyright: (c) 2004 by G. Paperin.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ONLY if you include a note of the original author(s) in any redistributed/modified copy.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/gpl.html

Version:
JAGA public release 1.0 beta
Author:
Greg Paperin (greg@jaga.org)

Field Summary
private static java.lang.Class applicableFitnessClass
           
private  double betterCandidateProbability
           
private  int competitorsNum
           
 
Constructor Summary
TournamentSelection()
           
TournamentSelection(int oneOutOf, double betterCandProb)
           
 
Method Summary
 java.lang.Class getApplicableFitnessClass()
          Gets the Fitness-class handles by this selector.
 double getBetterCandidateProbability()
           
 int getCompetitiors()
           
 Individual select(Population population, int age, GAParameterSet params)
          Selects an individual from the specified population according to the fitness.
 Individual[] select(Population population, int howMany, int age, GAParameterSet params)
          Selects a spacified number of individuals from the population according to their fitness.
 void setBetterCandidateProbability(double betterCandProb)
           
 void setCompetitors(int oneOutOf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

applicableFitnessClass

private static final java.lang.Class applicableFitnessClass

competitorsNum

private int competitorsNum

betterCandidateProbability

private double betterCandidateProbability
Constructor Detail

TournamentSelection

public TournamentSelection()

TournamentSelection

public TournamentSelection(int oneOutOf,
                           double betterCandProb)
Method Detail

getCompetitiors

public int getCompetitiors()

setCompetitors

public void setCompetitors(int oneOutOf)

getBetterCandidateProbability

public double getBetterCandidateProbability()

setBetterCandidateProbability

public void setBetterCandidateProbability(double betterCandProb)

getApplicableFitnessClass

public java.lang.Class getApplicableFitnessClass()
Description copied from interface: SelectionAlgorithm
Gets the Fitness-class handles by this selector.

Specified by:
getApplicableFitnessClass in interface SelectionAlgorithm
Returns:
A class, such that all individuals in the populations passed to the select-methods must have a fitness of that class or its subclass.

select

public Individual select(Population population,
                         int age,
                         GAParameterSet params)
Description copied from interface: SelectionAlgorithm
Selects an individual from the specified population according to the fitness.

Specified by:
select in interface SelectionAlgorithm
Parameters:
population - The population to select from. All individuals in the population should return a fitness object which is possible to cast to the class returned by getApplicableFitnessClass.
age - The current generation of the population.
params - Experiment parameters.
Returns:
A selected individual.

select

public Individual[] select(Population population,
                           int howMany,
                           int age,
                           GAParameterSet params)
Description copied from interface: SelectionAlgorithm
Selects a spacified number of individuals from the population according to their fitness.

Specified by:
select in interface SelectionAlgorithm
Parameters:
population - The population to select from. All individuals in the population should return a fitness object which is possible to cast to the class returned by getApplicableFitnessClass.
howMany - The numbetr of individuals to select.
age - The current generation of the population.
params - Experiment parameters.
Returns:
An array of selected individuals.

JAGA Homepage

Go to JAGA Homepage