PGARank - Online in the Cloud

This is the command PGARank that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


PGARank - returns the rank of a string in a population.

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.

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

SYNOPSIS


#include "pgapack.h"
int PGARank(ctx, p, order, n)
PGAContext *ctx
int p
int *order
int n

LOCATION


fitness.c

EXAMPLE


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)

05/01/95 PGARank(1)

Use PGARank online using onworks.net services



Latest Linux & Windows online programs