NAME¶
PGAGetRealFromGrayCode - interpets a binary reflected Gray code sequence in a
binary string as encoding a real value and returns the real value it
represents.
- 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
- lower
- - lower bound of the interval the real number is defined on
- upper
- - lower bound of the interval the real number is defined on
OUTPUT PARAMETERS¶
- none
-
SYNOPSIS¶
#include "pgapack.h"
double PGAGetRealFromGrayCode(ctx, p, pop, start, end, lower, upper)
PGAContext *ctx
int p
int pop
int start
int end
double lower
double upper
LOCATION¶
evaluate.c
EXAMPLE¶
Example:
Decode a real value from the string p in population PGA_NEWPOP. The
value to decode lies on the interval [-10,20] and is represented
using the 20 bits in bit positions 10--29.
double x;
:
x = PGAGetRealFromGrayCode(ctx, p, PGA_NEWPOP, 10, 29, -10.0, 20.0);