XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
cond_ellipsoid.h
Go to the documentation of this file.
1/*
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 */
15
24#pragma once
25
26#include "condition.h"
27#include "xcsf.h"
28
33 double *center;
34 double *spread;
35 double *mu;
36};
37
38bool
39cond_ellipsoid_crossover(const struct XCSF *xcsf, const struct Cl *c1,
40 const struct Cl *c2);
41
42bool
43cond_ellipsoid_general(const struct XCSF *xcsf, const struct Cl *c1,
44 const struct Cl *c2);
45
46bool
47cond_ellipsoid_match(const struct XCSF *xcsf, const struct Cl *c,
48 const double *x);
49
50bool
51cond_ellipsoid_mutate(const struct XCSF *xcsf, const struct Cl *c);
52
53void
54cond_ellipsoid_copy(const struct XCSF *xcsf, struct Cl *dest,
55 const struct Cl *src);
56
57void
58cond_ellipsoid_cover(const struct XCSF *xcsf, const struct Cl *c,
59 const double *x);
60
61void
62cond_ellipsoid_free(const struct XCSF *xcsf, const struct Cl *c);
63
64void
65cond_ellipsoid_init(const struct XCSF *xcsf, struct Cl *c);
66
67void
68cond_ellipsoid_print(const struct XCSF *xcsf, const struct Cl *c);
69
70void
71cond_ellipsoid_update(const struct XCSF *xcsf, const struct Cl *c,
72 const double *x, const double *y);
73
74double
75cond_ellipsoid_size(const struct XCSF *xcsf, const struct Cl *c);
76
77size_t
78cond_ellipsoid_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
79
80size_t
81cond_ellipsoid_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
82
83char *
84cond_ellipsoid_json_export(const struct XCSF *xcsf, const struct Cl *c);
85
86void
87cond_ellipsoid_json_import(const struct XCSF *xcsf, struct Cl *c,
88 const cJSON *json);
89
void cond_ellipsoid_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by a hyperellipsoid condition.
size_t cond_ellipsoid_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads a hyperellipsoid condition from a file.
void cond_ellipsoid_print(const struct XCSF *xcsf, const struct Cl *c)
Prints a hyperellipsoid condition.
size_t cond_ellipsoid_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes a hyperellipsoid condition to a file.
char * cond_ellipsoid_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a hyperellipsoid.
bool cond_ellipsoid_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Calculates whether a hyperellipsoid condition matches an input.
void cond_ellipsoid_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates a hyperellipsoid from a cJSON object.
double cond_ellipsoid_size(const struct XCSF *xcsf, const struct Cl *c)
Returns the size of a hyperellipsoid condition.
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.
bool cond_ellipsoid_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Performs uniform crossover with two hyperellipsoid conditions.
bool cond_ellipsoid_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates a hyperellipsoid condition with the self-adaptive rate.
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.
void cond_ellipsoid_init(const struct XCSF *xcsf, struct Cl *c)
Creates and initialises a hyperellipsoid condition.
void cond_ellipsoid_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies a hyperellipsoid condition from one classifier to another.
void cond_ellipsoid_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Generates a hyperellipsoid that matches the current input.
static struct CondVtbl const cond_ellipsoid_vtbl
Hyperellipsoid condition implemented functions.
Interface for classifier conditions.
Classifier data structure.
Definition xcsf.h:45
Hyperellipsoid condition data structure.
double * center
Centers.
double * spread
Spreads.
double * mu
Mutation rates.
Condition interface data structure.
Definition condition.h:104
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.