Function PGARealCreateString
Defined in File real.c
Function Documentation
-
void PGARealCreateString(PGAContext *ctx, int p, int pop, int initflag)
Allocate memory for a string of type real.
Description
Note that this function is set in
PGASetUp()
as the create string user function for the real datatype by default. Parameterinitflag
is used in conjunction withctx->ga.RandomInit
to initialize the string either randomly or set to zero.Example
Allocates memory and assigns the address of the allocated memory to the real string field
ind->chrom
of the individual. Also, clears the string.PGAContext *ctx; int p; ... PGARealCreateString (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 boolean flag to indicate random initialization
- Returns
None