PGASortPop(8) PGAPack PGASortPop(8)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 with-
out replacement. The function PGASetPopReplaceType() is used to specify which strategy is used. The indices of the sorted population mem-
bers may then be accessed from the internal array via PGAGetSortedPopIndex(). This routine is typically used during population replace-
ment.
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)
Check Out this Related Man Page
PGASendReceiveIndividual(4) PGAPack PGASendReceiveIndividual(4)NAME
PGASendReceiveIndividual - Send an individual to a process, while receiving a different individual from a different process.
INPUT PARAMETERS
ctx - context variable
send_p - index of string to send
send_pop
- symbolic constant of population to send from
dest - destination process
send_tag
- tag to send with
recv_p - index of string to receive
recv_pop
- symbolic constant of population to receive from
source - process to receive from
recv_tag
- tag to receive with
comm - an MPI communicator
status - pointer to the MPI status structure
OUTPUT PARAMETERS
none
SYNOPSIS
#include "pgapack.h"
void PGASendReceiveIndividual(ctx, send_p, send_pop, dest, send_tag, recv_p, recv_pop, source, recv_tag, comm, status)
PGAContext *ctx
int send_p
int send_pop
int dest
int send_tag
int recv_p
int recv_pop
int source
int recv_tag
MPI_Comm comm
MPI_Status *status
LOCATION
parallel.c
EXAMPLE
Example:
A dedicated process is being used to perform an optimization algorithm
on the strings. Send a new string, s, to the process, while receiving an
optimized string, r, from it.
PGAContext *ctx;
MPI_Comm comm;
MPI_Status status;
int s, r;
:
PGASendReceiveIndividual(ctx, s, PGA_NEWPOP, 1, PGA_SR_STRINGTOMODIFY,
r, PGA_NEWPOP, 1, PGA_SR_MODIFIEDSTRING,
comm, &status);
05/01/95 PGASendReceiveIndividual(4)
Dear all,
I'm have a sorted array like this:
177
220
1001
2000
2001
2003
2005
notice that 2002 and 2004 are NOT in array.
Then user input a number INPUT, our script should return OUTPUT value like this:
if INPUT is not in array => OUTPUT=INPUT
if INPUT is in array => OUTPUT is the... (4 Replies)
Hi,
I am trying to populate an array with data from a text file. I have a working method using awk but it is too slow and inefficent. See below.
The text file has 70,000 lines. As awk is a line editor it reads each line of the file until it gets to the required line and then processes it.... (3 Replies)
Dear Folks
I have one column of 15000 lines and want to select randomly 5000 of them in five different times without replacement. I am aware that command 'shuf' and 'sort -R' could select randomly those lines but I am not sure how could I avoid the replacement of selection line. Does anyone have... (10 Replies)