Function PGACharacterMutation
Defined in File char.c
Function Documentation
-
int PGACharacterMutation(PGAContext *ctx, int p, int pop, double mr)
Randomly mutates a character-valued gene with a specified probability.
Description
This routine is called from
PGAMutate()
.Note that this function is set in
PGASetUp()
as the mutation user function for the char datatype by default.Example
PGAContext *ctx; int p; int NumMutations; ... NumMutations = PGACharacterMutation (ctx, p, PGA_NEWPOP, 0.01);
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant of the population string p is in
mr – probability of mutating an character-valued gene
- Returns:
Returns the number of mutations