XCSF  1.4.7
XCSF learning classifier system
act_integer.h File Reference

integer action functions. More...

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

Go to the source code of this file.

Data Structures

struct  ActInteger
 Integer action data structure. More...
 

Functions

bool act_integer_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
 Dummy function since integer actions do not perform crossover. More...
 
bool act_integer_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
 Returns whether the action of classifier c1 is more general than c2. More...
 
bool act_integer_mutate (const struct XCSF *xcsf, const struct Cl *c)
 Mutates an integer action. More...
 
int act_integer_compute (const struct XCSF *xcsf, const struct Cl *c, const double *x)
 Returns a classifier's integer action. More...
 
void act_integer_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
 Copies an integer action from one classifier to another. More...
 
void act_integer_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
 Sets an integer action to a specified value. More...
 
void act_integer_free (const struct XCSF *xcsf, const struct Cl *c)
 Frees the memory used by an integer action. More...
 
void act_integer_init (const struct XCSF *xcsf, struct Cl *c)
 Initialises an integer action. More...
 
void act_integer_print (const struct XCSF *xcsf, const struct Cl *c)
 Prints an integer action. More...
 
void act_integer_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
 Dummy function since integer actions are not updated. More...
 
size_t act_integer_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
 Writes an integer action to a file. More...
 
size_t act_integer_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp)
 Reads an integer action from a file. More...
 
char * act_integer_json_export (const struct XCSF *xcsf, const struct Cl *c)
 Returns a json formatted string representation of an integer action. More...
 
void act_integer_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
 Creates an integer action from a cJSON object. More...
 

Variables

static struct ActVtbl const act_integer_vtbl
 Integer action implemented functions. More...
 

Detailed Description

integer action functions.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2019–2021.

Definition in file act_integer.h.

Function Documentation

◆ act_integer_compute()

int act_integer_compute ( const struct XCSF xcsf,
const struct Cl c,
const double *  x 
)

Returns a classifier's integer action.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action to return.
[in]xThe input state.
Returns
The classifier's action.

Definition at line 101 of file act_integer.c.

References Cl::act, and ActInteger::action.

◆ act_integer_copy()

void act_integer_copy ( const struct XCSF xcsf,
struct Cl dest,
const struct Cl src 
)

Copies an integer action from one classifier to another.

Parameters
[in]xcsfThe XCSF data structure.
[in]destThe destination classifier.
[in]srcThe source classifier.

Definition at line 117 of file act_integer.c.

References Cl::act, ActInteger::action, ActInteger::mu, and N_MU.

◆ act_integer_cover()

void act_integer_cover ( const struct XCSF xcsf,
const struct Cl c,
const double *  x,
const int  action 
)

Sets an integer action to a specified value.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is being covered.
[in]xThe input state to cover.
[in]actionThe action to cover.

Definition at line 149 of file act_integer.c.

References Cl::act, and ActInteger::action.

◆ act_integer_crossover()

bool act_integer_crossover ( const struct XCSF xcsf,
const struct Cl c1,
const struct Cl c2 
)

Dummy function since integer actions do not perform crossover.

Parameters
[in]xcsfThe XCSF data structure.
[in]c1The first classifier whose action is being crossed.
[in]c2The second classifier whose action is being crossed.
Returns
False.

Definition at line 43 of file act_integer.c.

◆ act_integer_free()

void act_integer_free ( const struct XCSF xcsf,
const struct Cl c 
)

Frees the memory used by an integer action.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is to be freed.

Definition at line 164 of file act_integer.c.

References Cl::act, and ActInteger::mu.

◆ act_integer_general()

bool act_integer_general ( const struct XCSF xcsf,
const struct Cl c1,
const struct Cl c2 
)

Returns whether the action of classifier c1 is more general than c2.

Parameters
[in]xcsfThe XCSF data structure.
[in]c1The classifier whose action is tested to be more general.
[in]c2The classifier whose action is tested to be more specific.
Returns
Whether the action of c1 is more general than c2.

Definition at line 60 of file act_integer.c.

References Cl::act, and ActInteger::action.

◆ act_integer_init()

void act_integer_init ( const struct XCSF xcsf,
struct Cl c 
)

Initialises an integer action.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is to be initialised.

Definition at line 178 of file act_integer.c.

References Cl::act, MU_TYPE, N_MU, rand_uniform_int(), and sam_init().

