Operator.Operations
Class RouletteWheel

java.lang.Object
  extended by Operator.Operations.SelectionOperation
      extended by Operator.Operations.RouletteWheel
All Implemented Interfaces:
Operation, ParameterI, Stochastic
Direct Known Subclasses:
ProportionalRouletteWheel, ScaledRouletteWheel

public abstract class RouletteWheel
extends SelectionOperation
implements Stochastic

This is an abstract class for creating Roulette wheel selection methods with different distributions

Author:
jbyrne

Field Summary
protected  double[] accProbs
           
protected  double minFit
           
protected  RandomNumberGenerator rng
           
protected  boolean smallFit
           
protected  double sumFit
           
 
Fields inherited from class Operator.Operations.SelectionOperation
selectedPopulation, size
 
Constructor Summary
RouletteWheel()
          New instance
RouletteWheel(int size, RandomNumberGenerator rng)
           
 
Method Summary
protected abstract  void calculateAccumulatedFitnessProbabilities(java.util.List<Individual> operands)
           
protected  void calculateFitnessSum(java.util.List<Individual> c)
          Calculate the fitness sum.
 void doOperation(Individual operand)
          Performs the operation on an operand
 void doOperation(java.util.List<Individual> operands)
          Performs the operation on the list passed
 RandomNumberGenerator getRNG()
          Get the number generator
 void rankPopulation(java.util.List<Individual> operands)
          Rank the population
 void setProperties(java.util.Properties p)
          Set properties
 void setRNG(RandomNumberGenerator m)
          Set the number generator
protected  void spinRoulette(java.util.List<Individual> operands)
          Selects Indivudals from operand and adds to the selected population until the selected population is full.
 
Methods inherited from class Operator.Operations.SelectionOperation
getSelectedPopulation, getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rng

protected RandomNumberGenerator rng

minFit

protected double minFit

sumFit

protected double sumFit

smallFit

protected boolean smallFit

accProbs

protected double[] accProbs
Constructor Detail

RouletteWheel

public RouletteWheel(int size,
                     RandomNumberGenerator rng)

RouletteWheel

public RouletteWheel()
New instance

Method Detail

setProperties

public void setProperties(java.util.Properties p)
Description copied from class: SelectionOperation
Set properties

Specified by:
setProperties in interface ParameterI
Overrides:
setProperties in class SelectionOperation
Parameters:
p - object containing properties

doOperation

public void doOperation(Individual operand)
Description copied from interface: Operation
Performs the operation on an operand

Specified by:
doOperation in interface Operation
Specified by:
doOperation in class SelectionOperation
Parameters:
operand - operand to perform operation on

doOperation

public void doOperation(java.util.List<Individual> operands)
Description copied from interface: Operation
Performs the operation on the list passed

Specified by:
doOperation in interface Operation
Specified by:
doOperation in class SelectionOperation
Parameters:
operands - operands to be operated on

rankPopulation

public void rankPopulation(java.util.List<Individual> operands)
Rank the population

Parameters:
operands - population

spinRoulette

protected void spinRoulette(java.util.List<Individual> operands)
Selects Indivudals from operand and adds to the selected population until the selected population is full.

Parameters:
operands - Individuals to be chosen form

calculateAccumulatedFitnessProbabilities

protected abstract void calculateAccumulatedFitnessProbabilities(java.util.List<Individual> operands)

calculateFitnessSum

protected void calculateFitnessSum(java.util.List<Individual> c)
Calculate the fitness sum. Get the minimum fitness. If fitness is NaN or Infinite Double.MAX_VAALUE is assigned

Parameters:
c - List of individuals which fitness is taken into account

getRNG

public RandomNumberGenerator getRNG()
Description copied from interface: Stochastic
Get the number generator

Specified by:
getRNG in interface Stochastic
Returns:
number generator

setRNG

public void setRNG(RandomNumberGenerator m)
Description copied from interface: Stochastic
Set the number generator

Specified by:
setRNG in interface Stochastic
Parameters:
m - number generator