Function PGASetBinaryAllele

Function Documentation

void PGASetBinaryAllele(PGAContext *ctx, int p, int pop, int i, int val)

Sets a binary allele to the specified value.

Example

Copies the alleles from member p in PGA_OLDPOP to member q in PGA_NEWPOP.

PGAContext *ctx;
int p, q, i;
int l;

...
l = PGAGetStringLength (ctx);
for (i=0 i<l; i++) {
    int a = PGAGetBinaryAllele (ctx, p, PGA_OLDPOP, i);
    PGASetBinaryAllele (ctx, q, PGA_NEWPOP, i, a);
}

Parameters
  • ctx – context variable

  • p – string index

  • pop – symbolic constant of the population the string is in

  • i – allele index

  • val – binary value (either 1 or 0) to set the allele to

Returns

The allele is changed by side-effect