gaMutate¶
Performs the mutation operation on an individual’s chromosome.
Synopsis¶
gaMutate (p, individual)
Required Arguments¶
- float
p
(Input) - The mutation probability.
p
can be any value between 0 and 1. Most applications set the probability to a value in the range 0.01 to 0.001. - Imsls_d_individual
individual
(Input/Output) - An existing individual that will undergo mutation.
Optional Arguments¶
t_print
, (Input)- By default, results are not printed. This option turns on printing of summary information for the individual showing the chromosome before and after mutation.
swapMutation
, (Input)- By default, swap encoding of nominal phenotype values is not used. This option turns on swap mutation for nominal phenotypes which ensures that after mutation the new individual contains the same nominal phenotype values with at most two of them having swapped positions. Swap mutation has no effect on the mutation of binary, integer or real phenotypes.
Description¶
Function gaMutate
performs the genetic algorithm mutation operation on
the chromosome of an Imsls_d_individual data structure. Each bit assigned
to binary, integer and real phenotypes undergoes the mutation operation
using probability p
. If the bit is zero it is switched to one and vice
versa.
Mutation for nominal phenotypes is handled differently since these are not
encoded as binary bits. Each bit assigned to a nominal phenotype can take on
a range of values from 0, 1, … nCategories[i]-1
. Any mutation must
preserve this encoding. If the nominal phenotypes are further encoded using
PMX crossover, then mutation must preserve that encoding as well.
For non-PMX encoded nominal phenotypes, each nominal phenotype value is
mutated with probability p
. If it is selected for mutation, its new
value is randomly selected from the uniform discrete distribution of values
from 0, 1,… nCategories[i]-1
.
If PMX encoding is being used, the optional argument swapMutation
should
be employed. This argument invokes swap mutation for the nominal phenotypes.
Two nominal phenotypes are randomly selected and then their values are
swapped with probability p
. This ensures that the resulting new
individual has the same nominal values, with at most two of them having
switched positions.