Function PGAChange

Function Documentation

void PGAChange(PGAContext *ctx, int p, int pop)

Repeatedly apply mutation to a string (with an increasing mutation rate) until one or more mutations have occurred.

Description

This routine is usually used with PGADuplicate() to modify a duplicate string. It is not intended to replace PGAMutate().

Example

Check the current to-be-inserted string if it is a copy of any of the strings in PGA_NEWPOP. Note that the check relies on all individuals in PGA_NEWPOP to also be inserted into the duplicate hash, see PGAHashIndividual().

PGAContext *ctx;
int p;

...
while (PGADuplicate (ctx, p, PGA_NEWNEW, PGA_NEWPOP)) {
    PGAChange (ctx, p, PGA_NEWPOP);
}

Parameters
  • ctx – context variable

  • p – string index

  • pop – symbolic constant of the population containing string p

Returns

Mutates string p in population pop via side effect