Function PGAEncodeIntegerAsGrayCode
Defined in File evaluate.c
Function Documentation
-
void PGAEncodeIntegerAsGrayCode(PGAContext *ctx, int p, int pop, int start, int end, unsigned int val)
Encode a real value as a binary reflected Gray code sequence.
Example
Encode an integer 7 in 20 bits in bit positions 0–19 in string
p
in populationPGA_NEWPOP
using Gray code.PGAContext *ctx; int p; ... PGAEncodeIntegerAsGrayCode (ctx, p, PGA_NEWPOP, 0, 19, 7);
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant of the population the string is in
start – starting bit position in p to encode val in
end – ending bit position in p to encode val in
val – the integer value to be represented as a binary reflected Gray code sequence
- Returns:
The string is modified by side-effect