net.sourceforge.cilib.util.selection.recipes
Class RouletteWheelSelection<E extends Comparable>

java.lang.Object
  extended by net.sourceforge.cilib.util.selection.recipes.RouletteWheelSelection<E>
Type Parameters:
E - The selection type.
All Implemented Interfaces:
Serializable, Cloneable, SelectionRecipe<E>

public class RouletteWheelSelection<E extends Comparable>
extends Object
implements SelectionRecipe<E>

A recipe for Roulette wheel selection.

Roulette wheel selection is performed by:

  1. Weighing the elements of a selection.
  2. Performing a proportional ordering of the weighed elements.
  3. Returning the best result.

Author:
Wiehann Matthysen
See Also:
Serialized Form

Constructor Summary
RouletteWheelSelection()
          Create a new instance.
RouletteWheelSelection(RouletteWheelSelection copy)
          Create a copy of the provided instance.
RouletteWheelSelection(Weighing<E> weighing)
          Create a new instance with the provided weighing strategy.
RouletteWheelSelection(Weighing<E> weighing, Random random)
           
 
Method Summary
 RouletteWheelSelection getClone()
          Create a cloned copy of the current object and return it.
 Weighing<E> getWeighing()
          Get the current weighing strategy.
 E select(List<? extends E> elements)
          Perform the selection process.
 void setWeighing(Weighing<E> weighing)
          Set the weighing strategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouletteWheelSelection

public RouletteWheelSelection()
Create a new instance.


RouletteWheelSelection

public RouletteWheelSelection(Weighing<E> weighing)
Create a new instance with the provided weighing strategy.

Parameters:
weighing - The weighing strategy to set.

RouletteWheelSelection

public RouletteWheelSelection(Weighing<E> weighing,
                              Random random)

RouletteWheelSelection

public RouletteWheelSelection(RouletteWheelSelection copy)
Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public RouletteWheelSelection getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in interface SelectionRecipe<E extends Comparable>
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

setWeighing

public void setWeighing(Weighing<E> weighing)
Set the weighing strategy

Parameters:
weighing - The strategy to set.

getWeighing

public Weighing<E> getWeighing()
Get the current weighing strategy.

Returns:
The current weighing strategy.

select

public E select(List<? extends E> elements)
Perform the selection process.

Specified by:
select in interface SelectionRecipe<E extends Comparable>
Parameters:
elements - The elements to perfrom the selection on.
Returns:
The selected element.


Copyright © 2009 CIRG. All Rights Reserved.