XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
cond_rectangle.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 *b1;
34 double *b2;
35 double *mu;
36};
37
38bool
39cond_rectangle_crossover(const struct XCSF *xcsf, const struct Cl *c1,
40 const struct Cl *c2);
41
42bool
43cond_rectangle_general(const struct XCSF *xcsf, const struct Cl *c1,
44 const struct Cl *c2);
45
46bool
47cond_rectangle_match(const struct XCSF *xcsf, const struct Cl *c,
48 const double *x);
49
50bool
51cond_rectangle_mutate(const struct XCSF *xcsf, const struct Cl *c);
52
53void
54cond_rectangle_copy(const struct XCSF *xcsf, struct Cl *dest,
55 const struct Cl *src);
56
57void
58cond_rectangle_cover(const struct XCSF *xcsf, const struct Cl *c,
59 const double *x);
60
61void
62cond_rectangle_free(const struct XCSF *xcsf, const struct Cl *c);
63
64void
65cond_rectangle_init(const struct XCSF *xcsf, struct Cl *c);
66
67void
68cond_rectangle_print(const struct XCSF *xcsf, const struct Cl *c);
69
70void
71cond_rectangle_update(const struct XCSF *xcsf, const struct Cl *c,
72 const double *x, const double *y);
73
74double
75cond_rectangle_size(const struct XCSF *xcsf, const struct Cl *c);
76
77size_t
78cond_rectangle_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
79
80size_t
81cond_rectangle_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
82
83char *
84cond_rectangle_json_export(const struct XCSF *xcsf, const struct Cl *c);
85
86void
87cond_rectangle_json_import(const struct XCSF *xcsf, struct Cl *c,
88 const cJSON *json);
89
void cond_rectangle_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies a hyperrectangle condition from one classifier to another.
void cond_rectangle_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by a hyperrectangle condition.
char * cond_rectangle_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a hyperrectangle.
static struct CondVtbl const cond_rectangle_vtbl
Hyperrectangle condition implemented functions.
bool cond_rectangle_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_rectangle_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates a hyperrectangle from a cJSON object.
void cond_rectangle_print(const struct XCSF *xcsf, const struct Cl *c)
Prints a hyperrectangle condition.
void cond_rectangle_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Updates a hyperrectangle, sliding the centers towards the mean input.
void cond_rectangle_init(const struct XCSF *xcsf, struct Cl *c)
Creates and initialises a hyperrectangle condition.
size_t cond_rectangle_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes a hyperrectangle condition to a file.
bool cond_rectangle_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates a hyperrectangle condition with the self-adaptive rate.
bool cond_rectangle_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Performs uniform crossover with two hyperrectangle conditions.
double cond_rectangle_size(const struct XCSF *xcsf, const struct Cl *c)
Returns the size of a hyperrectangle condition.
size_t cond_rectangle_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads a hyperrectangle condition from a file.
void cond_rectangle_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Generates a hyperrectangle that matches the current input.
bool cond_rectangle_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Calculates whether a hyperrectangle condition matches an input.
Interface for classifier conditions.
Classifier data structure.
Definition xcsf.h:45
Hyperrectangle condition data structure.
double * b2
Spreads for CSR, second bound for UBR.
double * mu
Mutation rates.
double * b1
Centers for CSR, first bound for UBR.
Condition interface data structure.
Definition condition.h:104
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.