XCSF  1.4.7
XCSF learning classifier system
env_maze.h File Reference

The discrete maze problem environment module. More...

#include "env.h"
#include "xcsf.h"
Include dependency graph for env_maze.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  EnvMaze
 Maze environment data structure. More...
 

Macros

#define MAX_SIZE   (50)
 The maximum width/height of a maze. More...
 

Functions

bool env_maze_is_done (const struct XCSF *xcsf)
 Returns whether the maze is in a terminal state. More...
 
bool env_maze_multistep (const struct XCSF *xcsf)
 Returns whether the environment is a multistep problem. More...
 
double env_maze_execute (const struct XCSF *xcsf, const int action)
 Executes the specified action and returns the payoff. More...
 
double env_maze_maxpayoff (const struct XCSF *xcsf)
 Returns the maximum payoff value possible in the maze. More...
 
const double * env_maze_get_state (const struct XCSF *xcsf)
 Returns the current animat perceptions in the maze. More...
 
void env_maze_free (const struct XCSF *xcsf)
 Frees the maze environment. More...
 
void env_maze_init (struct XCSF *xcsf, const char *filename)
 Initialises a maze environment from a specified file. More...
 
void env_maze_reset (const struct XCSF *xcsf)
 Resets the animat to a random empty position in the maze. More...
 

Variables

static struct EnvVtbl const env_maze_vtbl
 Maze environment implemented functions. More...
 

Detailed Description

The discrete maze problem environment module.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2015–2020.

Definition in file env_maze.h.

Macro Definition Documentation

◆ MAX_SIZE

#define MAX_SIZE   (50)

The maximum width/height of a maze.

Definition at line 29 of file env_maze.h.

Function Documentation

◆ env_maze_execute()

double env_maze_execute ( const struct XCSF xcsf,
const int  action 
)

Executes the specified action and returns the payoff.

Parameters
[in]xcsfThe XCSF data structure.
[in]actionThe action to perform.
Returns
The payoff from performing the action.

Definition at line 217 of file env_maze.c.

References EnvMaze::done, MAX_PAYOFF, EnvMaze::maze, x_moves, EnvMaze::xpos, EnvMaze::xsize, y_moves, EnvMaze::ypos, and EnvMaze::ysize.

◆ env_maze_free()

void env_maze_free ( const struct XCSF xcsf)

Frees the maze environment.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 147 of file env_maze.c.

References EnvMaze::state.

◆ env_maze_get_state()

const double* env_maze_get_state ( const struct XCSF xcsf)

Returns the current animat perceptions in the maze.

Parameters
[in]xcsfThe XCSF data structure.
Returns
The current animat perceptions.

Definition at line 187 of file env_maze.c.

References env_maze_sensor(), EnvMaze::maze, EnvMaze::state, EnvMaze::xpos, EnvMaze::xsize, EnvMaze::ypos, and EnvMaze::ysize.

Here is the call graph for this function:

◆ env_maze_init()

void env_maze_init ( struct XCSF xcsf,
const char *  filename 
)

Initialises a maze environment from a specified file.

Parameters
[in]xcsfThe XCSF data structure.
[in]filenameThe file name of the specified maze environment.

Definition at line 100 of file env_maze.c.

References MAX_SIZE, EnvMaze::maze, param_init(), EnvMaze::state, EnvMaze::xsize, and EnvMaze::ysize.

Referenced by env_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ env_maze_is_done()

bool env_maze_is_done ( const struct XCSF xcsf)

Returns whether the maze is in a terminal state.

Parameters
[in]xcsfThe XCSF data structure.
Returns
Whether the maze is in a terminal state.

Definition at line 175 of file env_maze.c.

References EnvMaze::done.

◆ env_maze_maxpayoff()

double env_maze_maxpayoff ( const struct XCSF xcsf)

Returns the maximum payoff value possible in the maze.

Parameters
[in]xcsfThe XCSF data structure.
Returns
The maximum payoff.

Definition at line 259 of file env_maze.c.

References MAX_PAYOFF.

◆ env_maze_multistep()

bool env_maze_multistep ( const struct XCSF xcsf)

Returns whether the environment is a multistep problem.

Parameters
[in]xcsfThe XCSF data structure.
Returns
True

Definition at line 271 of file env_maze.c.

◆ env_maze_reset()

void env_maze_reset ( const struct XCSF xcsf)

Resets the animat to a random empty position in the maze.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 159 of file env_maze.c.

References EnvMaze::done, EnvMaze::maze, rand_uniform_int(), EnvMaze::xpos, EnvMaze::xsize, EnvMaze::ypos, and EnvMaze::ysize.

Here is the call graph for this function:

Variable Documentation

◆ env_maze_vtbl

struct EnvVtbl const env_maze_vtbl
static
Initial value:
= {
}
bool env_maze_is_done(const struct XCSF *xcsf)
Returns whether the maze is in a terminal state.
Definition: env_maze.c:175
void env_maze_free(const struct XCSF *xcsf)
Frees the maze environment.
Definition: env_maze.c:147
bool env_maze_multistep(const struct XCSF *xcsf)
Returns whether the environment is a multistep problem.
Definition: env_maze.c:271
double env_maze_execute(const struct XCSF *xcsf, const int action)
Executes the specified action and returns the payoff.
Definition: env_maze.c:217
const double * env_maze_get_state(const struct XCSF *xcsf)
Returns the current animat perceptions in the maze.
Definition: env_maze.c:187
void env_maze_reset(const struct XCSF *xcsf)
Resets the animat to a random empty position in the maze.
Definition: env_maze.c:159
double env_maze_maxpayoff(const struct XCSF *xcsf)
Returns the maximum payoff value possible in the maze.
Definition: env_maze.c:259

Maze environment implemented functions.

Definition at line 66 of file env_maze.h.

Referenced by env_init().