Function PGACharacterDuplicate

Function Documentation

int PGACharacterDuplicate(PGAContext *ctx, int p1, int pop1, int p2, int pop2)

Return true if string p1 in pop1 is a duplicate of string p2 in pop2, else returns false, assumes the strings are the same length.

Description

Note that this function is set in PGASetUp() as the duplicate checking user function for the char datatype by default.

Example

Compare string x with y to see if they are duplicates

PGAContext *ctx;
int x, y;

...
if (PGACharacterDuplicate (ctx, x, PGA_NEWPOP, y, PGA_NEWPOP)) {
    printf ("strings are duplicates\n");
}

Parameters
  • ctx – context variable

  • p1 – string index of the first string to compare

  • pop1 – symbolic constant of the population string p1 is in

  • p2 – string index of the second string to compare

  • pop2 – symbolic constant of the population string p2 is in

Returns

Returns true if strings are duplicates