XCSF  1.4.7
XCSF learning classifier system
action.c File Reference

Interface for classifier actions. More...

#include "action.h"
#include "act_integer.h"
#include "act_neural.h"
#include "utils.h"
Include dependency graph for action.c:

Go to the source code of this file.

Functions

void action_set (const struct XCSF *xcsf, struct Cl *c)
 Sets a classifier's action functions to the implementations. More...
 
const char * action_type_as_string (const int type)
 Returns a string representation of an action type from an integer. More...
 
int action_type_as_int (const char *type)
 Returns the integer representation of an action type given a name. More...
 
void action_param_defaults (struct XCSF *xcsf)
 Initialises default action parameters. More...
 
char * action_param_json_export (const struct XCSF *xcsf)
 Returns a json formatted string of the action parameters. More...
 
char * action_param_json_import (struct XCSF *xcsf, cJSON *json)
 Sets the action parameters from a cJSON object. More...
 
size_t action_param_save (const struct XCSF *xcsf, FILE *fp)
 Saves action parameters. More...
 
size_t action_param_load (struct XCSF *xcsf, FILE *fp)
 Loads action parameters. More...
 
void action_param_free (struct XCSF *xcsf)
 Frees action parameters. More...
 
int action_param_set_type_string (struct XCSF *xcsf, const char *a)
 
void action_param_set_type (struct XCSF *xcsf, const int a)
 

Detailed Description

Interface for classifier actions.

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

Definition in file action.c.

Function Documentation

◆ action_param_defaults()

void action_param_defaults ( struct XCSF xcsf)

Initialises default action parameters.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 91 of file action.c.

References act_neural_param_defaults(), ACT_TYPE_INTEGER, and action_param_set_type().

Referenced by param_init().

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

◆ action_param_free()

void action_param_free ( struct XCSF xcsf)

Frees action parameters.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 184 of file action.c.

References layer_args_free().

Referenced by param_free().

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

◆ action_param_json_export()

char* action_param_json_export ( const struct XCSF xcsf)

Returns a json formatted string of the action parameters.

Parameters
[in]xcsfXCSF data structure.
Returns
String encoded in json format.

Definition at line 103 of file action.c.

References ACT_TYPE_NEURAL, action_type_as_string(), layer_args_json_export(), and ArgsAct::type.

Referenced by param_json_export().

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

◆ action_param_json_import()

char* action_param_json_import ( struct XCSF xcsf,
cJSON *  json 
)

Sets the action parameters from a cJSON object.

Parameters
[in,out]xcsfXCSF data structure.
[in]jsoncJSON object.
Returns
NULL if successful; or the name of parameter if not found.

Definition at line 131 of file action.c.

References act_neural_param_json_import(), ACT_TYPE_INTEGER, and ACT_TYPE_NEURAL.

Referenced by param_json_import_action().

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

◆ action_param_load()

size_t action_param_load ( struct XCSF xcsf,
FILE *  fp 
)

Loads action parameters.

Parameters
[in]xcsfThe XCSF data structure.
[in]fpPointer to the output file.
Returns
The total number of elements written.

Definition at line 170 of file action.c.

References ArgsAct::largs, layer_args_load(), and ArgsAct::type.

Referenced by param_load().

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

◆ action_param_save()

size_t action_param_save ( const struct XCSF xcsf,
FILE *  fp 
)

Saves action parameters.

Parameters
[in]xcsfThe XCSF data structure.
[in]fpPointer to the output file.
Returns
The total number of elements written.

Definition at line 154 of file action.c.

References ArgsAct::largs, layer_args_save(), and ArgsAct::type.

Referenced by param_save().

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

◆ action_param_set_type()

void action_param_set_type ( struct XCSF xcsf,
const int  a 
)

Definition at line 202 of file action.c.

Referenced by action_param_defaults().

Here is the caller graph for this function:

◆ action_param_set_type_string()

int action_param_set_type_string ( struct XCSF xcsf,
const char *  a 
)

Definition at line 192 of file action.c.

References ACT_TYPE_INVALID, action_type_as_int(), and ArgsAct::type.

Referenced by param_json_import_action().

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

◆ action_set()

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

Sets a classifier's action functions to the implementations.

Parameters
[in]xcsfThe XCSF data structure.
[in]cThe classifier to set.

Definition at line 35 of file action.c.

References act_integer_vtbl, act_neural_vtbl, ACT_TYPE_INTEGER, ACT_TYPE_NEURAL, and Cl::act_vptr.

Referenced by cl_load(), and cl_rand().

Here is the caller graph for this function:

◆ action_type_as_int()

int action_type_as_int ( const char *  type)

Returns the integer representation of an action type given a name.

Parameters
[in]typeString representation of a condition type.
Returns
Integer representing the action type.

Definition at line 75 of file action.c.

References ACT_STRING_INTEGER, ACT_STRING_NEURAL, ACT_TYPE_INTEGER, ACT_TYPE_INVALID, and ACT_TYPE_NEURAL.

Referenced by act_json_import(), and action_param_set_type_string().

Here is the caller graph for this function:

◆ action_type_as_string()

const char* action_type_as_string ( const int  type)

Returns a string representation of an action type from an integer.

Parameters
[in]typeInteger representation of an action type.
Returns
String representing the name of the action type.

Definition at line 56 of file action.c.

References ACT_STRING_INTEGER, ACT_STRING_NEURAL, ACT_TYPE_INTEGER, and ACT_TYPE_NEURAL.

Referenced by act_json_import(), and action_param_json_export().

Here is the caller graph for this function: