Function PGARestart

Function Documentation

void PGARestart(PGAContext *ctx, int source_pop, int dest_pop)

Reseed a population from the best string.

Description

Perform mutation on the best string. For integers and reals, the amount by which to change is set with PGASetMutationIntegerValue() and PGASetMutationRealValue(), respectively. For binary strings, the bits are complemented.

Example

Perform an unspecified test to determine if the current evolution is not evolving fast enough, and if so, restart the evolution.

PGAContext *ctx;
...
PGAEvaluate (ctx, PGA_OLDPOP, f, comm);
PGAFitness  (ctx, PGA_OLDPOP);

...
if (StagnantEvolution ()) {
    PGARestart  (ctx, PGA_OLDPOP, PGA_NEWPOP);
    PGAEvaluate (ctx, PGA_NEWPOP, EvalFunc);
    PGAUpdateGeneration (ctx);
}

Parameters
  • ctx – context variable

  • source_pop – symbolic constant of the source population

  • dest_pop – symbolic constant of the destination population

Returns

dest_pop is modified by side-effect