-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathea.hpp
More file actions
executable file
·50 lines (38 loc) · 1.21 KB
/
Copy pathea.hpp
File metadata and controls
executable file
·50 lines (38 loc) · 1.21 KB
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
47
48
49
50
#pragma once
#include <vector>
#include <functional>
#include "ann.hpp"
struct Ea_settings{
int number_of_individuals;
int number_of_epochs;
int number_of_recombined;
double mutation_range;
double mutation_probability;
double stop_at_fitness;
};
struct Genome{
double fitness;
std::vector<double> input_weights;
std::vector<double> hidden_weights;
};
class Evolution{
private:
Ea_settings ea_settings;
Ann_settings ann_settings;
std::function<double(Network, std::vector<struct data_point>)> fitness_function;
std::vector<Genome> population;
double best_fitness;
Genome mutate_input_weights(Genome g);
Genome mutate_hidden_weights(Genome g);
Genome recombine_input_weights(Genome g1, Genome g2);
Genome recombine_hidden_weights(Genome g1, Genome g2);
double fitness(std::vector<double> ann_input);
public:
std::tuple<Network, Genome> eval(std::vector<struct data_point> set);
Evolution(
Ea_settings ea_settings,
Ann_settings ann_settings,
std::function<double(Network, std::vector<struct data_point>)> fitness_function
);
};
int main();