public final class TruncationSelector<G extends Gene<?,G>,C extends Comparable<? super C>> extends Object implements Selector<G,C>
Constructor and Description |
---|
TruncationSelector()
Create a new TruncationSelector object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
Population<G,C> |
select(Population<G,C> population,
int count,
Optimize opt)
This method sorts the population in descending order while calculating
the selection probabilities.
|
String |
toString() |
public TruncationSelector()
public Population<G,C> select(Population<G,C> population, int count, Optimize opt)
Population.sortWith(java.util.Comparator)
)} is called by this
method.) If the selection size is greater the the population size, the
whole population is duplicated until the desired sample size is reached.select
in interface Selector<G extends Gene<?,G>,C extends Comparable<? super C>>
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.NullPointerException
- if the population
is null
.© 2007-2016 Franz Wilhelmstötter (2016-12-26 11:02)