XCSF
1.4.7
XCSF learning classifier system
|
Tree GP condition functions. More...
Go to the source code of this file.
Functions | |
void | cond_gp_init (const struct XCSF *xcsf, struct Cl *c) |
Creates and initialises a tree-GP condition. More... | |
void | cond_gp_free (const struct XCSF *xcsf, const struct Cl *c) |
Frees the memory used by a tree-GP condition. More... | |
void | cond_gp_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
Copies a tree-GP condition from one classifier to another. More... | |
void | cond_gp_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Generates a GP tree that matches the current input. More... | |
void | cond_gp_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
Dummy update function. More... | |
bool | cond_gp_match (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Calculates whether a GP tree condition matches an input. More... | |
bool | cond_gp_mutate (const struct XCSF *xcsf, const struct Cl *c) |
Mutates a tree-GP condition with the self-adaptive rate. More... | |
bool | cond_gp_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Performs sub-tree crossover with two tree-GP conditions. More... | |
bool | cond_gp_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Dummy general function. More... | |
void | cond_gp_print (const struct XCSF *xcsf, const struct Cl *c) |
Prints a tree-GP condition. More... | |
double | cond_gp_size (const struct XCSF *xcsf, const struct Cl *c) |
Returns the size of a tree-GP condition. More... | |
size_t | cond_gp_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
Writes a tree-GP condition to a file. More... | |
size_t | cond_gp_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
Reads a tree-GP condition from a file. More... | |
char * | cond_gp_json_export (const struct XCSF *xcsf, const struct Cl *c) |
Returns a json formatted string representation of a tree-GP condition. More... | |
char * | cond_gp_param_json_export (const struct XCSF *xcsf) |
Returns a json formatted string of the tree GP parameters. More... | |
char * | cond_gp_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the tree GP parameters from a cJSON object. More... | |
void | cond_gp_param_defaults (struct XCSF *xcsf) |
Initialises default tree GP condition parameters. More... | |
void | cond_gp_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
Creates a tree GP condition from a cJSON object. More... | |
Copies a tree-GP condition from one classifier to another.
[in] | xcsf | XCSF data structure. |
[in] | dest | Destination classifier. |
[in] | src | Source classifier. |
Definition at line 63 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_copy().
Generates a GP tree that matches the current input.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being covered. |
[in] | x | Input state to cover. |
Definition at line 79 of file cond_gp.c.
References Cl::cond, cond_gp_match(), CondGP::gp, tree_free(), and tree_rand().
Performs sub-tree crossover with two tree-GP conditions.
[in] | xcsf | XCSF data structure. |
[in] | c1 | First classifier whose condition is being crossed. |
[in] | c2 | Second classifier whose condition is being crossed. |
Definition at line 145 of file cond_gp.c.
References Cl::cond, CondGP::gp, rand_uniform(), and tree_crossover().
Frees the memory used by a tree-GP condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be freed. |
Definition at line 48 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_free().
Creates and initialises a tree-GP condition.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose condition is to be initialised. |
Definition at line 35 of file cond_gp.c.
References Cl::cond, and tree_rand().
Returns a json formatted string representation of a tree-GP condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be returned. |
Definition at line 242 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_json_export().
Referenced by cond_gp_print().
Creates a tree GP condition from a cJSON object.
[in] | xcsf | The XCSF data structure. |
[in,out] | c | The classifier to initialise. |
[in] | json | cJSON object. |
Definition at line 307 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_json_import().
Reads a tree-GP condition from a file.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be read. |
[in] | fp | Pointer to the file to be read. |
Definition at line 226 of file cond_gp.c.
References Cl::cond, and tree_load().
Calculates whether a GP tree condition matches an input.
Definition at line 113 of file cond_gp.c.
References Cl::cond, CondGP::gp, GPTree::pos, and tree_eval().
Referenced by cond_gp_cover().
Mutates a tree-GP condition with the self-adaptive rate.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being mutated. |
Definition at line 130 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_mutate().
void cond_gp_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default tree GP condition parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 286 of file cond_gp.c.
References tree_args_init(), tree_args_init_constants(), tree_param_set_init_depth(), tree_param_set_max(), tree_param_set_max_len(), tree_param_set_min(), tree_param_set_n_constants(), and tree_param_set_n_inputs().
Referenced by cond_param_defaults().
char* cond_gp_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string of the tree GP parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 262 of file cond_gp.c.
References tree_args_json_export().
Referenced by cond_param_json_export().
char* cond_gp_param_json_import | ( | struct XCSF * | xcsf, |
cJSON * | json | ||
) |
Sets the tree GP parameters from a cJSON object.
[in,out] | xcsf | The XCSF data structure. |
[in] | json | cJSON object. |
Definition at line 274 of file cond_gp.c.
References tree_args_init_constants(), and tree_args_json_import().
Referenced by cond_param_json_import().
Prints a tree-GP condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be printed. |
Definition at line 181 of file cond_gp.c.
References cond_gp_json_export().
Writes a tree-GP condition to a file.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be written. |
[in] | fp | Pointer to the file to be written. |
Definition at line 210 of file cond_gp.c.
References Cl::cond, CondGP::gp, and tree_save().
Returns the size of a tree-GP condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition size to return. |
Definition at line 195 of file cond_gp.c.
References Cl::cond, CondGP::gp, and GPTree::len.