XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
env.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 "env_csv.h"
25#include "env_maze.h"
26#include "env_mux.h"
27
33void
34env_init(struct XCSF *xcsf, char **argv)
35{
36 char *end = NULL;
37 if (strcmp(argv[1], "mp") == 0) {
38 xcsf->env_vptr = &env_mux_vtbl;
39 env_mux_init(xcsf, (int) strtoimax(argv[2], &end, 10));
40 } else if (strcmp(argv[1], "maze") == 0) {
41 xcsf->env_vptr = &env_maze_vtbl;
42 env_maze_init(xcsf, argv[2]);
43 } else if (strcmp(argv[1], "csv") == 0) {
44 xcsf->env_vptr = &env_csv_vtbl;
45 env_csv_init(xcsf, argv[2]);
46 } else {
47 printf("Invalid environment specified: %s\n", argv[1]);
48 printf("Available environments: {mp, maze, csv}\n");
49 exit(EXIT_FAILURE);
50 }
51}
void env_init(struct XCSF *xcsf, char **argv)
Initialises a built-in problem environment.
Definition env.c:34
void env_csv_init(struct XCSF *xcsf, const char *filename)
Initialises a CSV input environment from a specified filename.
Definition env_csv.c:160
CSV input file handling functions.
static struct EnvVtbl const env_csv_vtbl
csv input environment implemented functions.
Definition env_csv.h:64
void env_maze_init(struct XCSF *xcsf, const char *filename)
Initialises a maze environment from a specified file.
Definition env_maze.c:100
The discrete maze problem environment module.
static struct EnvVtbl const env_maze_vtbl
Maze environment implemented functions.
Definition env_maze.h:71
void env_mux_init(struct XCSF *xcsf, const int bits)
Initialises a real multiplexer environment of specified length.
Definition env_mux.c:44
The real multiplexer problem environment.
static struct EnvVtbl const env_mux_vtbl
Real multiplexer environment implemented functions.
Definition env_mux.h:64
XCSF data structure.
Definition xcsf.h:85