public final class GaussianMutator<G extends NumericGene<?,G>> extends Mutator<G> implements Immutable
NumericGene
.
This mutator picks a new value based on a Gaussian distribution around the
current value of the gene. The variance of the new value (before clipping to
the allowed gene range) will be
_probability, DEFAULT_ALTER_PROBABILITY
Constructor and Description |
---|
GaussianMutator() |
GaussianMutator(double probability) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
protected int |
mutate(MSeq<G> genes,
double p)
Template method which gives an (re)implementation of the mutation class
the possibility to perform its own mutation operation, based on a
writable gene array and the gene mutation probability p.
|
String |
toString() |
getProbability, Null
public GaussianMutator()
public GaussianMutator(double probability)
protected int mutate(MSeq<G> genes, double p)
Mutator
Template method which gives an (re)implementation of the mutation class the possibility to perform its own mutation operation, based on a writable gene array and the gene mutation probability p.
This implementation, for example, does it in this way:
protected int mutate(final MSeq〈G〉 genes, final double p) {
final IndexStream stream = IndexStream.Random(genes.length(), p);
int alterations = 0;
for (int i = stream.next(); i != -1; i = stream.next()) {
genes.set(i, genes.get(i).newInstance());
++alterations;
}
return alterations;
}
mutate
in class Mutator<G extends NumericGene<?,G>>
genes
- the genes to mutate.p
- the gene mutation probability.public boolean equals(Object obj)
equals
in class Mutator<G extends NumericGene<?,G>>
© 2007-2014 Franz Wilhelmstötter (2014-03-07 19:35)