22 #ifndef __UTILITIES_H__
23 #define __UTILITIES_H__
36 typedef unsigned char BYTE;
43 #define BETTER(X,Y) (Maxflag ? (X) > (Y) : (X) < (Y))
48 const double EPS = 0.000001;
49 const int MASK = 2147483647;
51 const double SCALE = 0.4656612875e-9;
71 extern unsigned long Seed;
77 typedef unsigned char BYTE;
78 typedef unsigned short WORD;
84 #define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
85 #define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
86 #define LOWORD(l) ((WORD)(l))
87 #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
88 #define LOBYTE(w) ((BYTE)(w))
89 #define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF))
96 #if defined(WIN32) || defined(__APPLE__)
98 #define MAX(a, b) ( (a > b)? a : b )
101 #define MIN(a, b) ( (a < b)? a : b )
144 static void randomize(
unsigned long iOrigSeedProvided = 0)
148 if (iOrigSeedProvided == 0)
168 static bool between(
double x,
double y,
double z)
170 if (y < z && x > y && x < z)
173 else if (y > z && x < y && x > z)
189 if (y <= z && x >= y && x <= z)
192 else if (y >= z && x <= y && x >= z)
202 return (fabs(x - y) < eps);
222 p = (int) (low + (high - low) * r);
233 for (i = 0; i < n; i++)
234 if (array[i] == value)
238 else if (array[i] > value)
248 if (rval1 == 0 && rval2 == 255)
250 else if (value < rval1 || value > rval2 )
272 for (
int k = 0; k < 2; k++)
274 for (
int j = 0; j < 256; j++)
BYTE matrix[2][MAX_ENV_LAYERS][256]
const int MAX_SCALED_VALUE
const int CHAR_ARRAY_SIZE
static int randint(int low, int high)
static int notBetween(double x, double y, double z)
int getFileSize(char *strFilename)
static bool equalEps(double x, double y, double eps)
static int membership(BYTE rval1, BYTE rval2, BYTE value)
static int isInArray(long array[], int n, int value)
const int MAX_PRESENCE_POINTS
static void randomize(unsigned long iOrigSeedProvided=0)
void getError(int &code, string &message)
const int SCALED_VALUE_RANGE
static bool between(double x, double y, double z)
const int MIN_SCALED_VALUE
const int MAX_MUTATION_TEMPERATURE
GarpException(int code, string message)