-
Notifications
You must be signed in to change notification settings - Fork 0
/
evolutionary_algorithm.h
executable file
·46 lines (40 loc) · 1.15 KB
/
evolutionary_algorithm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef EA_H
#define EA_H
//C Libraries
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
//P-GP2 Libraries
#include "common.h"
#include "debug.h"
#include "graph.h"
#include "graphStacks.h"
#include "parser.h"
#include "morphism.h"
typedef struct EAArgs {
Graph** (*initialisation)(uintptr_t init_env_pointer);
uintptr_t init_env_pointer;
double* (*evaluate)(Graph** population, uintptr_t evaluation_env_pointer);
uintptr_t evaluation_env_pointer;
Graph** (*select_repopulate)(Graph** population, double* scores, uintptr_t select_repopulate_env_pointer);
uintptr_t select_repopulate_env_pointer;
bool (*termination)(Graph** population, double* scores, uintptr_t termination_env_pointer);
uintptr_t termination_env_pointer;
int (*pop_size)(Graph** population, uintptr_t pop_size_env_pointer);
uintptr_t pop_size_env_pointer;
bool maximise;
int update;
int generations;
} EAArgs;
typedef struct Result {
double winning_score;
Graph* winning_graph;
int generation;
bool terminated;
} Result;
Result** run_multi(EAArgs** args, int runs);
Result* run_EA(EAArgs* args);
#endif