Function PGACharacterCreateString
Defined in File char.c
Function Documentation
-
void PGACharacterCreateString(PGAContext *ctx, int p, int pop, int initflag)
Allocate memory for a string of type character.
Description
Note that this function is set in
PGASetUp()
as the create string user function for the char datatype by default.Example
Allocates memory and assigns the address of the allocated memory to the string field
ind->chrom
of the individual. Additionally, the string is initialized to zero.PGAContext *ctx; int p; ... PGACharacterCreateString (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 true/false flag used in conjunction with ctx->ga.RandomInit to initialize the string either randomly or set to zero
- Returns:
Member p in population pop is allocated and initialized.