Function PGAGetIntegerFromGrayCode
Defined in File evaluate.c
Function Documentation
-
unsigned int PGAGetIntegerFromGrayCode(PGAContext *ctx, int p, int pop, int start, int end)
Interpret a binary reflected Gray code sequence as encoding an integer value and return the integer value it represents.
Example
Get an integer
j
from bits 10–29 of stringp
in populationPGA_NEWPOP
. The string is encoded in Gray code.PGAContext *ctx; int j, p; ... j = PGAGetIntegerFromGrayCode (ctx, p, PGA_NEWPOP, 10, 29);
- Parameters:
ctx – context variable
p – string index
pop – symbolic constant of the population the string is in
start – starting bit position in the binary representation
end – ending bit position in the binary representation
- Returns:
The integer value encoded by the binary reflected Gray code sequence