Genex v1.0.1-beta Genex.Tools.Mutation View Source
Implementation of several population mutation methods.
Mutation takes place according to some rate. Mutation is useful for introducing novelty into the population. This ensures your solutions don't prematurely converge.
Future versions of Genex will provide the ability to define the "aggressiveness" of mutations. As of this version of Genex, mutations effect the ENTIRE chromosome.
Link to this section Summary
Functions
Perform a bit-flip mutation.
Perform a bit-flip mutation.
Performs creep mutation.
Performs creep mutation with at random genes.
Performs a gaussian mutation.
Performs a gaussian mutation at random genes.
Perform a scramble mutation.
Perform a scramble mutation on a random slice of size n
.
Link to this section Functions
bit_flip(chromosome)
View Sourcebit_flip(Genex.Types.Chromosome.t()) :: Genex.Types.Chromosome.t()
Perform a bit-flip mutation.
This mutation performs a binary XOR on every gene in the Chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.
bit_flip(chromosome, p)
View Sourcebit_flip(Genex.Types.Chromosome.t(), float()) :: Genex.Types.Chromosome.t()
Perform a bit-flip mutation.
This mutation performs a binary XOR on a gene with probability p
in the Chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.p
: Probability of bitflip.
creep(chromosome, min, max)
View Sourcecreep(Genex.Types.Chromosome.t(), integer(), integer()) :: Genex.Types.Chromosome.t()
Performs creep mutation.
This mutation generates a random number between min
and max
at every gene in the chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.min
: lower boundmax
: upper bound
Performs creep mutation with at random genes.
This mutation generates a random number between min
and max
at genes with probability p
in the chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.p
: Probability of mutation.min
: lower boundmax
: upper bound
gaussian(chromosome)
View Sourcegaussian(Genex.Types.Chromosome.t()) :: Genex.Types.Chromosome.t()
Performs a gaussian mutation.
This mutation generates a random number at every gene in the chromosome. The random number is from a normal distribution produced from the mean and variance of the genes in the chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.
gaussian(chromosome, p)
View Sourcegaussian(Genex.Types.Chromosome.t(), float()) :: Genex.Types.Chromosome.t()
Performs a gaussian mutation at random genes.
This mutation generates a random number at random genes with probability p
in the chromosome. The random number is from a normal distribution produced from the mean and variance of the genes in the chromosome.
Returns Chromosome
.
Parameters
chromosome
:Chromosome
to mutate.p
: Probability of mutation.
scramble(chromosome)
View Sourcescramble(Genex.Types.Chromosome.t()) :: Genex.Types.Chromosome.t()
Perform a scramble mutation.
This mutation scrambles the genes of the Chromosome.
Returns %Chromosome{}
.
Parameters
chromosome
:Chromosome
to mutate.
scramble(_, _)
View Sourcescramble(Genex.Types.Chromosome.t(), integer()) :: Genex.Types.Chromosome.t()
Perform a scramble mutation on a random slice of size n
.
This mutation scrambles the genes of the Chromosome between two random points.
Returns %Chromosome{}
.
Parameters
chromosome
:Chromosome
to mutate.