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