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 |
---|---|
AltererResult<G,C> |
alter(Seq<Phenotype<G,C>> population,
long generation)
Concrete implementation of the alter method.
|
protected MutatorResult<Chromosome<G>> |
mutate(Chromosome<G> chromosome,
double p,
Random random)
Mutates the given chromosome.
|
protected MutatorResult<Genotype<G>> |
mutate(Genotype<G> genotype,
double p,
Random random)
Mutates the given genotype.
|
protected G |
mutate(G gene,
Random random)
Mutates the given gene.
|
protected MutatorResult<Phenotype<G,C>> |
mutate(Phenotype<G,C> phenotype,
long generation,
double p,
Random random)
Mutates the given phenotype.
|
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 AltererResult<G,C> alter(Seq<Phenotype<G,C>> population, long generation)
mutate(Phenotype, long, double, Random)
,
mutate(Genotype, double, Random)
,
mutate(Chromosome, double, Random)
, mutate(Gene, Random)
,
in this specific order.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.mutate(Phenotype, long, double, Random)
,
mutate(Genotype, double, Random)
,
mutate(Chromosome, double, Random)
,
mutate(Gene, Random)
protected MutatorResult<Phenotype<G,C>> mutate(Phenotype<G,C> phenotype, long generation, double p, Random random)
phenotype
- the phenotype to mutategeneration
- the actual generationp
- the mutation probability for the underlying genetic objectsrandom
- the random engine used for the phenotype mutationmutate(Genotype, double, Random)
,
mutate(Chromosome, double, Random)
,
mutate(Gene, Random)
protected MutatorResult<Genotype<G>> mutate(Genotype<G> genotype, double p, Random random)
genotype
- the genotype to mutatep
- the mutation probability for the underlying genetic objectsrandom
- the random engine used for the genotype mutationmutate(Chromosome, double, Random)
,
mutate(Gene, Random)
protected MutatorResult<Chromosome<G>> mutate(Chromosome<G> chromosome, double p, Random random)
chromosome
- the chromosome to mutatep
- the mutation probability for the underlying genetic objectsrandom
- the random engine used for the genotype mutationmutate(Gene, Random)
protected G mutate(G gene, Random random)
gene
- the gene to mutaterandom
- the random engine used for the genotype mutation© 2007-2019 Franz Wilhelmstötter (2019-06-23 15:39)