|
XCSF 1.4.8
XCSF learning classifier system
|
Ternary condition functions. More...
Go to the source code of this file.
Data Structures | |
| struct | CondTernary |
| Ternary condition data structure. More... | |
Functions | |
| void | cond_ternary_param_defaults (struct XCSF *xcsf) |
| Initialises default ternary condition parameters. | |
| char * | cond_ternary_param_json_export (const struct XCSF *xcsf) |
| Returns a json formatted string of the ternary parameters. | |
| char * | cond_ternary_param_json_import (struct XCSF *xcsf, cJSON *json) |
| Sets the ternary parameters from a cJSON object. | |
| bool | cond_ternary_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
| Performs uniform crossover with two ternary conditions. | |
| bool | cond_ternary_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
| Returns whether classifier c1 has a condition more general than c2. | |
| bool | cond_ternary_match (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
| Calculates whether a ternary condition matches an input. | |
| bool | cond_ternary_mutate (const struct XCSF *xcsf, const struct Cl *c) |
| Mutates a ternary condition. | |
| void | cond_ternary_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
| Copies a ternary condition from one classifier to another. | |
| void | cond_ternary_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
| Generates a ternary condition that matches the current input. | |
| void | cond_ternary_free (const struct XCSF *xcsf, const struct Cl *c) |
| Frees the memory used by a ternary condition. | |
| void | cond_ternary_init (const struct XCSF *xcsf, struct Cl *c) |
| Creates and initialises a ternary bitstring condition. | |
| void | cond_ternary_print (const struct XCSF *xcsf, const struct Cl *c) |
| Prints a ternary condition. | |
| void | cond_ternary_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
| Dummy update function. | |
| double | cond_ternary_size (const struct XCSF *xcsf, const struct Cl *c) |
| Returns the size of a ternary condition. | |
| size_t | cond_ternary_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
| Writes a ternary condition to a file. | |
| size_t | cond_ternary_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
| Reads a ternary condition from a file. | |
| char * | cond_ternary_json_export (const struct XCSF *xcsf, const struct Cl *c) |
| Returns a json formatted string representation of a ternary condition. | |
| void | cond_ternary_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
| Creates a ternary condition from a cJSON object. | |
Variables | |
| static struct CondVtbl const | cond_ternary_vtbl |
| Ternary condition implemented functions. | |
Ternary condition functions.
Definition in file cond_ternary.h.
Copies a ternary condition from one classifier to another.
| [in] | xcsf | The XCSF data structure. |
| [in] | dest | The destination classifier. |
| [in] | src | The source classifier. |
Definition at line 99 of file cond_ternary.c.
References Cl::cond, CondTernary::length, CondTernary::mu, N_MU, and CondTernary::string.
Generates a ternary condition that matches the current input.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is being covered. |
| [in] | x | The input state to cover. |
Definition at line 120 of file cond_ternary.c.
References Cl::cond, DONT_CARE, float_to_binary(), rand_uniform(), CondTernary::string, and CondTernary::tmp_input.
| bool cond_ternary_crossover | ( | const struct XCSF * | xcsf, |
| const struct Cl * | c1, | ||
| const struct Cl * | c2 | ||
| ) |
Performs uniform crossover with two ternary conditions.
| [in] | xcsf | The XCSF data structure. |
| [in] | c1 | The first classifier whose condition is being crossed. |
| [in] | c2 | The second classifier whose condition is being crossed. |
Definition at line 185 of file cond_ternary.c.
References Cl::cond, CondTernary::length, rand_uniform(), and CondTernary::string.
Frees the memory used by a ternary condition.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is to be freed. |
Definition at line 82 of file cond_ternary.c.
References Cl::cond, CondTernary::mu, CondTernary::string, and CondTernary::tmp_input.
Returns whether classifier c1 has a condition more general than c2.
| [in] | xcsf | The XCSF data structure. |
| [in] | c1 | The classifier whose condition is tested to be more general. |
| [in] | c2 | The classifier whose condition is tested to be more specific. |
Definition at line 238 of file cond_ternary.c.
References Cl::cond, DONT_CARE, CondTernary::length, and CondTernary::string.
Creates and initialises a ternary bitstring condition.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is to be initialised. |
Definition at line 64 of file cond_ternary.c.
References Cl::cond, cond_ternary_rand(), MU_TYPE, N_MU, and sam_init().
Returns a json formatted string representation of a ternary condition.
| [in] | xcsf | XCSF data structure. |
| [in] | c | Classifier whose condition is to be returned. |
Definition at line 338 of file cond_ternary.c.
References Cl::cond, CondTernary::length, CondTernary::mu, N_MU, and CondTernary::string.
Referenced by cond_ternary_print().
Creates a ternary 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 362 of file cond_ternary.c.
References Cl::cond, CondTernary::length, CondTernary::mu, N_MU, sam_json_import(), and CondTernary::string.
Reads a ternary condition from a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is to be read. |
| [in] | fp | Pointer to the file to be read. |
Definition at line 311 of file cond_ternary.c.
Calculates whether a ternary condition matches an input.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition to match. |
| [in] | x | The input state. |
Definition at line 161 of file cond_ternary.c.
References Cl::cond, DONT_CARE, float_to_binary(), CondTernary::string, and CondTernary::tmp_input.
Mutates a ternary condition.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is being mutated. |
Definition at line 211 of file cond_ternary.c.
References Cl::cond, DONT_CARE, CondTernary::length, CondTernary::mu, MU_TYPE, N_MU, rand_uniform(), sam_adapt(), and CondTernary::string.
| void cond_ternary_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default ternary condition parameters.
| [in] | xcsf | The XCSF data structure. |
Definition at line 426 of file cond_ternary.c.
References cond_param_set_bits(), and cond_param_set_p_dontcare().
Referenced by cond_param_defaults().
| char * cond_ternary_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string of the ternary parameters.
| [in] | xcsf | The XCSF data structure. |
Definition at line 387 of file cond_ternary.c.
References ArgsCond::bits, and ArgsCond::p_dontcare.
Referenced by cond_param_json_export().
| char * cond_ternary_param_json_import | ( | struct XCSF * | xcsf, |
| cJSON * | json | ||
| ) |
Sets the ternary parameters from a cJSON object.
| [in,out] | xcsf | The XCSF data structure. |
| [in] | json | cJSON object. |
Definition at line 405 of file cond_ternary.c.
References cond_param_set_bits(), and cond_param_set_p_dontcare().
Referenced by cond_param_json_import().
Prints a ternary condition.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is to be printed. |
Definition at line 263 of file cond_ternary.c.
References cond_ternary_json_export().
Writes a ternary condition to a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition is to be written. |
| [in] | fp | Pointer to the file to be written. |
Definition at line 292 of file cond_ternary.c.
References Cl::cond, CondTernary::length, CondTernary::mu, N_MU, and CondTernary::string.
Returns the size of a ternary condition.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose condition size to return. |
Definition at line 277 of file cond_ternary.c.
References Cl::cond, and CondTernary::length.
| void cond_ternary_update | ( | const struct XCSF * | xcsf, |
| const struct Cl * | c, | ||
| const double * | x, | ||
| const double * | y | ||
| ) |
Dummy update function.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | Classifier whose condition is to be updated. |
| [in] | x | Input state. |
| [in] | y | Truth/payoff value. |
Definition at line 144 of file cond_ternary.c.
|
static |
Ternary condition implemented functions.
Definition at line 103 of file cond_ternary.h.
Referenced by condition_set().