-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeuralNetwork.h
60 lines (41 loc) · 1.36 KB
/
NeuralNetwork.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef __H__NeuralNetwork
#define __H__NeuralNetwork
#include "Include.h"
#include "World.h"
class DNA;
#define Max_Input_Nodes 5
#define Max_Hidden_Nodes 5
#define Max_Ouput_Nodes 5
#define ATP_Cost_Factor_NN 0.0001f
class NeuralNetwork
{
int inputLayerCount = 0;
float* inputLayerConstantValue;
int* inputLayerInputSource;
float* inputLayer;
int hiddenLayerCount = 0;
float* hiddenLayer;
int outputLayerCount = 0;
float* outputLayer;
int inpToHiddenConCount = 0;
float* inpToHiddenCon;
int hiddenToOutConCount = 0;
float* hiddenToOutCon;
int InputNodesMax = 0;
public:
NeuralNetwork();
int GetOutputLayerCount() { return outputLayerCount; }
float GetOutputNode(int index) { return outputLayer[index]; } //#here
//float GetOutputNode(int index) { return 1.0f; }
float GetUnsignedOutputNode(int index) { return (outputLayer[index] + 1) / 2; }
int GetHiddenLayerCount() { return hiddenLayerCount; }
int GetInputLayerCount() { return inputLayerCount; }
float GetInputNode(int index) { return inputLayer[index]; }
void SetInputNodes(float* arr, int paramCount, bool compute);
void SetInputNode(int pos, float value, int source = -1) { inputLayer[pos] = value; inputLayerInputSource[pos] = source; }
float ComputeResult();
void BuildFromDNA(DNA* dna, int startpos);
void AddSourcesToCellInformation(CellInformation* cellInfo);
~NeuralNetwork();
};
#endif