XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
rule_dgp.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 "action.h"
27#include "condition.h"
28#include "dgp.h"
29#include "xcsf.h"
30
34struct RuleDGP {
35 struct Graph dgp;
37};
38
39bool
40rule_dgp_cond_crossover(const struct XCSF *xcsf, const struct Cl *c1,
41 const struct Cl *c2);
42
43bool
44rule_dgp_cond_general(const struct XCSF *xcsf, const struct Cl *c1,
45 const struct Cl *c2);
46
47bool
48rule_dgp_cond_match(const struct XCSF *xcsf, const struct Cl *c,
49 const double *x);
50
51bool
52rule_dgp_cond_mutate(const struct XCSF *xcsf, const struct Cl *c);
53
54void
55rule_dgp_cond_copy(const struct XCSF *xcsf, struct Cl *dest,
56 const struct Cl *src);
57
58void
59rule_dgp_cond_cover(const struct XCSF *xcsf, const struct Cl *c,
60 const double *x);
61
62void
63rule_dgp_cond_free(const struct XCSF *xcsf, const struct Cl *c);
64
65void
66rule_dgp_cond_init(const struct XCSF *xcsf, struct Cl *c);
67
68void
69rule_dgp_cond_print(const struct XCSF *xcsf, const struct Cl *c);
70
71void
72rule_dgp_cond_update(const struct XCSF *xcsf, const struct Cl *c,
73 const double *x, const double *y);
74
75double
76rule_dgp_cond_size(const struct XCSF *xcsf, const struct Cl *c);
77
78size_t
79rule_dgp_cond_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
80
81size_t
82rule_dgp_cond_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
83
84char *
85rule_dgp_cond_json_export(const struct XCSF *xcsf, const struct Cl *c);
86
87void
88rule_dgp_cond_json_import(const struct XCSF *xcsf, struct Cl *c,
89 const cJSON *json);
90
104
105bool
106rule_dgp_act_crossover(const struct XCSF *xcsf, const struct Cl *c1,
107 const struct Cl *c2);
108
109bool
110rule_dgp_act_general(const struct XCSF *xcsf, const struct Cl *c1,
111 const struct Cl *c2);
112
113bool
114rule_dgp_act_mutate(const struct XCSF *xcsf, const struct Cl *c);
115
116int
117rule_dgp_act_compute(const struct XCSF *xcsf, const struct Cl *c,
118 const double *x);
119
120void
121rule_dgp_act_copy(const struct XCSF *xcsf, struct Cl *dest,
122 const struct Cl *src);
123
124void
125rule_dgp_act_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x,
126 const int action);
127
128void
129rule_dgp_act_free(const struct XCSF *xcsf, const struct Cl *c);
130
131void
132rule_dgp_act_init(const struct XCSF *xcsf, struct Cl *c);
133
134void
135rule_dgp_act_print(const struct XCSF *xcsf, const struct Cl *c);
136
137void
138rule_dgp_act_update(const struct XCSF *xcsf, const struct Cl *c,
139 const double *x, const double *y);
140
141size_t
142rule_dgp_act_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
143
144size_t
145rule_dgp_act_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
146
147char *
148rule_dgp_act_json_export(const struct XCSF *xcsf, const struct Cl *c);
149
150void
151rule_dgp_act_json_import(const struct XCSF *xcsf, struct Cl *c,
152 const cJSON *json);
153
Interface for classifier actions.
Interface for classifier conditions.
An implementation of dynamical GP graphs with fuzzy activations.
bool rule_dgp_act_mutate(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:276
void rule_dgp_cond_init(const struct XCSF *xcsf, struct Cl *c)
Definition rule_dgp.c:30
bool rule_dgp_cond_mutate(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:92
void rule_dgp_cond_free(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:40
bool rule_dgp_cond_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Definition rule_dgp.c:110
size_t rule_dgp_act_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Definition rule_dgp.c:284
void rule_dgp_act_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Definition rule_dgp.c:201
size_t rule_dgp_act_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Definition rule_dgp.c:293
bool rule_dgp_act_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Definition rule_dgp.c:266
char * rule_dgp_cond_json_export(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:155
static struct ActVtbl const rule_dgp_act_vtbl
Dynamical GP rule action implemented functions.
Definition rule_dgp.h:157
void rule_dgp_cond_print(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:120
void rule_dgp_cond_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Definition rule_dgp.c:49
bool rule_dgp_cond_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Definition rule_dgp.c:100
void rule_dgp_act_init(const struct XCSF *xcsf, struct Cl *c)
Definition rule_dgp.c:187
void rule_dgp_cond_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Definition rule_dgp.c:70
void rule_dgp_act_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Definition rule_dgp.c:246
bool rule_dgp_cond_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Definition rule_dgp.c:80
void rule_dgp_act_print(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:210
void rule_dgp_act_free(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:194
bool rule_dgp_act_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Definition rule_dgp.c:256
void rule_dgp_cond_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Definition rule_dgp.c:61
void rule_dgp_act_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Definition rule_dgp.c:218
char * rule_dgp_act_json_export(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:302
size_t rule_dgp_cond_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Definition rule_dgp.c:136
int rule_dgp_act_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Definition rule_dgp.c:229
void rule_dgp_act_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Definition rule_dgp.c:314
double rule_dgp_cond_size(const struct XCSF *xcsf, const struct Cl *c)
Definition rule_dgp.c:128
static struct CondVtbl const rule_dgp_cond_vtbl
Dynamical GP rule condition implemented functions.
Definition rule_dgp.h:94
size_t rule_dgp_cond_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Definition rule_dgp.c:145
void rule_dgp_cond_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Definition rule_dgp.c:171
Action interface data structure.
Definition action.h:76
Classifier data structure.
Definition xcsf.h:45
Condition interface data structure.
Definition condition.h:104
Dynamical GP graph data structure.
Definition dgp.h:42
int n
Number of nodes.
Definition dgp.h:53
Dynamical GP graph rule data structure.
Definition rule_dgp.h:34
struct Graph dgp
DGP graph.
Definition rule_dgp.h:35
int n_outputs
Number of action nodes (binarised)
Definition rule_dgp.h:36
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.