Here is the call graph for this function:

◆ act_integer_json_export()

char* act_integer_json_export ( const struct XCSF xcsf,
const struct Cl c 
)

Returns a json formatted string representation of an integer action.

Parameters
[in]xcsfXCSF data structure.
[in]cClassifier whose action is to be returned.
Returns
String encoded in json format.

Definition at line 249 of file act_integer.c.

References Cl::act, ActInteger::action, ActInteger::mu, and N_MU.

Referenced by act_integer_print().

Here is the caller graph for this function:

◆ act_integer_json_import()

void act_integer_json_import ( const struct XCSF xcsf,
struct Cl c,
const cJSON *  json 
)

Creates an integer action from a cJSON object.

Parameters
[in]xcsfThe XCSF data structure.
[in,out]cThe classifier to initialise.
[in]jsoncJSON object.

Definition at line 270 of file act_integer.c.

References Cl::act, ActInteger::action, ActInteger::mu, N_MU, and sam_json_import().

Here is the call graph for this function:

◆ act_integer_load()

size_t act_integer_load ( const struct XCSF xcsf,
struct Cl c,
FILE *  fp 
)

Reads an integer action from a file.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is to be read.
[in]fpPointer to the file to be read.
Returns
The number of elements read.

Definition at line 230 of file act_integer.c.

References Cl::act, and N_MU.

◆ act_integer_mutate()

bool act_integer_mutate ( const struct XCSF xcsf,
const struct Cl c 
)

Mutates an integer action.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is being mutated.
Returns
Whether any alterations were made.

Definition at line 79 of file act_integer.c.

References Cl::act, ActInteger::action, ActInteger::mu, MU_TYPE, N_MU, rand_uniform(), rand_uniform_int(), and sam_adapt().

Here is the call graph for this function:

◆ act_integer_print()

void act_integer_print ( const struct XCSF xcsf,
const struct Cl c 
)

Prints an integer action.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is to be printed.

Definition at line 134 of file act_integer.c.

References act_integer_json_export().

Here is the call graph for this function:

◆ act_integer_save()

size_t act_integer_save ( const struct XCSF xcsf,
const struct Cl c,
FILE *  fp 
)

Writes an integer action to a file.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier whose action is to be written.
[in]fpPointer to the file to be written.
Returns
The number of elements written.

Definition at line 212 of file act_integer.c.

References Cl::act, ActInteger::action, ActInteger::mu, and N_MU.

◆ act_integer_update()

void act_integer_update ( const struct XCSF xcsf,
const struct Cl c,
const double *  x,
const double *  y 
)

Dummy function since integer actions are not updated.

Parameters
[in]xcsfThe XCSF data structure.
[in]cA classifier data structure.
[in]xThe input state.
[in]yThe payoff value.

Definition at line 195 of file act_integer.c.

Variable Documentation

◆ act_integer_vtbl

struct ActVtbl const act_integer_vtbl
static
Initial value:
= {
}
void act_integer_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies an integer action from one classifier to another.
Definition: act_integer.c:117
void act_integer_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by an integer action.
Definition: act_integer.c:164
bool act_integer_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy function since integer actions do not perform crossover.
Definition: act_integer.c:43
int act_integer_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Returns a classifier's integer action.
Definition: act_integer.c:101
size_t act_integer_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes an integer action to a file.
Definition: act_integer.c:212
void act_integer_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Dummy function since integer actions are not updated.
Definition: act_integer.c:195
void act_integer_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates an integer action from a cJSON object.
Definition: act_integer.c:270
void act_integer_init(const struct XCSF *xcsf, struct Cl *c)
Initialises an integer action.
Definition: act_integer.c:178
bool act_integer_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates an integer action.
Definition: act_integer.c:79
bool act_integer_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Returns whether the action of classifier c1 is more general than c2.
Definition: act_integer.c:60
size_t act_integer_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads an integer action from a file.
Definition: act_integer.c:230
char * act_integer_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of an integer action.
Definition: act_integer.c:249
void act_integer_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Sets an integer action to a specified value.
Definition: act_integer.c:149
void act_integer_print(const struct XCSF *xcsf, const struct Cl *c)
Prints an integer action.
Definition: act_integer.c:134

Integer action implemented functions.

Definition at line 83 of file act_integer.h.

Referenced by action_set().