PGARank(3)

PGARank3

Returns the rank of a string in a population. this is a value between 1,...,n (the population size). the most fit string has rank 1, the least fit string has rank n.

Usage

PGAContext *ctx

int p

int *order

int n

Input parameters

ctx

- context variable

p

- the index of the string whose rank is desired

order

- an array containing a unique rank for each string

n

- the size of the array order

Output parameters

none

Location

fitness.c

Examples

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)

Releases

8 releases since Debian 1.1 (Buzz); the text changed 1 time.

  1. 1.1
  2. 1.2–3.1

From pgapack 1.0.0.1-3 in Debian 3.1 (Sarge). Parsed by carta from the page's man source.