XCSF
1.4.7
XCSF learning classifier system
|
Hyperellipsoid condition functions. More...
Go to the source code of this file.
Data Structures | |
struct | CondEllipsoid |
Hyperellipsoid condition data structure. More... | |
Functions | |
bool | cond_ellipsoid_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Performs uniform crossover with two hyperellipsoid conditions. More... | |
bool | cond_ellipsoid_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Returns whether classifier c1 has a condition more general than c2. More... | |
bool | cond_ellipsoid_match (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Calculates whether a hyperellipsoid condition matches an input. More... | |
bool | cond_ellipsoid_mutate (const struct XCSF *xcsf, const struct Cl *c) |
Mutates a hyperellipsoid condition with the self-adaptive rate. More... | |
void | cond_ellipsoid_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
Copies a hyperellipsoid condition from one classifier to another. More... | |
void | cond_ellipsoid_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Generates a hyperellipsoid that matches the current input. More... | |
void | cond_ellipsoid_free (const struct XCSF *xcsf, const struct Cl *c) |
Frees the memory used by a hyperellipsoid condition. More... | |
void | cond_ellipsoid_init (const struct XCSF *xcsf, struct Cl *c) |
Creates and initialises a hyperellipsoid condition. More... | |
void | cond_ellipsoid_print (const struct XCSF *xcsf, const struct Cl *c) |
Prints a hyperellipsoid condition. More... | |
void | cond_ellipsoid_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
Updates a hyperellipsoid, sliding the centers towards the mean input. More... | |
double | cond_ellipsoid_size (const struct XCSF *xcsf, const struct Cl *c) |
Returns the size of a hyperellipsoid condition. More... | |
size_t | cond_ellipsoid_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
Writes a hyperellipsoid condition to a file. More... | |
size_t | cond_ellipsoid_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
Reads a hyperellipsoid condition from a file. More... | |
char * | cond_ellipsoid_json_export (const struct XCSF *xcsf, const struct Cl *c) |
Returns a json formatted string representation of a hyperellipsoid. More... | |
void | cond_ellipsoid_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
Creates a hyperellipsoid from a cJSON object. More... | |
Variables | |
static struct CondVtbl const | cond_ellipsoid_vtbl |
Hyperellipsoid condition implemented functions. More... | |
Hyperellipsoid condition functions.
Definition in file cond_ellipsoid.h.
Copies a hyperellipsoid condition from one classifier to another.
[in] | xcsf | XCSF data structure. |
[in] | dest | Destination classifier. |
[in] | src | Source classifier. |
Definition at line 103 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, CondEllipsoid::mu, N_MU, and CondEllipsoid::spread.
Generates a hyperellipsoid 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 124 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, rand_uniform(), and CondEllipsoid::spread.
bool cond_ellipsoid_crossover | ( | const struct XCSF * | xcsf, |
const struct Cl * | c1, | ||
const struct Cl * | c2 | ||
) |
Performs uniform crossover with two hyperellipsoid 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 177 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, rand_uniform(), and CondEllipsoid::spread.
Frees the memory used by a hyperellipsoid condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be freed. |
Definition at line 86 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, CondEllipsoid::mu, and CondEllipsoid::spread.
bool cond_ellipsoid_general | ( | const struct XCSF * | xcsf, |
const struct Cl * | c1, | ||
const struct Cl * | c2 | ||
) |
Returns whether classifier c1 has a condition more general than c2.
[in] | xcsf | XCSF data structure. |
[in] | c1 | Classifier whose condition is tested to be more general. |
[in] | c2 | Classifier whose condition is tested to be more specific. |
Definition at line 241 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, cond_ellipsoid_dist(), and CondEllipsoid::spread.
Creates and initialises a hyperellipsoid condition.
Uses the center-spread representation.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be initialised. |
Definition at line 65 of file cond_ellipsoid.c.
References Cl::cond, MU_TYPE, N_MU, rand_uniform(), and sam_init().
Returns a json formatted string representation of a hyperellipsoid.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be returned. |
Definition at line 341 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, CondEllipsoid::mu, N_MU, and CondEllipsoid::spread.
Referenced by cond_ellipsoid_print().
Creates a hyperellipsoid from a cJSON object.
[in] | xcsf | The XCSF data structure. |
[in,out] | c | The classifier to initialise. |
[in] | json | cJSON object. |
Definition at line 364 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, CondEllipsoid::mu, N_MU, sam_json_import(), and CondEllipsoid::spread.
Reads a hyperellipsoid 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 320 of file cond_ellipsoid.c.
Calculates whether a hyperellipsoid condition matches an input.
Definition at line 163 of file cond_ellipsoid.c.
References cond_ellipsoid_dist().
Mutates a hyperellipsoid condition with the self-adaptive rate.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being mutated. |
Definition at line 209 of file cond_ellipsoid.c.
References CondEllipsoid::center, clamp(), Cl::cond, CondEllipsoid::mu, MU_TYPE, N_MU, rand_normal(), sam_adapt(), and CondEllipsoid::spread.
Prints a hyperellipsoid condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be printed. |
Definition at line 274 of file cond_ellipsoid.c.
References cond_ellipsoid_json_export().
Writes a hyperellipsoid 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 302 of file cond_ellipsoid.c.
References CondEllipsoid::center, Cl::cond, CondEllipsoid::mu, N_MU, and CondEllipsoid::spread.
Returns the size of a hyperellipsoid condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition size to return. |
Definition at line 288 of file cond_ellipsoid.c.
void cond_ellipsoid_update | ( | const struct XCSF * | xcsf, |
const struct Cl * | c, | ||
const double * | x, | ||
const double * | y | ||
) |
Updates a hyperellipsoid, sliding the centers towards the mean input.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be updated. |
[in] | x | Input state. |
[in] | y | Truth/payoff value. |
Definition at line 143 of file cond_ellipsoid.c.
References CondEllipsoid::center, and Cl::cond.
|
static |
Hyperellipsoid condition implemented functions.
Definition at line 87 of file cond_ellipsoid.h.
Referenced by condition_set().