PGARank(1)

PGARank1

Returns the rank of a string in a population.

Usage

PGAContext *ctx

int p

int *order

int n

Overview

This is a value between 1,...,N (the population size). The most fit string has rank 1, the least fit string has rank 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

Unchanged in 4 releases since Debian 5.0 (Lenny).

  1. 5.0–8

From pgapack 1.1.1-3 in Debian 8 (Jessie). Parsed by carta from the page's man source.