lio.selectors
Class RouleteWheelSelector

java.lang.Object
  extended by lio.selectors.RouleteWheelSelector
All Implemented Interfaces:
LiOResource, Selector

public class RouleteWheelSelector
extends java.lang.Object
implements Selector

This class implements the roulete wheel sampling to select some individuals from a population.


Constructor Summary
RouleteWheelSelector()
           
 
Method Summary
 LiOResourceDefinition getDefinition()
          Return a LiOResDescription object which holds the name and all parameters that describe the resource.
 boolean isRanking()
          Getter for property ranking.
static void main(java.lang.String[] args)
          Main class that allows testing the class.
 double[] rankingSelection(Individual[] individuals)
          Returns a vector containing probabilities for each individual assigned by ranking
 Individual[] select(Individual[] individuals, int number)
          Returns an array of individuals selected from those passed as parameter.
 void setRanking(boolean ranking)
          Setter for property ranking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouleteWheelSelector

public RouleteWheelSelector()
Method Detail

select

public Individual[] select(Individual[] individuals,
                           int number)
Returns an array of individuals selected from those passed as parameter.

Specified by:
select in interface Selector
Parameters:
individuals - set of individuals
number - number of individual that must be selected
Returns:
selected individuals

getDefinition

public LiOResourceDefinition getDefinition()
Return a LiOResDescription object which holds the name and all parameters that describe the resource.

Specified by:
getDefinition in interface LiOResource
Returns:
A definition of the resource.

rankingSelection

public double[] rankingSelection(Individual[] individuals)
Returns a vector containing probabilities for each individual assigned by ranking


isRanking

public boolean isRanking()
Getter for property ranking.

Returns:
Value of property ranking.

setRanking

public void setRanking(boolean ranking)
Setter for property ranking.

Parameters:
ranking - New value of property ranking.

main

public static void main(java.lang.String[] args)
Main class that allows testing the class.

Parameters:
args - Arguments passed by command line