57 xcsf->population_file = malloc(
sizeof(
char));
58 xcsf->population_file[0] =
'\0';
95 if (
xcsf->population_file != NULL) {
96 free(
xcsf->population_file);
117 cJSON *json = cJSON_CreateObject();
118 cJSON_AddStringToObject(json,
"version", v);
119 cJSON_AddNumberToObject(json,
"x_dim",
xcsf->x_dim);
120 cJSON_AddNumberToObject(json,
"y_dim",
xcsf->y_dim);
121 cJSON_AddNumberToObject(json,
"n_actions",
xcsf->n_actions);
122 cJSON_AddNumberToObject(json,
"omp_num_threads",
xcsf->OMP_NUM_THREADS);
123 cJSON_AddNumberToObject(json,
"random_state",
xcsf->RANDOM_STATE);
124 if (
xcsf->population_file != NULL) {
125 cJSON_AddStringToObject(json,
"population_file",
xcsf->population_file);
127 cJSON_AddBoolToObject(json,
"pop_init",
xcsf->POP_INIT);
128 cJSON_AddNumberToObject(json,
"max_trials",
xcsf->MAX_TRIALS);
129 cJSON_AddNumberToObject(json,
"perf_trials",
xcsf->PERF_TRIALS);
130 cJSON_AddNumberToObject(json,
"pop_size",
xcsf->POP_SIZE);
131 cJSON_AddStringToObject(json,
"loss_func",
134 cJSON_AddNumberToObject(json,
"huber_delta",
xcsf->HUBER_DELTA);
136 if (
xcsf->n_actions > 1) {
137 cJSON_AddNumberToObject(json,
"gamma",
xcsf->GAMMA);
138 cJSON_AddNumberToObject(json,
"teletransportation",
139 xcsf->TELETRANSPORTATION);
140 cJSON_AddNumberToObject(json,
"p_explore",
xcsf->P_EXPLORE);
142 cJSON_AddBoolToObject(json,
"set_subsumption",
xcsf->SET_SUBSUMPTION);
143 cJSON_AddNumberToObject(json,
"theta_sub",
xcsf->THETA_SUB);
144 cJSON_AddNumberToObject(json,
"e0",
xcsf->E0);
145 cJSON_AddNumberToObject(json,
"alpha",
xcsf->ALPHA);
146 cJSON_AddNumberToObject(json,
"nu",
xcsf->NU);
147 cJSON_AddNumberToObject(json,
"beta",
xcsf->BETA);
148 cJSON_AddNumberToObject(json,
"delta",
xcsf->DELTA);
149 cJSON_AddNumberToObject(json,
"theta_del",
xcsf->THETA_DEL);
150 cJSON_AddNumberToObject(json,
"init_fitness",
xcsf->INIT_FITNESS);
151 cJSON_AddNumberToObject(json,
"init_error",
xcsf->INIT_ERROR);
152 cJSON_AddNumberToObject(json,
"m_probation",
xcsf->M_PROBATION);
153 cJSON_AddBoolToObject(json,
"stateful",
xcsf->STATEFUL);
154 cJSON_AddBoolToObject(json,
"compaction",
xcsf->COMPACTION);
156 cJSON *ea_params = cJSON_Parse(ea_param_str);
157 cJSON_AddItemToObject(json,
"ea", ea_params);
159 switch (
xcsf->cond->type) {
165 if (
xcsf->n_actions > 1) {
167 cJSON *act_params = cJSON_Parse(act_param_str);
168 cJSON_AddItemToObject(json,
"action", act_params);
174 cJSON *cond_params = cJSON_Parse(cond_param_str);
175 cJSON_AddItemToObject(json,
"condition", cond_params);
176 free(cond_param_str);
178 cJSON *pred_params = cJSON_Parse(pred_param_str);
179 cJSON_AddItemToObject(json,
"prediction", pred_params);
180 free(pred_param_str);
181 char *
string = cJSON_Print(json);
195 if (strncmp(json->string,
"version\0", 8) == 0) {
197 }
else if (strncmp(json->string,
"x_dim\0", 6) == 0 &&
198 cJSON_IsNumber(json)) {
200 }
else if (strncmp(json->string,
"y_dim\0", 6) == 0 &&
201 cJSON_IsNumber(json)) {
203 }
else if (strncmp(json->string,
"n_actions\0", 10) == 0 &&
204 cJSON_IsNumber(json)) {
206 }
else if (strncmp(json->string,
"omp_num_threads\0", 16) == 0 &&
207 cJSON_IsNumber(json)) {
209 }
else if (strncmp(json->string,
"random_state\0", 13) == 0 &&
210 cJSON_IsNumber(json)) {
212 }
else if (strncmp(json->string,
"population_file\0", 16) == 0 &&
213 cJSON_IsString(json)) {
215 }
else if (strncmp(json->string,
"pop_size\0", 9) == 0 &&
216 cJSON_IsNumber(json)) {
218 }
else if (strncmp(json->string,
"max_trials\0", 11) == 0 &&
219 cJSON_IsNumber(json)) {
221 }
else if (strncmp(json->string,
"pop_init\0", 9) == 0 &&
222 cJSON_IsBool(json)) {
223 const bool init =
true ? json->type == cJSON_True :
false;
225 }
else if (strncmp(json->string,
"perf_trials\0", 12) == 0 &&
226 cJSON_IsNumber(json)) {
228 }
else if (strncmp(json->string,
"loss_func\0", 10) == 0 &&
229 cJSON_IsString(json)) {
232 printf(
"Invalid loss function: %s\n", json->valuestring);
236 }
else if (strncmp(json->string,
"huber_delta\0", 12) == 0 &&
237 cJSON_IsNumber(json)) {
255 if (strncmp(json->string,
"teletransportation\0", 19) == 0 &&
256 cJSON_IsNumber(json)) {
258 }
else if (strncmp(json->string,
"gamma\0", 6) == 0 &&
259 cJSON_IsNumber(json)) {
261 }
else if (strncmp(json->string,
"p_explore\0", 10) == 0 &&
262 cJSON_IsNumber(json)) {
280 if (strncmp(json->string,
"set_subsumption\0", 16) == 0 &&
281 cJSON_IsBool(json)) {
282 const bool sub =
true ? json->type == cJSON_True :
false;
284 }
else if (strncmp(json->string,
"theta_sub\0", 10) == 0 &&
285 cJSON_IsNumber(json)) {
303 if (strncmp(json->string,
"alpha\0", 6) == 0 && cJSON_IsNumber(json)) {
305 }
else if (strncmp(json->string,
"beta\0", 5) == 0 &&
306 cJSON_IsNumber(json)) {
308 }
else if (strncmp(json->string,
"delta\0", 6) == 0 &&
309 cJSON_IsNumber(json)) {
311 }
else if (strncmp(json->string,
"nu\0", 3) == 0 && cJSON_IsNumber(json)) {
313 }
else if (strncmp(json->string,
"theta_del\0", 10) == 0 &&
314 cJSON_IsNumber(json)) {
316 }
else if (strncmp(json->string,
"init_fitness\0", 13) == 0 &&
317 cJSON_IsNumber(json)) {
319 }
else if (strncmp(json->string,
"init_error\0", 11) == 0 &&
320 cJSON_IsNumber(json)) {
322 }
else if (strncmp(json->string,
"e0\0", 3) == 0 && cJSON_IsNumber(json)) {
324 }
else if (strncmp(json->string,
"m_probation\0", 12) == 0 &&
325 cJSON_IsNumber(json)) {
327 }
else if (strncmp(json->string,
"stateful\0", 9) == 0 &&
328 cJSON_IsBool(json)) {
329 const bool stateful =
true ? json->type == cJSON_True :
false;
331 }
else if (strncmp(json->string,
"compaction\0", 11) == 0 &&
332 cJSON_IsBool(json)) {
333 const bool compact =
true ? json->type == cJSON_True :
false;
349 cJSON *token = cJSON_GetObjectItem(json,
"type");
351 printf(
"No action type has been specified: cannot set params\n");
354 if (!cJSON_IsString(token) ||
357 printf(
"Invalid action type\n");
361 token = cJSON_GetObjectItem(json,
"args");
365 printf(
"Invalid action parameter %s\n", ret);
379 cJSON *token = cJSON_GetObjectItem(json,
"type");
381 printf(
"No condition type has been specified: cannot set params\n");
384 if (!cJSON_IsString(token) ||
387 printf(
"Invalid condition type\n");
391 token = cJSON_GetObjectItem(json,
"args");
395 printf(
"Invalid condition parameter %s\n", ret);
409 cJSON *token = cJSON_GetObjectItem(json,
"type");
411 printf(
"No prediction type has been specified: cannot set params\n");
414 if (!cJSON_IsString(token) ||
417 printf(
"Invalid prediction type\n");
421 token = cJSON_GetObjectItem(json,
"args");
425 printf(
"Invalid prediction parameter %s\n", ret);
439 cJSON *json = cJSON_Parse(json_str);
441 for (cJSON *iter = json->child; iter != NULL; iter = iter->next) {
454 if (strncmp(iter->string,
"ea\0", 3) == 0) {
458 if (strncmp(iter->string,
"action\0", 7) == 0) {
462 if (strncmp(iter->string,
"condition\0", 10) == 0) {
466 if (strncmp(iter->string,
"prediction\0", 11) == 0) {
470 printf(
"Error: unable to import parameter: %s\n", iter->string);
484 printf(
"%s\n", json_str);
498 size_t len = strnlen(
xcsf->population_file,
MAX_LEN) + 1;
499 s += fwrite(&len,
sizeof(
size_t), 1, fp);
500 s += fwrite(
xcsf->population_file,
sizeof(
char), len, fp);
501 s += fwrite(&
xcsf->time,
sizeof(
int), 1, fp);
502 s += fwrite(&
xcsf->error,
sizeof(
double), 1, fp);
503 s += fwrite(&
xcsf->mset_size,
sizeof(
double), 1, fp);
504 s += fwrite(&
xcsf->aset_size,
sizeof(
double), 1, fp);
505 s += fwrite(&
xcsf->mfrac,
sizeof(
double), 1, fp);
506 s += fwrite(&
xcsf->explore,
sizeof(
bool), 1, fp);
507 s += fwrite(&
xcsf->x_dim,
sizeof(
int), 1, fp);
508 s += fwrite(&
xcsf->y_dim,
sizeof(
int), 1, fp);
509 s += fwrite(&
xcsf->n_actions,
sizeof(
int), 1, fp);
510 s += fwrite(&
xcsf->OMP_NUM_THREADS,
sizeof(
int), 1, fp);
511 s += fwrite(&
xcsf->RANDOM_STATE,
sizeof(
int), 1, fp);
512 s += fwrite(&
xcsf->POP_INIT,
sizeof(
bool), 1, fp);
513 s += fwrite(&
xcsf->MAX_TRIALS,
sizeof(
int), 1, fp);
514 s += fwrite(&
xcsf->PERF_TRIALS,
sizeof(
int), 1, fp);
515 s += fwrite(&
xcsf->POP_SIZE,
sizeof(
int), 1, fp);
516 s += fwrite(&
xcsf->LOSS_FUNC,
sizeof(
int), 1, fp);
517 s += fwrite(&
xcsf->HUBER_DELTA,
sizeof(
double), 1, fp);
518 s += fwrite(&
xcsf->GAMMA,
sizeof(
double), 1, fp);
519 s += fwrite(&
xcsf->TELETRANSPORTATION,
sizeof(
int), 1, fp);
520 s += fwrite(&
xcsf->P_EXPLORE,
sizeof(
double), 1, fp);
521 s += fwrite(&
xcsf->SET_SUBSUMPTION,
sizeof(
bool), 1, fp);
522 s += fwrite(&
xcsf->THETA_SUB,
sizeof(
int), 1, fp);
523 s += fwrite(&
xcsf->E0,
sizeof(
double), 1, fp);
524 s += fwrite(&
xcsf->ALPHA,
sizeof(
double), 1, fp);
525 s += fwrite(&
xcsf->NU,
sizeof(
double), 1, fp);
526 s += fwrite(&
xcsf->BETA,
sizeof(
double), 1, fp);
527 s += fwrite(&
xcsf->DELTA,
sizeof(
double), 1, fp);
528 s += fwrite(&
xcsf->THETA_DEL,
sizeof(
int), 1, fp);
529 s += fwrite(&
xcsf->INIT_FITNESS,
sizeof(
double), 1, fp);
530 s += fwrite(&
xcsf->INIT_ERROR,
sizeof(
double), 1, fp);
531 s += fwrite(&
xcsf->M_PROBATION,
sizeof(
int), 1, fp);
532 s += fwrite(&
xcsf->STATEFUL,
sizeof(
bool), 1, fp);
533 s += fwrite(&
xcsf->COMPACTION,
sizeof(
bool), 1, fp);
552 s += fread(&len,
sizeof(
size_t), 1, fp);
554 printf(
"param_load(): error len < 1\n");
557 free(
xcsf->population_file);
558 xcsf->population_file = malloc(
sizeof(
char) * len);
559 s += fread(
xcsf->population_file,
sizeof(
char), len, fp);
560 s += fread(&
xcsf->time,
sizeof(
int), 1, fp);
561 s += fread(&
xcsf->error,
sizeof(
double), 1, fp);
562 s += fread(&
xcsf->mset_size,
sizeof(
double), 1, fp);
563 s += fread(&
xcsf->aset_size,
sizeof(
double), 1, fp);
564 s += fread(&
xcsf->mfrac,
sizeof(
double), 1, fp);
565 s += fread(&
xcsf->explore,
sizeof(
bool), 1, fp);
566 s += fread(&
xcsf->x_dim,
sizeof(
int), 1, fp);
567 s += fread(&
xcsf->y_dim,
sizeof(
int), 1, fp);
568 s += fread(&
xcsf->n_actions,
sizeof(
int), 1, fp);
569 if (
xcsf->x_dim < 1 ||
xcsf->y_dim < 1 ||
xcsf->n_actions < 1) {
570 printf(
"param_load(): read error\n");
573 s += fread(&
xcsf->OMP_NUM_THREADS,
sizeof(
int), 1, fp);
574 s += fread(&
xcsf->RANDOM_STATE,
sizeof(
int), 1, fp);
575 s += fread(&
xcsf->POP_INIT,
sizeof(
bool), 1, fp);
576 s += fread(&
xcsf->MAX_TRIALS,
sizeof(
int), 1, fp);
577 s += fread(&
xcsf->PERF_TRIALS,
sizeof(
int), 1, fp);
578 s += fread(&
xcsf->POP_SIZE,
sizeof(
int), 1, fp);
579 s += fread(&
xcsf->LOSS_FUNC,
sizeof(
int), 1, fp);
580 s += fread(&
xcsf->HUBER_DELTA,
sizeof(
double), 1, fp);
581 s += fread(&
xcsf->GAMMA,
sizeof(
double), 1, fp);
582 s += fread(&
xcsf->TELETRANSPORTATION,
sizeof(
int), 1, fp);
583 s += fread(&
xcsf->P_EXPLORE,
sizeof(
double), 1, fp);
584 s += fread(&
xcsf->SET_SUBSUMPTION,
sizeof(
bool), 1, fp);
585 s += fread(&
xcsf->THETA_SUB,
sizeof(
int), 1, fp);
586 s += fread(&
xcsf->E0,
sizeof(
double), 1, fp);
587 s += fread(&
xcsf->ALPHA,
sizeof(
double), 1, fp);
588 s += fread(&
xcsf->NU,
sizeof(
double), 1, fp);
589 s += fread(&
xcsf->BETA,
sizeof(
double), 1, fp);
590 s += fread(&
xcsf->DELTA,
sizeof(
double), 1, fp);
591 s += fread(&
xcsf->THETA_DEL,
sizeof(
int), 1, fp);
592 s += fread(&
xcsf->INIT_FITNESS,
sizeof(
double), 1, fp);
593 s += fread(&
xcsf->INIT_ERROR,
sizeof(
double), 1, fp);
594 s += fread(&
xcsf->M_PROBATION,
sizeof(
int), 1, fp);
595 s += fread(&
xcsf->STATEFUL,
sizeof(
bool), 1, fp);
596 s += fread(&
xcsf->COMPACTION,
sizeof(
bool), 1, fp);
616 if (a < 1 || a > 1000) {
617 return "Invalid OMP_NUM_THREADS. Range: [1,1000]";
619 xcsf->OMP_NUM_THREADS = a;
621 omp_set_num_threads(
xcsf->OMP_NUM_THREADS);
629 xcsf->RANDOM_STATE = a;
641 free(
xcsf->population_file);
642 size_t length = strnlen(a,
sizeof(
char) *
MAX_LEN) + 1;
643 xcsf->population_file = malloc(
sizeof(
char) * length);
644 strncpy(
xcsf->population_file, a, length);
659 return "MAX_TRIALS must be > 0";
661 xcsf->MAX_TRIALS = a;
669 return "PERF_TRIALS must be > 0";
671 xcsf->PERF_TRIALS = a;
679 return "POP_SIZE must be > 0";
690 xcsf->LOSS_FUNC = loss;
702 printf(
"param_set_loss_func(): invalid LOSS_FUNC: %d\n", a);
719 xcsf->COMPACTION = a;
727 return "HUBER_DELTA must be >= 0";
729 xcsf->HUBER_DELTA = a;
736 if (a < 0 || a > 1) {
737 return "Invalid GAMMA. Range: [0,1]";
747 return "TELETRANSPORTATION must be > 0";
749 xcsf->TELETRANSPORTATION = a;
756 if (a < 0 || a > 1) {
757 return "Invalid P_EXPLORE. Range: [0,1]";
766 if (a < 0 || a > 1) {
767 return "Invalid ALPHA. Range: [0,1]";
776 if (a < 0 || a > 1) {
777 return "Invalid BETA. Range: [0,1]";
786 if (a < 0 || a > 1) {
787 return "Invalid DELTA. Range: [0,1]";
797 return "E0 must be >= 0";
807 return "INIT_ERROR must be >= 0";
809 xcsf->INIT_ERROR = a;
817 return "INIT_FITNESS must be >= 0";
819 xcsf->INIT_FITNESS = a;
827 return "NU must be >= 0";
837 return "THETA_DEL must be >= 0";
847 return "M_PROBATION must be >= 0";
849 xcsf->M_PROBATION = a;
856 xcsf->SET_SUBSUMPTION = a;
864 return "THETA_SUB must be >= 0";
874 return "x_dim must be > 0";
891 return "y_dim must be > 0";
901 return "n_actions must be > 0";
size_t action_param_load(struct XCSF *xcsf, FILE *fp)
Loads action parameters.
char * action_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the action parameters from a cJSON object.
size_t action_param_save(const struct XCSF *xcsf, FILE *fp)
Saves action parameters.
int action_param_set_type_string(struct XCSF *xcsf, const char *a)
void action_param_defaults(struct XCSF *xcsf)
Initialises default action parameters.
void action_param_free(struct XCSF *xcsf)
Frees action parameters.
char * action_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string of the action parameters.
Interface for classifier actions.
#define ACT_TYPE_INVALID
Error code for invalid actions.
char * cond_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the condition parameters from a cJSON object.
size_t cond_param_load(struct XCSF *xcsf, FILE *fp)
Loads condition parameters.
size_t cond_param_save(const struct XCSF *xcsf, FILE *fp)
Saves condition parameters.
int cond_param_set_type_string(struct XCSF *xcsf, const char *a)
char * cond_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string of the condition parameters.
void cond_param_defaults(struct XCSF *xcsf)
Initialises default condition parameters.
void cond_param_free(struct XCSF *xcsf)
Frees condition parameters.
Interface for classifier conditions.
#define COND_TYPE_INVALID
Error code for invalid condition.
#define RULE_TYPE_NEURAL
Condition type and action type neural.
#define RULE_TYPE_DGP
Condition type and action type DGP.
#define RULE_TYPE_NETWORK
Condition type and prediction type neural.
#define COND_TYPE_OPTIONS
void ea_param_defaults(struct XCSF *xcsf)
Initialises default evolutionary algorithm parameters.
char * ea_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string representation of the EA parameters.
size_t ea_param_load(struct XCSF *xcsf, FILE *fp)
Loads evolutionary algorithm parameters.
size_t ea_param_save(const struct XCSF *xcsf, FILE *fp)
Saves evolutionary algorithm parameters.
void ea_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the EA parameters from a cJSON object.
Evolutionary algorithm functions.
int loss_type_as_int(const char *type)
Returns the integer representation of a loss type given a name.
int loss_set_func(struct XCSF *xcsf)
Sets the XCSF error function to the implemented function.
const char * loss_type_as_string(const int type)
Returns a string representation of a loss type from the integer.
#define LOSS_NUM
Total number of selectable loss functions.
#define LOSS_MAE
Mean absolute error.
#define LOSS_HUBER
Huber loss.
#define LOSS_INVALID
Error code for invalid loss type.
const char * param_set_e0(struct XCSF *xcsf, const double a)
const char * param_set_perf_trials(struct XCSF *xcsf, const int a)
const char * param_set_population_file(struct XCSF *xcsf, const char *a)
void param_json_import(struct XCSF *xcsf, const char *json_str)
Sets the parameters from a json formatted string.
const char * param_set_nu(struct XCSF *xcsf, const double a)
void param_print(const struct XCSF *xcsf)
Prints all XCSF parameters.
const char * param_set_stateful(struct XCSF *xcsf, const bool a)
const char * param_set_set_subsumption(struct XCSF *xcsf, const bool a)
const char * param_set_beta(struct XCSF *xcsf, const double a)
const char * param_set_max_trials(struct XCSF *xcsf, const int a)
const char * param_set_pop_size(struct XCSF *xcsf, const int a)
const char * param_set_explore(struct XCSF *xcsf, const bool a)
const char * param_set_random_state(struct XCSF *xcsf, const int a)
const char * param_set_m_probation(struct XCSF *xcsf, const int a)
const char * param_set_y_dim(struct XCSF *xcsf, const int a)
const char * param_set_omp_num_threads(struct XCSF *xcsf, const int a)
Sets the number of OMP threads.
const char * param_set_init_fitness(struct XCSF *xcsf, const double a)
static bool param_json_import_multi(struct XCSF *xcsf, const cJSON *json)
Sets the multi-step parameters from a cJSON object.
void param_set_loss_func(struct XCSF *xcsf, const int a)
static void param_json_import_action(struct XCSF *xcsf, cJSON *json)
Sets the action parameters from a json formatted string.
const char * param_set_huber_delta(struct XCSF *xcsf, const double a)
const char * param_set_gamma(struct XCSF *xcsf, const double a)
const char * param_set_teletransportation(struct XCSF *xcsf, const int a)
char * param_json_export(const struct XCSF *xcsf)
Returns a json formatted string representation of the parameters.
static void param_json_import_condition(struct XCSF *xcsf, cJSON *json)
Sets the condition parameters from a json formatted string.
const char * param_set_compaction(struct XCSF *xcsf, const bool a)
static bool param_json_import_cl_general(struct XCSF *xcsf, const cJSON *json)
Sets the general classifier parameters from a cJSON object.
const char * param_set_init_error(struct XCSF *xcsf, const double a)
const char * param_set_p_explore(struct XCSF *xcsf, const double a)
#define MAX_LEN
Maximum length of a population filename.
static void param_json_import_prediction(struct XCSF *xcsf, cJSON *json)
Sets the prediction parameters from a json formatted string.
const char * param_set_theta_del(struct XCSF *xcsf, const int a)
const char * param_set_n_actions(struct XCSF *xcsf, const int a)
int param_set_loss_func_string(struct XCSF *xcsf, const char *a)
static bool param_json_import_subsump(struct XCSF *xcsf, const cJSON *json)
Sets the subsumption parameters from a cJSON object.
void param_init(struct XCSF *xcsf, const int x_dim, const int y_dim, const int n_actions)
Initialises default XCSF parameters.
void param_free(struct XCSF *xcsf)
const char * param_set_alpha(struct XCSF *xcsf, const double a)
static bool param_json_import_general(struct XCSF *xcsf, const cJSON *json)
Sets the general parameters from a cJSON object.
const char * param_set_x_dim(struct XCSF *xcsf, const int a)
size_t param_load(struct XCSF *xcsf, FILE *fp)
Reads the XCSF data structure from a file.
const char * param_set_delta(struct XCSF *xcsf, const double a)
size_t param_save(const struct XCSF *xcsf, FILE *fp)
Writes the XCSF data structure to a file.
const char * param_set_theta_sub(struct XCSF *xcsf, const int a)
const char * param_set_pop_init(struct XCSF *xcsf, const bool a)
Functions for setting and printing parameters.
#define PARAM_FOUND
Code for a found parameter.
#define PARAM_INVALID
Code for invalid parameter.
size_t pred_param_load(struct XCSF *xcsf, FILE *fp)
Loads prediction parameters.
void pred_param_free(struct XCSF *xcsf)
Frees prediction parameters.
size_t pred_param_save(const struct XCSF *xcsf, FILE *fp)
Saves prediction parameters.
int pred_param_set_type_string(struct XCSF *xcsf, const char *a)
char * pred_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the prediction parameters from a cJSON object.
void pred_param_defaults(struct XCSF *xcsf)
Initialises default prediction parameters.
char * pred_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string of the prediction parameters.
Interface for classifier predictions.
#define PRED_TYPE_OPTIONS
#define PRED_TYPE_INVALID
Error code for invalid prediction.
Parameters for initialising and operating actions.
Parameters for initialising and operating conditions.
Parameters for operating the evolutionary algorithm.
Parameters for initialising and operating predictions.
void rand_init(void)
Initialises the pseudo-random number generator.
void utils_json_parse_check(const cJSON *json)
Checks whether JSON parsed correctly.
void rand_init_seed(const uint32_t seed)
Initialises the pseudo-random number generator with a fixed seed.
Utility functions for random number handling, etc.
static void catch_error(const char *ret)
Catches parameter value errors.
static const int VERSION_MINOR
XCSF minor version number.
static const int VERSION_MAJOR
XCSF major version number.
static const int VERSION_BUILD
XCSF build version number.