T
- A generic type that matches the type associated with the selection strategies.public class SelectionStrategyControl<T> extends Object implements EvolutionControl
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.Constructor and Description |
---|
SelectionStrategyControl(List<SelectionStrategy<? super T>> options)
Creates a control for choosing between a specified set of selection strategies.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public SelectionStrategyControl(List<SelectionStrategy<? super T>> options)
options
- The selection strategies to choose from.public static <T> List<SelectionStrategy<? super T>> createDefaultOptions(Probability tournamentProbability, double truncationRatio)
RankSelection
, RouletteWheelSelection
,
StochasticUniversalSampling
, TournamentSelection
and TruncationSelection
.tournamentProbability
- The probability parameter for TournamentSelection
.truncationRatio
- The ratio parameter for TruncationSelection
.public JComboBox getControl()
getControl
in interface EvolutionControl
public void reset()
reset
in interface EvolutionControl
public void setDescription(String description)
setDescription
in interface EvolutionControl
description
- The description of the control.public SelectionStrategy<T> getSelectionStrategy()
SelectionStrategy
that delegates to whichever
concrete selection strategy is currently selected.