Function PGAMutate
Defined in File mutation.c
Function Documentation
-
int PGAMutate(PGAContext *ctx, int p, int pop)
Perform mutation on a string.
Description
The type of mutation depends on the data type. Refer to section Mutation in the user guide for data-specific examples.
Example
Mutate the best string in the population, until 10 or more mutations have occured.
PGAContext *ctx; int p, count = 0; ... p = PGAGetBestIndex (ctx, PGA_NEWPOP); while (count < 10) { count += PGAMutate (ctx, p, PGA_NEWPOP); }
- Parameters:
ctx – context variable
p – index of string to mutate
pop – symbolic constant of the population containing p
- Returns:
The number of mutations performed. Member p in population pop is mutated by side-effect