+/GENN

genetically evolving neural networks

git clone https://git.julia.blue/+/GENN

Joseph RyanRestructure file system add graphics libcc48e92

master
853 B46 linesraw
1#ifndef GENN_GENOME_H
2#define GENN_GENOME_H
3
4#include "../lib/base64.h"
5#include <sstream>
6#include <stdlib.h>
7#include <vector>
8
9struct Link {
10    Link() {}
11
12    Link(int a, int b, double c = 0) {
13        input = a;
14        output = b;
15        weight = c;
16    }
17
18    int input, output, id;
19    double weight;
20    bool enabled = true;
21
22    static bool compare(const Link &a, const Link &b) { return (a.id < b.id); }
23};
24
25class Genome {
26public:
27    int inputs, outputs, nodes;
28    double mutationRates[7];
29    double fitness = 0, adjustedFitness = 0;
30    std::vector<Link> structure;
31
32    Genome(const Genome &);
33
34    Genome(std::string);
35
36    Genome(int, int, double[]);
37
38    std::string encode();
39
40    void decode(std::string);
41
42    static bool compare(const Genome *a, const Genome *b) { return (a->fitness > b->fitness); }
43};
44
45
46#endif //GENN_GENOME_H