XCSF  1.4.7
XCSF learning classifier system
cond_dummy.c
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 #include "cond_dummy.h"
25 #include "utils.h"
26 
32 void
33 cond_dummy_init(const struct XCSF *xcsf, struct Cl *c)
34 {
35  (void) xcsf;
36  (void) c;
37 }
38 
44 void
45 cond_dummy_free(const struct XCSF *xcsf, const struct Cl *c)
46 {
47  (void) xcsf;
48  (void) c;
49 }
50 
57 void
58 cond_dummy_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
59 {
60  (void) xcsf;
61  (void) dest;
62  (void) src;
63 }
64 
71 void
72 cond_dummy_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
73 {
74  (void) xcsf;
75  (void) c;
76  (void) x;
77 }
78 
86 void
87 cond_dummy_update(const struct XCSF *xcsf, const struct Cl *c, const double *x,
88  const double *y)
89 {
90  (void) xcsf;
91  (void) c;
92  (void) x;
93  (void) y;
94 }
95 
103 bool
104 cond_dummy_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
105 {
106  (void) xcsf;
107  (void) c;
108  (void) x;
109  return true;
110 }
111 
119 bool
120 cond_dummy_crossover(const struct XCSF *xcsf, const struct Cl *c1,
121  const struct Cl *c2)
122 {
123  (void) xcsf;
124  (void) c1;
125  (void) c2;
126  return false;
127 }
128 
135 bool
136 cond_dummy_mutate(const struct XCSF *xcsf, const struct Cl *c)
137 {
138  (void) xcsf;
139  (void) c;
140  return false;
141 }
142 
150 bool
151 cond_dummy_general(const struct XCSF *xcsf, const struct Cl *c1,
152  const struct Cl *c2)
153 {
154  (void) xcsf;
155  (void) c1;
156  (void) c2;
157  return false;
158 }
159 
165 void
166 cond_dummy_print(const struct XCSF *xcsf, const struct Cl *c)
167 {
168  char *json_str = cond_dummy_json_export(xcsf, c);
169  printf("%s\n", json_str);
170  free(json_str);
171 }
172 
179 double
180 cond_dummy_size(const struct XCSF *xcsf, const struct Cl *c)
181 {
182  (void) xcsf;
183  (void) c;
184  return 0;
185 }
186 
194 size_t
195 cond_dummy_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
196 {
197  (void) xcsf;
198  (void) c;
199  (void) fp;
200  return 0;
201 }
202 
210 size_t
211 cond_dummy_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
212 {
213  (void) xcsf;
214  (void) c;
215  (void) fp;
216  return 0;
217 }
218 
225 char *
226 cond_dummy_json_export(const struct XCSF *xcsf, const struct Cl *c)
227 {
228  (void) xcsf;
229  (void) c;
230  cJSON *json = cJSON_CreateObject();
231  cJSON_AddStringToObject(json, "type", "dummy");
232  char *string = cJSON_Print(json);
233  cJSON_Delete(json);
234  return string;
235 }
236 
243 void
244 cond_dummy_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
245 {
246  (void) xcsf;
247  (void) c;
248  (void) json;
249 }
char * cond_dummy_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a dummy condition.
Definition: cond_dummy.c:226
void cond_dummy_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Dummy cover function.
Definition: cond_dummy.c:72
void cond_dummy_init(const struct XCSF *xcsf, struct Cl *c)
Dummy initialisation function.
Definition: cond_dummy.c:33
bool cond_dummy_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy crossover function.
Definition: cond_dummy.c:120
bool cond_dummy_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Dummy match function.
Definition: cond_dummy.c:104
bool cond_dummy_mutate(const struct XCSF *xcsf, const struct Cl *c)
Dummy mutate function.
Definition: cond_dummy.c:136
void cond_dummy_print(const struct XCSF *xcsf, const struct Cl *c)
Dummy print function.
Definition: cond_dummy.c:166
void cond_dummy_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Dummy copy function.
Definition: cond_dummy.c:58
size_t cond_dummy_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Dummy save function.
Definition: cond_dummy.c:195
bool cond_dummy_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy general function.
Definition: cond_dummy.c:151
double cond_dummy_size(const struct XCSF *xcsf, const struct Cl *c)
Dummy size function.
Definition: cond_dummy.c:180
void cond_dummy_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Dummy update function.
Definition: cond_dummy.c:87
size_t cond_dummy_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Dummy load function.
Definition: cond_dummy.c:211
void cond_dummy_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Dummy import function.
Definition: cond_dummy.c:244
void cond_dummy_free(const struct XCSF *xcsf, const struct Cl *c)
Dummy free function.
Definition: cond_dummy.c:45
Always-matching dummy condition functions.
Definition: __init__.py:1
Classifier data structure.
Definition: xcsf.h:45
XCSF data structure.
Definition: xcsf.h:85
Utility functions for random number handling, etc.