XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
act_integer.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 "xcsf.h"
28
32struct ActInteger {
33 int action;
34 double *mu;
35};
36
37bool
38act_integer_crossover(const struct XCSF *xcsf, const struct Cl *c1,
39 const struct Cl *c2);
40
41bool
42act_integer_general(const struct XCSF *xcsf, const struct Cl *c1,
43 const struct Cl *c2);
44
45bool
46act_integer_mutate(const struct XCSF *xcsf, const struct Cl *c);
47
48int
49act_integer_compute(const struct XCSF *xcsf, const struct Cl *c,
50 const double *x);
51
52void
53act_integer_copy(const struct XCSF *xcsf, struct Cl *dest,
54 const struct Cl *src);
55
56void
57act_integer_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x,
58 const int action);
59
60void
61act_integer_free(const struct XCSF *xcsf, const struct Cl *c);
62
63void
64act_integer_init(const struct XCSF *xcsf, struct Cl *c);
65
66void
67act_integer_print(const struct XCSF *xcsf, const struct Cl *c);
68
69void
70act_integer_update(const struct XCSF *xcsf, const struct Cl *c, const double *x,
71 const double *y);
72
73size_t
74act_integer_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
75
76size_t
77act_integer_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
78
79char *
80act_integer_json_export(const struct XCSF *xcsf, const struct Cl *c);
81
82void
83act_integer_json_import(const struct XCSF *xcsf, struct Cl *c,
84 const cJSON *json);
85
void act_integer_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies an integer action from one classifier to another.
void act_integer_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by an integer action.
bool act_integer_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy function since integer actions do not perform crossover.
Definition act_integer.c:43
int act_integer_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Returns a classifier's integer action.
size_t act_integer_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes an integer action to a file.
void act_integer_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Dummy function since integer actions are not updated.
void act_integer_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates an integer action from a cJSON object.
static struct ActVtbl const act_integer_vtbl
Integer action implemented functions.
Definition act_integer.h:89
void act_integer_init(const struct XCSF *xcsf, struct Cl *c)
Initialises an integer action.
bool act_integer_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates an integer action.
Definition act_integer.c:79
bool act_integer_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Returns whether the action of classifier c1 is more general than c2.
Definition act_integer.c:60
char * act_integer_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of an integer action.
size_t act_integer_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads an integer action from a file.
void act_integer_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Sets an integer action to a specified value.
void act_integer_print(const struct XCSF *xcsf, const struct Cl *c)
Prints an integer action.
Interface for classifier actions.
Integer action data structure.
Definition act_integer.h:32
int action
Integer action.
Definition act_integer.h:33
double * mu
Mutation rates.
Definition act_integer.h:34
Action interface data structure.
Definition action.h:76
Classifier data structure.
Definition xcsf.h:45
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.