eaLib API Docs
Last Modified : January 7 2002

mss.ea.sel
Class Selection

java.lang.Object
  |
  +--mss.ea.core.GeneticOperator
        |
        +--mss.ea.sel.Selection
All Implemented Interfaces:
SingleStreamProcessor, StreamProcessor
Direct Known Subclasses:
RandomSelection, RouletteWheelSelection, TournamentSelection, TruncationSelection

public abstract class Selection
extends GeneticOperator
implements SingleStreamProcessor

Abstract base classs for the selection operator.

Since:
0.1
Version:
$Revision: 1.11 $ $Date: 2001/12/10 13:50:30 $
Author:
Andreas Rummler

Field Summary
protected  boolean multSelection
          Indication if individuals can be selected multiple times.
protected  int numberPerSelection
          Number of individuals per selection.
 
Fields inherited from class mss.ea.core.GeneticOperator
description, ID, name
 
Constructor Summary
Selection(int numberPerSelection)
          Constructor with number per selection.
Selection(int numberPerSelection, boolean allowMultipleSelection)
          Constructor number per selection and multiple selection flag.
 
Method Summary
 int getSelectionSize()
          Gets the number of individuals per selection.
 IndividualStream process(IndividualStream is)
          Calls the select method.
abstract  IndividualStream select(IndividualStream is)
          Abstract select method.
 void setSelectionSize(int number)
          Sets the number of individuals per selection.
 
Methods inherited from class mss.ea.core.GeneticOperator
getDescription, getID, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mss.ea.core.StreamProcessor
getName
 

Field Detail

multSelection

protected boolean multSelection
Indication if individuals can be selected multiple times.

numberPerSelection

protected int numberPerSelection
Number of individuals per selection.
Constructor Detail

Selection

public Selection(int numberPerSelection)
Constructor with number per selection.
Parameters:
numberPerSelection - number how many individuals are selected

Selection

public Selection(int numberPerSelection,
                 boolean allowMultipleSelection)
Constructor number per selection and multiple selection flag.
Parameters:
numberPerSelection - number how many individuals are selected
allowMultipleSelection - state of the multiple selection flag
Method Detail

getSelectionSize

public int getSelectionSize()
Gets the number of individuals per selection.
Returns:
number of individuals per selection

setSelectionSize

public void setSelectionSize(int number)
Sets the number of individuals per selection.
Parameters:
number - number of individuals per selection

select

public abstract IndividualStream select(IndividualStream is)
                                 throws SelectionException
Abstract select method. Selects individuals. This method depends on the kind of the selection operator and must be implemented by each subclass. It should be discussed, if this method should be protected.
Parameters:
is - stream of individuals to select from
Returns:
stream of selected individuals
Throws:
SelectionException - thrown in case the selection mechanism fails

process

public IndividualStream process(IndividualStream is)
                         throws EAException
Calls the select method.
Specified by:
process in interface SingleStreamProcessor
Parameters:
is - stream to select individuals from
Returns:
stream with selected individuals
Throws:
EAException - thrown in case the processing of the stream fails

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS