Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

org.uncommons.watchmaker.swing
Class SelectionStrategyControl<T>

java.lang.Object
  extended by org.uncommons.watchmaker.swing.SelectionStrategyControl<T>
Type Parameters:
T - A generic type that matches the type associated with the selection strategies.
All Implemented Interfaces:
EvolutionControl

public class SelectionStrategyControl<T>
extends Object
implements EvolutionControl

An evolution control for selecting between different SelectionStrategy implementations. This control provides a proxy selection strategy that delegates to the currently selected strategy. Using this proxy strategy with an EvolutionEngine means that any change to the combo-box selection is immediately reflected in the selection used by the running evolution engine.

Author:
Daniel Dyer

Constructor Summary
SelectionStrategyControl(List<SelectionStrategy<? super T>> options)
          Creates a control for choosing between a specified set of selection strategies.
 
Method Summary
static
<T> List<SelectionStrategy<? super T>>
createDefaultOptions(Probability tournamentProbability, double truncationRatio)
          Creates a list containing one instance of each of the standard selection strategies.
 JComboBox getControl()
          
 SelectionStrategy<T> getSelectionStrategy()
           
 void reset()
          Resets the control to its initial configuration.
 void setDescription(String description)
          Provides a textual description of the purpose of the control.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionStrategyControl

public SelectionStrategyControl(List<SelectionStrategy<? super T>> options)
Creates a control for choosing between a specified set of selection strategies.

Parameters:
options - The selection strategies to choose from.
Method Detail

createDefaultOptions

public static <T> List<SelectionStrategy<? super T>> createDefaultOptions(Probability tournamentProbability,
                                                                          double truncationRatio)
Creates a list containing one instance of each of the standard selection strategies. These strategies are RankSelection, RouletteWheelSelection, StochasticUniversalSampling, TournamentSelection and TruncationSelection.

Parameters:
tournamentProbability - The probability parameter for TournamentSelection.
truncationRatio - The ratio parameter for TruncationSelection.
Returns:
A list of selection strategies.

getControl

public JComboBox getControl()

Specified by:
getControl in interface EvolutionControl
Returns:
The GUI component used by this control.

reset

public void reset()
Resets the control to its initial configuration.

Specified by:
reset in interface EvolutionControl

setDescription

public void setDescription(String description)
Provides a textual description of the purpose of the control. This may be displayed somewhere on the GUI component (typically as tooltip text).

Specified by:
setDescription in interface EvolutionControl
Parameters:
description - The description of the control.

getSelectionStrategy

public SelectionStrategy<T> getSelectionStrategy()
Returns:
A proxied SelectionStrategy that delegates to whichever concrete selection strategy is currently selected.

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)