PGADuplicate(8)

NAME
PGADuplicate - determines if a specified string is a duplicate of one already in an existing population

INPUT PARAMETERS
ctx - context variable
p   - string index
pop1
    - symbolic constant of the population containing string p
pop2
    - symbolic constant of the (possibly partial) population containing strings to compare string p against
n   - the number of strings in pop2 to compare string p against
n   -1)

OUTPUT PARAMETERS
none

SYNOPSIS
#include "pgapack.h"
int  PGADuplicate(ctx, p, pop1, pop2, n)
PGAContext *ctx
int p
int pop1
int pop2
int n

LOCATION
duplcate.c

EXAMPLE
0,...,n-1 in population pop2.  Otherwise returns PGA_FALSE
Example:
Change any string in PGA_NEWPOP that is an exact copy of a string
in PGA_OLDPOP.
PGAContext *ctx;
int b, n;
:
n  = PGAGetPopsize(ctx);
for (b=0; b<n; b++)
if (PGADuplicate(ctx, b, PGA_NEWPOP, PGA_OLDPOP, n))
PGAChange(ctx, b, PGA_NEWPOP);
Check if the best string in population PGA_OLDPOP is a duplicate of any
of the strings in the first half of population PGA_NEWPOP.
PGAContext *ctx;
int b, n;
:
b  = PGAGetBestIndex(ctx, PGA_OLDPOP);
n  = PGAGetPopsize(ctx) / 2;
if (PGADuplicate(ctx, b, PGA_OLDPOP, PGA_NEWPOP, n))
printf("A duplicate!);