Function PGADuplicate
Defined in File duplcate.c
Function Documentation
-
int PGADuplicate(PGAContext *ctx, int p, int pop1, int pop2)
Determine if a specified string is a duplicate of one already in an existing population.
Description
Return
PGA_TRUEifPGAGetNoDuplicatesFlag()returnsPGA_TRUEand stringpin populationpop1is a duplicate of at least one strings already inserted into populationpop2, otherwise returnPGA_FALSE.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 inPGA_NEWPOPto also be inserted into the duplicate hash, seePGAHashIndividual().PGAContext *ctx; int p; ... while (PGADuplicate (ctx, p, PGA_NEWNEW, PGA_NEWPOP)) { PGAChange (ctx, p, PGA_NEWPOP); }
- 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
- Returns:
Return true if duplicate