📄 woodsxcs.h
字号:
/*
/ WoodsEnvironment for XCS
/ ------------------------------------
/ a Learning Classifier System based on accuracy
/
/ by Martin Butz
/ University of Wuerzburg / University of Illinois at Urbana/Champaign
/ butz@illigal.ge.uiuc.edu
/ Last modified: 10-19-99
/
/ The header of the woods environment coded binary
/ the LENGTH_OF_ONE_ATTRIBUTE makri specifies with how many bits one attribute in the environment is codede
*/
#define LENGTH_OF_ONE_ATTRIBUTE 3
#define CONDITION_LENGTH 8*LENGTH_OF_ONE_ATTRIBUTE+RANDOMBIT_EXISTS
#define ACTION_LENGTH 3
#define NUMBER_OF_ACTIONS 8
#define PAYMENT_RANGE 1000
#define IS_MULTI_STEP 1 /* Boolean to check if this is a multi-step environment */
#define FREE0 '0'
#define FREE1 '0'
#define FREE2 '0'
#define FOODF0 '1'
#define FOODF1 '1'
#define FOODF2 '0'
#define FOODG0 '1'
#define FOODG1 '1'
#define FOODG2 '1'
#define OBSTACLEO0 '0'
#define OBSTACLEO1 '1'
#define OBSTACLEO2 '0'
#define OBSTACLEQ0 '0'
#define OBSTACLEQ1 '1'
#define OBSTACLEQ2 '1'
#define ENEMY0 '1'
#define ENEMY1 '0'
#define ENEMY2 '1'
#define ENEMY_EXISTS 0
#define RANDOMBIT_EXISTS 0
#define SLIPPROB 0.0
#define RESET_ON_REWARD 1
#define frand() ((double) rand() / (RAND_MAX+1.0))
/* constructor and destructor */
int initEnv(FILE *env_file);
void freeEnv();
/* action related stuff */
int doAction(char *state,char *action,int *reset);
int moveObject(char *action,int *x,int *y);
/* Movements in all eight directions */
int north(int *x,int *y);
int south(int *x,int *y);
int west(int *x,int *y);
int east(int *x,int *y);
int northeast(int *x,int *y);
int southeast(int *x,int *y);
int southwest(int *x,int *y);
int northwest(int *x,int *y);
/* get the reward and set the new state */
double checkReward(int x,int y);
void setState(char *state);
/* a reset has to be called if reward was received */
void resetState(char *state);
void setStartPos();
void setFreeRandPos(int *x,int *y);
/* an 'enemy'(demon) in the environment */
int moveEnemy();
void hideEnemy();
void showEnemy();
/* get properties for testing purposes */
int getActions(int nr,char *action);
int getEnvXSize();
int getEnvYSize();
int getXPos();
int getYPos();
int setPos(int x,int y,char *state);
char getRandomChar();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -