Man Linux: Main Page and Category List

NAME

       PGASortPop - Creates an (internal) array of indices according to one of
       three criteria.

DESCRIPTION

       If PGA_POPREPL_BEST is used (the default) the array is sorted from most
       fit 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  PGASetPopReplaceType()  is
       used  to  specify  which  strategy  is used.  The indices of the sorted
       population members may then be accessed from  the  internal  array  via
       PGAGetSortedPopIndex().    This   routine   is  typically  used  during
       population replacement.

INPUT PARAMETERS

       ctx    - context variable
       popindex
              - symbolic constant of the population from which to  create  the
              srted array.

OUTPUT PARAMETERS

       none

SYNOPSIS

       #include "pgapack.h"
       void  PGASortPop(ctx, pop)
       PGAContext *ctx
       int pop

LOCATION

       pop.c

EXAMPLE

       Example:
       Copy the five best strings from the old population into the new
       population.  The rest of the new population will be created by
       recombination, and is not shown.

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

                                   05/01/95                      PGASortPop(8)