XCSF
1.4.7
XCSF learning classifier system
|
Evolutionary algorithm functions. More...
#include "xcsf.h"
Go to the source code of this file.
Data Structures | |
struct | ArgsEA |
Parameters for operating the evolutionary algorithm. More... | |
Macros | |
#define | EA_SELECT_INVALID (-1) |
Error code for invalid selection. More... | |
#define | EA_SELECT_ROULETTE (0) |
Roulette wheel parental selection. More... | |
#define | EA_SELECT_TOURNAMENT (1) |
Tournament parental selection. More... | |
#define | EA_STRING_ROULETTE ("roulette\0") |
Roulette. More... | |
#define | EA_STRING_TOURNAMENT ("tournament\0") |
Tournament. More... | |
#define | EA_SELECT_OPTIONS "roulette, tournament" |
Valid EA types. More... | |
Functions | |
void | ea (struct XCSF *xcsf, const struct Set *set) |
Executes the evolutionary algorithm (EA). More... | |
void | ea_param_defaults (struct XCSF *xcsf) |
Initialises default evolutionary algorithm parameters. More... | |
void | ea_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the EA parameters from a cJSON object. More... | |
char * | ea_param_json_export (const struct XCSF *xcsf) |
Returns a json formatted string representation of the EA parameters. More... | |
size_t | ea_param_save (const struct XCSF *xcsf, FILE *fp) |
Saves evolutionary algorithm parameters. More... | |
size_t | ea_param_load (struct XCSF *xcsf, FILE *fp) |
Loads evolutionary algorithm parameters. More... | |
const char * | ea_type_as_string (const int type) |
Returns a string representation of an EA select type from an integer. More... | |
int | ea_type_as_int (const char *type) |
Returns the integer representation of an EA selection type. More... | |
const char * | ea_param_set_select_size (struct XCSF *xcsf, const double a) |
const char * | ea_param_set_theta (struct XCSF *xcsf, const double a) |
const char * | ea_param_set_p_crossover (struct XCSF *xcsf, const double a) |
const char * | ea_param_set_lambda (struct XCSF *xcsf, const int a) |
const char * | ea_param_set_err_reduc (struct XCSF *xcsf, const double a) |
const char * | ea_param_set_fit_reduc (struct XCSF *xcsf, const double a) |
const char * | ea_param_set_subsumption (struct XCSF *xcsf, const bool a) |
const char * | ea_param_set_pred_reset (struct XCSF *xcsf, const bool a) |
int | ea_param_set_select_type (struct XCSF *xcsf, const int a) |
int | ea_param_set_type_string (struct XCSF *xcsf, const char *a) |
#define EA_SELECT_INVALID (-1) |
#define EA_SELECT_OPTIONS "roulette, tournament" |
#define EA_SELECT_ROULETTE (0) |
Executes the evolutionary algorithm (EA).
[in] | xcsf | The XCSF data structure. |
[in] | set | The set in which to run the EA. |
Definition at line 199 of file ea.c.
References cl_copy(), cl_crossover(), cl_init(), cl_mutate(), clset_mean_time(), clset_pset_enforce_limit(), clset_set_times(), ea_add(), ea_init_offspring(), ea_select(), Cl::size, Set::size, and Cl::time.
Referenced by xcs_rl_update(), and xcs_supervised_trial().
void ea_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default evolutionary algorithm parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 237 of file ea.c.
References ea_param_set_err_reduc(), ea_param_set_fit_reduc(), ea_param_set_lambda(), ea_param_set_p_crossover(), ea_param_set_pred_reset(), ea_param_set_select_size(), ea_param_set_select_type(), ea_param_set_subsumption(), ea_param_set_theta(), and EA_SELECT_ROULETTE.
Referenced by param_init().
char* ea_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string representation of the EA parameters.
[in] | xcsf | XCSF data structure. |
Definition at line 256 of file ea.c.
References EA_SELECT_TOURNAMENT, and ea_type_as_string().
Referenced by param_json_export().
void ea_param_json_import | ( | struct XCSF * | xcsf, |
cJSON * | json | ||
) |
Sets the EA parameters from a cJSON object.
[in,out] | xcsf | The XCSF data structure. |
[in] | json | cJSON object. |
Definition at line 282 of file ea.c.
References catch_error(), ea_param_set_err_reduc(), ea_param_set_fit_reduc(), ea_param_set_lambda(), ea_param_set_p_crossover(), ea_param_set_pred_reset(), ea_param_set_select_size(), ea_param_set_subsumption(), ea_param_set_theta(), ea_param_set_type_string(), EA_SELECT_INVALID, and EA_SELECT_OPTIONS.
Referenced by param_json_import().
size_t ea_param_load | ( | struct XCSF * | xcsf, |
FILE * | fp | ||
) |
Loads evolutionary algorithm parameters.
[in] | xcsf | The XCSF data structure. |
[in] | fp | Pointer to the output file. |
Definition at line 355 of file ea.c.
Referenced by param_load().
size_t ea_param_save | ( | const struct XCSF * | xcsf, |
FILE * | fp | ||
) |
Saves evolutionary algorithm parameters.
[in] | xcsf | The XCSF data structure. |
[in] | fp | Pointer to the output file. |
Definition at line 333 of file ea.c.
Referenced by param_save().
const char* ea_param_set_err_reduc | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 448 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_fit_reduc | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 458 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_lambda | ( | struct XCSF * | xcsf, |
const int | a | ||
) |
Definition at line 438 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_p_crossover | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 428 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_pred_reset | ( | struct XCSF * | xcsf, |
const bool | a | ||
) |
Definition at line 475 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_select_size | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 408 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
int ea_param_set_select_type | ( | struct XCSF * | xcsf, |
const int | a | ||
) |
Definition at line 482 of file ea.c.
References EA_SELECT_INVALID, EA_SELECT_ROULETTE, and EA_SELECT_TOURNAMENT.
Referenced by ea_param_defaults().
const char* ea_param_set_subsumption | ( | struct XCSF * | xcsf, |
const bool | a | ||
) |
Definition at line 468 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
const char* ea_param_set_theta | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 418 of file ea.c.
Referenced by ea_param_defaults(), and ea_param_json_import().
int ea_param_set_type_string | ( | struct XCSF * | xcsf, |
const char * | a | ||
) |
Definition at line 492 of file ea.c.
References EA_SELECT_INVALID, and ea_type_as_int().
Referenced by ea_param_json_import().
int ea_type_as_int | ( | const char * | type | ) |
Returns the integer representation of an EA selection type.
[in] | type | String representation of an EA type. |
Definition at line 394 of file ea.c.
References EA_SELECT_INVALID, EA_SELECT_ROULETTE, EA_SELECT_TOURNAMENT, EA_STRING_ROULETTE, and EA_STRING_TOURNAMENT.
Referenced by ea_param_set_type_string().
const char* ea_type_as_string | ( | const int | type | ) |
Returns a string representation of an EA select type from an integer.
[in] | type | Integer representation of an EA select type. |
Definition at line 376 of file ea.c.
References EA_SELECT_ROULETTE, EA_SELECT_TOURNAMENT, EA_STRING_ROULETTE, and EA_STRING_TOURNAMENT.
Referenced by ea_param_json_export().