.TH PGASortPop l "05/01/95" " " "PGAPack"
.SH NAME
PGASortPop \- Creates an (internal) array of indices according to one of
three criteria.  If PGA_POPREPL_BEST is used (the default) the array is
sorted according from most to least fit.  If PGA_POPREPL_RANDOM_REP is
used the indices in the array are selected randomly with replacement.
If PGA_POPREPL_RANDOM_NOREP is used the indices in the array are selected
randomly without replacement.  The function PGASetPopReplacement is used
to specify which strategy is used.  The indices of the sorted population
members may then be accessed from the internal array via PGAGetSortPop.
This routine is typically used during population replacement.
.SH INPUT PARAMETERS
.PD 0
.TP
ctx
- context variable
.PD 0
.TP
popindex
- symbolic constant of the population from which to create
the srted array.
.PD 1
.SH OUTPUT PARAMETERS
.PD 0
.TP
none

.PD 1
.SH SYNOPSIS
.nf
#include "pgapack.h"
void  PGASortPop(ctx, pop)
PGAContext *ctx
int pop
.fi
.SH LOCATION
heap.c
.SH EXAMPLE
.nf
Example:
The following code copies the five best strings from the old
population into the new one (the rest of the new population will
be created by recombination

PGAContext *ctx;
int i,j;
:
PGASetPopReplacement(ctx,PGA_POPREPL_BEST)
PGASortPop(ctx, PGA_OLDPOP);
for ( i=0; i < 5; i++) {
j = PGAGetSortPop(ctx, i);
PGACopyIndividual (ctx, j, PGA_OLDPOP, i, PGA_NEWPOP);

.fi
