Mutation operators
Mutation operators (a.k.a. mutators) work on a single individual and return a copy. Some of them have parameters to control how the mutation is performed, and are dependent on both the data contained in an individual and its representation.
Currently, mutation is only implemented for vector individuals.
Selecting a mutation operator
All mutation operators have been renamed to mutators since EvoLP 1.4. The old names will be deprecated in a future major release. Be sure to check the new type ontology.
EvoLP provides many built-in mutators.
For binary vectors
EvoLP.BitwiseMutator
— TypeBitwise mutation with probability λ
of flipping each bit.
For continuous vectors
EvoLP.GaussianMutator
— TypeGaussian mutation with standard deviation σ
, which should be a real number.
For permutation-based vectors
EvoLP.SwapMutator
— TypeSwap mutation for permutation-based individuals.
EvoLP.InsertionMutator
— TypeInsert mutation for permutation-based individuals.
EvoLP.ScrambleMutator
— TypeScramble mutation for permutation-based individuals.
EvoLP.InversionMutator
— TypeInversion mutation for permutation-based individuals.
Performing the mutation
After "instantiating" a mutation method, you can use mutate
on a single individual ind
. All operators return a copy, and in the process no individual is modified.
EvoLP.mutate
— Functionmutate(M::BitwiseMutator, ind)
Randomly flips each bit with a probability λ
.
mutate(M::GaussianMutator, ind)
Randomly add Gaussian noise to the ind
candidate solution, with a standard deviation of σ
.
mutate(::SwapMutator, ind)
Randomly swap the position of two alleles in the ind
candidate solution.
mutate(::InsertionMutator, ind)
Randomly choose two positions a
and b
from ind
, insert at a
+1 the element at position b
`, and shift the rest of the elements.
mutate(::ScrambleMutator, ind)
Randomly scramble the subsequence between two random points in ind
.
mutate(::InversionMutator, ind)
Invert the subsequence between two random points in ind
.