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
|