-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCParams.cpp
More file actions
131 lines (112 loc) · 3.87 KB
/
CParams.cpp
File metadata and controls
131 lines (112 loc) · 3.87 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "CParams.h"
double CParams::dPi = 0;
double CParams::dHalfPi = 0;
double CParams::dTwoPi = 0;
int CParams::WindowWidth = 400;
int CParams::WindowHeight = 400;
int CParams::iFramesPerSecond = 0;
int CParams::iNumInputs = 0;
int CParams::iNumOutputs = 0;
double CParams::dBias = -1;
double CParams::dMaxTurnRate = 0;
int CParams::iSweeperScale = 0;
int CParams::iNumSensors = 0;
double CParams::dSensorRange = 0;
int CParams::iPopSize = 0;
int CParams::iNumTicks = 0;
double CParams::dCollisionDist = 0;
double CParams::dCellSize = 0;
double CParams::dSigmoidResponse = 1;
int CParams::iNumAddLinkAttempts = 0;
int CParams::iNumTrysToFindLoopedLink = 5;
int CParams::iNumTrysToFindOldLink = 5;
double CParams::dYoungFitnessBonus = 0;
int CParams::iYoungBonusAgeThreshhold = 0;
double CParams::dSurvivalRate = 0;
int CParams::InfoWindowWidth = 400;
int CParams::InfoWindowHeight = 400;
int CParams::iNumGensAllowedNoImprovement = 0;
int CParams::iMaxPermittedNeurons = 0;
double CParams::dChanceAddLink = 0;
double CParams::dChanceAddNode = 0;
double CParams::dChanceAddRecurrentLink = 0;
double CParams::dMutationRate = 0;
double CParams::dMaxWeightPerturbation = 0;
double CParams::dProbabilityWeightReplaced= 0;
double CParams::dActivationMutationRate = 0;
double CParams::dMaxActivationPerturbation= 0;
double CParams::dCompatibilityThreshold = 0;
int CParams::iNumBestSweepers = 4;
int CParams::iOldAgeThreshold = 0;
double CParams::dOldAgePenalty = 0;
double CParams::dCrossoverRate = 0;
int CParams::iMaxNumberOfSpecies = 0;
//this function loads in the parameters from a given file name. Returns
//false if there is a problem opening the file.
bool CParams::LoadInParameters(char* szFileName)
{
ifstream grab(szFileName);
//check file exists
if (!grab)
{
return false;
}
//load in from the file
char ParamDescription[40];
grab >> ParamDescription;
grab >> iFramesPerSecond;
grab >> ParamDescription;
grab >> dMaxTurnRate;
grab >> ParamDescription;
grab >> iSweeperScale;
grab >> ParamDescription;
grab >> iNumSensors;
grab >> ParamDescription;
grab >> dSensorRange;
grab >> ParamDescription;
grab >> iPopSize;
grab >> ParamDescription;
grab >> iNumTicks;
grab >> ParamDescription;
grab >> dCellSize;
grab >> ParamDescription;
grab >> iNumAddLinkAttempts;
grab >> ParamDescription;
grab >> dSurvivalRate;
grab >> ParamDescription;
grab >> iNumGensAllowedNoImprovement;
grab >> ParamDescription;
grab >> iMaxPermittedNeurons;
grab >> ParamDescription;
grab >> dChanceAddLink;
grab >> ParamDescription;
grab >> dChanceAddNode;
grab >> ParamDescription;
grab >> dChanceAddRecurrentLink;
grab >> ParamDescription;
grab >> dMutationRate;
grab >> ParamDescription;
grab >> dMaxWeightPerturbation;
grab >> ParamDescription;
grab >> dProbabilityWeightReplaced;
grab >> ParamDescription;
grab >> dActivationMutationRate;
grab >> ParamDescription;
grab >> dMaxActivationPerturbation;
grab >> ParamDescription;
grab >> dCompatibilityThreshold;
grab >> ParamDescription;
grab >>iOldAgeThreshold;
grab >> ParamDescription;
grab >>dOldAgePenalty;
grab >> ParamDescription;
grab >> dYoungFitnessBonus;
grab >> ParamDescription;
grab >> iYoungBonusAgeThreshhold;
grab >> ParamDescription;
grab >>dCrossoverRate;
grab >> ParamDescription;
grab >> iMaxNumberOfSpecies;
if(iNumBestSweepers > iPopSize) iNumBestSweepers = iPopSize;
return true;
}