public class StochasticUniversalSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>> extends RouletteWheelSelector<G,N>
StochasticUniversalSelector is a method for selecting a
population according to some given probability in a way that minimize chance
fluctuations. It can be viewed as a type of roulette game where now we have
P equally spaced points which we spin.
| Constructor and Description |
|---|
StochasticUniversalSelector() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
protected double[] |
probabilities(Population<G,N> population,
int count)
Return an Probability array, which corresponds to the given Population.
|
Population<G,N> |
select(Population<G,N> population,
int count,
Optimize opt)
This method sorts the population in descending order while calculating the
selection probabilities.
|
String |
toString() |
probabilitiespublic StochasticUniversalSelector()
public Population<G,N> select(Population<G,N> population, int count, Optimize opt)
Population.sort() is called
by this method.)select in interface Selector<G extends Gene<?,G>,N extends Number & Comparable<? super N>>select in class ProbabilitySelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>>population - The population to select from.count - The number of phenotypes to select.opt - Determines whether the individuals with higher fitness values
or lower fitness values must be selected. This parameter determines
whether the GA maximizes or minimizes the fitness function.protected double[] probabilities(Population<G,N> population, int count)
ProbabilitySelectorReturn an Probability array, which corresponds to the given Population. The probability array and the population must have the same size. The population is not sorted. If a subclass needs a sorted population, the subclass is responsible to sort the population.
The implementor always assumes that higher fitness values are better. The base class inverts the probabilities (p = 1.0 - p ) if the GA is
supposed to minimize the fitness function.probabilities in class RouletteWheelSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>>population - The unsorted population.count - The number of phenotypes to select. This parameter is not
needed for most implementations.population.size() and must sum to
one. The returned value is checked with
assert(Math.abs(math.sum(probabilities) - 1.0) < 0.0001)
in the base class.public int hashCode()
hashCode in class RouletteWheelSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>>public boolean equals(Object obj)
equals in class RouletteWheelSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>>© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)