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.
|
TruncationSelector(int n)
Create a new
TruncationSelector object, where the worst selected
individual has rank n . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
ISeq<Phenotype<G,C>> |
select(Seq<Phenotype<G,C>> population,
int count,
Optimize opt)
This method sorts the population in descending order while calculating
the selection probabilities.
|
String |
toString() |
public TruncationSelector(int n)
TruncationSelector
object, where the worst selected
individual has rank n
. This means, if you want to select
count
individuals, the worst selected individual has rank
n
. If count > n
, the selected population will contain
duplicate individuals.n
- the worst rank of the selected individualsIllegalArgumentException
- if n < 1
public TruncationSelector()
public ISeq<Phenotype<G,C>> select(Seq<Phenotype<G,C>> population, int count, Optimize opt)
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
or opt
is
null
.© 2007-2018 Franz Wilhelmstötter (2018-10-28 17:23)