blob: a4511c84caad1767ab7a28e1e737d3b1b540ad2d (
plain)
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
51
52
53
54
55
56
57
58
|
#ifndef __HYPERNEAT_CPPN_HPP__
#define __HYPERNEAT_CPPN_HPP__
#include <HyperNeat/Utils/Size.hpp>
#include <HyperNeat/Utils/ValueMap.hpp>
#include <HyperNeat/Utils/Vector2D.hpp>
#include <HyperNeat/Utils/NodeTypes.hpp>
namespace hyperneat
{
class Genome;
class NodeSearchPrms;
class Cppn
{
public:
Cppn() = default;
void create(const Genome& genome);
void clear();
size_t getInputsCount() const;
size_t getOutputsCount() const;
size_t getNodesCount() const;
double& inputAt(size_t i);
double outputAt(size_t i) const;
void cycle();
void findNodesIn2DSection(ValueMap& valueMap, const NodeSearchPrms& qpPrms, const Point& source = Point());
private:
class Node
{
public:
void appendInput();
void flushOutput();
class Link
{
public:
double* _input = nullptr;
double _weight = 0.0;
};
Vector<Link> _links;
NodeType _nodeType = NodeType::NULL_TYPE;
double _storedInput = 0.0;
double _output = 0.0;
};
Vector<double> _inputs;
Vector<double*> _outputs;
Vector2D<Node> _nodeLayers;
};
}
#endif
|