Function PGABinaryCreateString
Defined in File binary.c
Function Documentation
-
void PGABinaryCreateString(PGAContext *ctx, int p, int pop, int initflag)
Allocate a binary string for member p of population pop.
Description
If initflag is
PGA_TRUE
, randomly initialize all alleles, otherwise clear all alleles. Applies toPGA_DATATYPE_BINARY
strings.Note that this function is set in
PGASetUp()
as the create string user function for the binary datatype by default.Example
Allocates and clears alleles for all strings in
PGA_NEWPOP
.PGAContext *ctx; int p; ... for (p=PGAGetPopSize(ctx)-1; p>=0; p--) { PGABinaryCreateString (ctx, p, PGA_NEWPOP, PGA_FALSE); }
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant of the population string p is in
initflag – a flag, if set, randomly initialize, else clear alleles
- Returns:
Member p in population pop is allocated and initialized.