XCSF  1.4.7
XCSF learning classifier system
clset.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 "xcsf.h"
27 
28 double
29 clset_mean_cond_size(const struct XCSF *xcsf, const struct Set *set);
30 
31 double
32 clset_mean_pred_size(const struct XCSF *xcsf, const struct Set *set);
33 
34 double
35 clset_mean_time(const struct Set *set);
36 
37 double
38 clset_mfrac(const struct XCSF *xcsf);
39 
40 double
41 clset_total_fit(const struct Set *set);
42 
43 size_t
44 clset_pset_load(struct XCSF *xcsf, FILE *fp);
45 
46 size_t
47 clset_pset_save(const struct XCSF *xcsf, FILE *fp);
48 
49 void
50 clset_action(struct XCSF *xcsf, const int action);
51 
52 void
53 clset_add(struct Set *set, struct Cl *c);
54 
55 void
56 clset_free(struct Set *set);
57 
58 void
59 clset_init(struct Set *set);
60 
61 void
62 clset_kill(const struct XCSF *xcsf, struct Set *set);
63 
64 void
65 clset_match(struct XCSF *xcsf, const double *x, const bool cover);
66 
67 void
69 
70 void
71 clset_pset_init(struct XCSF *xcsf);
72 
73 void
74 clset_print(const struct XCSF *xcsf, const struct Set *set,
75  const bool print_cond, const bool print_act, const bool print_pred);
76 
77 void
78 clset_set_times(const struct XCSF *xcsf, const struct Set *set);
79 
80 void
81 clset_update(struct XCSF *xcsf, struct Set *set, const double *x,
82  const double *y, const bool cur);
83 
84 void
85 clset_validate(struct Set *set);
86 
87 char *
88 clset_json_export(const struct XCSF *xcsf, const struct Set *set,
89  const bool return_cond, const bool return_act,
90  const bool return_pred);
91 
92 void
93 clset_json_insert_cl(struct XCSF *xcsf, const cJSON *json);
94 
95 void
96 clset_json_insert(struct XCSF *xcsf, const char *json_str);
double clset_mean_pred_size(const struct XCSF *xcsf, const struct Set *set)
Calculates the mean prediction size of classifiers in the set.
Definition: clset.c:693
void clset_pset_init(struct XCSF *xcsf)
Initialises a new population of random classifiers.
Definition: clset.c:308
void clset_kill(const struct XCSF *xcsf, struct Set *set)
Frees the set and the classifiers.
Definition: clset.c:590
void clset_update(struct XCSF *xcsf, struct Set *set, const double *x, const double *y, const bool cur)
Provides reinforcement to the set and performs set subsumption.
Definition: clset.c:448
double clset_total_fit(const struct Set *set)
Calculates the total fitness of classifiers in the set.
Definition: clset.c:545
double clset_mean_time(const struct Set *set)
Calculates the mean time stamp of classifiers in the set.
Definition: clset.c:562
void clset_validate(struct Set *set)
Removes classifiers with 0 numerosity from the set.
Definition: clset.c:480
void clset_pset_enforce_limit(struct XCSF *xcsf)
Enforces the maximum population size limit.
Definition: clset.c:340
void clset_add(struct Set *set, struct Cl *c)
Adds a classifier to the set.
Definition: clset.c:423
void clset_action(struct XCSF *xcsf, const int action)
Constructs the action set from the match set.
Definition: clset.c:404
void clset_print(const struct XCSF *xcsf, const struct Set *set, const bool print_cond, const bool print_act, const bool print_pred)
Prints the classifiers in the set.
Definition: clset.c:515
double clset_mean_cond_size(const struct XCSF *xcsf, const struct Set *set)
Calculates the mean condition size of classifiers in the set.
Definition: clset.c:673
void clset_json_insert(struct XCSF *xcsf, const char *json_str)
Creates classifiers from JSON and inserts into the population.
Definition: clset.c:796
size_t clset_pset_save(const struct XCSF *xcsf, FILE *fp)
Writes the population set to a file.
Definition: clset.c:610
void clset_init(struct Set *set)
Initialises a new set.
Definition: clset.c:328
void clset_set_times(const struct XCSF *xcsf, const struct Set *set)
Sets the time stamps for classifiers in the set.
Definition: clset.c:530
double clset_mfrac(const struct XCSF *xcsf)
Returns the fraction of inputs matched by the most general rule with error below E0....
Definition: clset.c:713
void clset_match(struct XCSF *xcsf, const double *x, const bool cover)
Constructs the match set - forward propagates conditions and actions.
Definition: clset.c:356
void clset_free(struct Set *set)
Frees the set, but not the classifiers.
Definition: clset.c:572
void clset_json_insert_cl(struct XCSF *xcsf, const cJSON *json)
Creates a classifier from cJSON and inserts in the population set.
Definition: clset.c:780
char * clset_json_export(const struct XCSF *xcsf, const struct Set *set, const bool return_cond, const bool return_act, const bool return_pred)
Returns a json formatted string representation of a classifier set.
Definition: clset.c:754
size_t clset_pset_load(struct XCSF *xcsf, FILE *fp)
Reads the population set from a file.
Definition: clset.c:649
Definition: __init__.py:1
Classifier data structure.
Definition: xcsf.h:45
Classifier set.
Definition: xcsf.h:76
XCSF data structure.
Definition: xcsf.h:85
XCSF data structures.