IMSL C Stat Library
ga_mutate
Performs the mutation operation on an individual’s chromosome.
Synopsis
#include <imsls.h>
void imsls_f_ga_mutate (float p, Imsls_f_individual *individual, …, 0)
The type double function is imsls_d_ga_mutate.
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_f_individual *individual (Input/Output)
An existing individual that will undergo mutation.
Synopsis with Optional Arguments
#include <imsls.h>
void imsls_f_ga_mutate (float p, Imsls_f_individual *individual,
IMSLS_PRINT,
IMSLS_SWAP_MUTATION,
0)
Optional Arguments
IMSLS_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.
IMSLS_SWAP_MUTATION, (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 imsls_f_ga_mutate performs the genetic algorithm mutation operation on the chromosome of an Imsls_f_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, … n_categories[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,… n_categories[i]-1.
If PMX encoding is being used, the optional argument IMSLS_SWAP_MUTATION 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.