28 #define ACT_TYPE_INVALID (-1)
29 #define ACT_TYPE_INTEGER (0)
30 #define ACT_TYPE_NEURAL (1)
32 #define ACT_STRING_INTEGER ("integer\0")
33 #define ACT_STRING_NEURAL ("neural\0")
35 #define ACT_TYPE_OPTIONS "integer, neural"
85 const struct Cl *src);
87 const double *x,
const int action);
92 const double *x,
const double *y);
96 char *(*act_impl_json_export)(
const struct XCSF *
xcsf,
const struct Cl *c);
272 const cJSON *item = cJSON_GetObjectItem(json,
"type");
273 if (item == NULL || !cJSON_IsString(item)) {
274 printf(
"action_json_import(): missing type\n");
277 const char *type = item->valuestring;
279 printf(
"action_json_import(): mismatched type\n");
280 printf(
"XCSF type = %s, but imported type = %s\n",
size_t action_param_load(struct XCSF *xcsf, FILE *fp)
Loads action parameters.
static void act_init(const struct XCSF *xcsf, struct Cl *c)
Initialises a classifier's action.
void action_param_set_type(struct XCSF *xcsf, const int a)
static bool act_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Performs classifier action crossover.
static void act_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies the action from one classifier to another.
static char * act_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of an action .
int action_type_as_int(const char *type)
Returns the integer representation of an action type given a name.
char * action_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the action parameters from a cJSON object.
static bool act_mutate(const struct XCSF *xcsf, const struct Cl *c)
Performs classifier action mutation.
static void act_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Generates an action that matches the specified value.
static size_t act_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads the action from a file.
void action_set(const struct XCSF *xcsf, struct Cl *c)
Sets a classifier's action functions to the implementations.
static size_t act_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes the action to a file.
static int act_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Computes the current classifier action using the input.
static void act_print(const struct XCSF *xcsf, const struct Cl *c)
Prints the classifier action.
static bool act_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.
static void act_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by the classifier action.
static void act_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates an action from a cJSON object.
const char * action_type_as_string(const int type)
Returns a string representation of an action type from an integer.
size_t action_param_save(const struct XCSF *xcsf, FILE *fp)
Saves action parameters.
int action_param_set_type_string(struct XCSF *xcsf, const char *a)
void action_param_defaults(struct XCSF *xcsf)
Initialises default action parameters.
static void act_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Updates the classifier's action.
void action_param_free(struct XCSF *xcsf)
Frees action parameters.
char * action_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string of the action parameters.
Action interface data structure.
void(* act_impl_print)(const struct XCSF *xcsf, const struct Cl *c)
void(* act_impl_json_import)(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
size_t(* act_impl_load)(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
bool(* act_impl_general)(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
size_t(* act_impl_save)(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
bool(* act_impl_mutate)(const struct XCSF *xcsf, const struct Cl *c)
void(* act_impl_update)(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
bool(* act_impl_crossover)(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
char *(* act_impl_json_export)(const struct XCSF *xcsf, const struct Cl *c)
void(* act_impl_copy)(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
void(* act_impl_init)(const struct XCSF *xcsf, struct Cl *c)
void(* act_impl_free)(const struct XCSF *xcsf, const struct Cl *c)
int(* act_impl_compute)(const struct XCSF *xcsf, const struct Cl *c, const double *x)
void(* act_impl_cover)(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Parameters for initialising and operating actions.
struct ArgsLayer * largs
Linked-list of layer parameters.
int type
Classifier action type.
Parameters for initialising a neural network layer.
int type
Layer type: CONNECTED, DROPOUT, etc.
Classifier data structure.
struct ActVtbl const * act_vptr
Functions acting on actions.
int action
Current classifier action.