public class Mutator<G extends Gene<?,G>,C extends Comparable<? super C>> extends AbstractAlterer<G,C>
The mutation probability is the parameter that must be optimized. The optimal value of the mutation rate depends on the role mutation plays. If mutation is the only source of exploration (if there is no crossover) then the mutation rate should be set so that a reasonable neighborhood of solutions is explored.
The mutation probability P(m) is the probability that a specific gene over the whole population is mutated. The number of available genes of an population is
_probability
DEFAULT_ALTER_PROBABILITY
Constructor and Description |
---|
Mutator()
Default constructor, with probability = 0.01.
|
Mutator(double probability)
Construct a Mutation object which a given mutation probability.
|
Modifier and Type | Method and Description |
---|---|
int |
alter(Population<G,C> population,
long generation)
Concrete implementation of the alter method.
|
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
public Mutator(double probability)
probability
- Mutation probability. The given probability is
divided by the number of chromosomes of the genotype to form
the concrete mutation probability.IllegalArgumentException
- if the probability
is not in the
valid range of [0, 1]
..public Mutator()
public int alter(Population<G,C> population, long generation)
population
- The Population to be altered. If the
population
is null
or empty, nothing is altered.generation
- the date of birth (generation) of the altered phenotypes.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.
genes
- the genes to mutate.p
- the gene mutation probability.public int hashCode()
hashCode
in class AbstractAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
public boolean equals(Object obj)
equals
in class AbstractAlterer<G extends Gene<?,G>,C extends Comparable<? super C>>
© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)