File: PGARank.1

package info (click to toggle)
pgapack 1.1-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,344 kB
  • ctags: 1,786
  • sloc: ansic: 10,331; fortran: 2,985; sh: 486; makefile: 462; perl: 105
file content (64 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (3)
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
.TH PGARank 1 "05/01/95" " " "PGAPack"
.SH NAME
PGARank \- returns the rank of a string in a population.  
.SH DESCRIPTION
This is a value
between 1,...,N (the population size).  The most fit string has rank 1,
the least fit string has rank N.
.SH INPUT PARAMETERS
.PD 0
.TP
ctx
- context variable
.PD 0
.TP
p
- the index of the string whose rank is desired
.PD 0
.TP
order
- an array containing a unique rank for each string
.PD 0
.TP
n
- the size of the array order
.PD 1
.SH OUTPUT PARAMETERS
.PD 0
.TP
none

.PD 1
.SH SYNOPSIS
.nf
#include "pgapack.h"
int  PGARank(ctx, p, order, n)
PGAContext *ctx
int p
int *order
int n
.fi
.SH LOCATION
fitness.c
.SH EXAMPLE
.nf
Example:
Determine the rank of string p.

PGAContext *ctx;
int i, popsize, rank, *order;
double *fitness;

popsize = PGAGetPopsize(ctx);
order   = (int *)   malloc(sizeof(int)    * popsize);
fitness = (double *)malloc(sizeof(double) * popsize);

for(i=0;i<popsize; i++) {
fitness[i] = PGAGetFitness(ctx, p, PGA_OLDPOP);
order[i]   = i;
}

PGADblHeapSort(ctx, fitness, order, popsize);
rank = PGARank(ctx, p, order, popsize)

.fi