1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
.TH PGADuplicate 8 "05/01/95" " " "PGAPack"
.SH NAME
PGADuplicate \- determines if a specified string is a duplicate of one
already in an existing population
.SH INPUT PARAMETERS
.PD 0
.TP
ctx
- context variable
.PD 0
.TP
p
- string index
.PD 0
.TP
pop1
- symbolic constant of the population containing string p
.PD 0
.TP
pop2
- symbolic constant of the (possibly partial) population containing
strings to compare string p against
.PD 0
.TP
n
- the number of strings in pop2 to compare string p against
.PD 0
.TP
n
-1)
.PD 1
.SH OUTPUT PARAMETERS
.PD 0
.TP
none
.PD 1
.SH SYNOPSIS
.nf
#include "pgapack.h"
int PGADuplicate(ctx, p, pop1, pop2, n)
PGAContext *ctx
int p
int pop1
int pop2
int n
.fi
.SH LOCATION
duplcate.c
.SH EXAMPLE
.nf
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!\n");
.fi
|