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

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

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

A recipe for Tournament selection.

Tournament selection is performed by:

  1. Randomly ordering a list of elements.
  2. Selecting a sublist of tournamentSize.
  3. Sorting the created sublist.
  4. Selecting the best perfroming element.
  5. Return the result.

Author:
Wiehann Matthysen
See Also:
Serialized Form

Constructor Summary
TournamentSelection()
          Create a new instance.
TournamentSelection(TournamentSelection copy)
          Create a copy of the provided instance.
 
Method Summary
 TournamentSelection getClone()
          Create a cloned copy of the current object and return it.
 Comparator<Selection.Entry<E>> getComparator()
          Get the comparator for the selection.
 ControlParameter getTournamentSize()
          Get the size of the tournament.
 E select(List<? extends E> elements)
          Perform the selection process.
 void setComparator(Comparator<Selection.Entry<E>> comparator)
          Set the comparator for the selection.
 void setTournamentSize(ControlParameter tournamanetSize)
          Set the size of the tournament.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TournamentSelection

public TournamentSelection()
Create a new instance.


TournamentSelection

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

Parameters:
copy - The instance to copy.
Method Detail

getClone

public TournamentSelection 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()

getTournamentSize

public ControlParameter getTournamentSize()
Get the size of the tournament.

Returns:
The sizeof the tournament.

setTournamentSize

public void setTournamentSize(ControlParameter tournamanetSize)
Set the size of the tournament.

Parameters:
tournamanetSize - The value to set.

setComparator

public void setComparator(Comparator<Selection.Entry<E>> comparator)
Set the comparator for the selection.

Parameters:
comparator - The value to set.

getComparator

public Comparator<Selection.Entry<E>> getComparator()
Get the comparator for the selection.

Returns:
The current comparator.

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.