Function PGABinaryMutation
Defined in File binary.c
Function Documentation
-
int PGABinaryMutation(PGAContext *ctx, int p, int pop, double mr)
Randomly mutates a bit 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 binary datatype by default.Example
Mutates string
p
in populationPGA_NEWPOP
with a probability of 0.001 for each bit.PGAContext *ctx; int p; ... PGABinaryMutation (ctx, p, PGA_NEWPOP, .001);
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant for the population string p is in
mr – probability of mutating (toggling) a bit
- Returns:
Return the number of mutations