13 |
void OptInfoSimann::read(CommentStream& infile, char* text) { |
void OptInfoSimann::read(CommentStream& infile, char* text) { |
14 |
handle.logMessage(LOGMESSAGE, "Reading Simulated Annealing optimisation parameters"); |
handle.logMessage(LOGMESSAGE, "Reading Simulated Annealing optimisation parameters"); |
15 |
|
|
16 |
|
unsigned s1 = 0; |
17 |
|
unsigned s2 = 0; |
18 |
|
unsigned s3 = 0; |
19 |
|
|
20 |
int count = 0; |
int count = 0; |
21 |
while (!infile.eof() && strcasecmp(text, "[simann]") && strcasecmp(text, "[hooke]") && strcasecmp(text, "[bfgs]")) { |
while (!infile.eof() && strcasecmp(text, "[simann]") && strcasecmp(text, "[hooke]") && strcasecmp(text, "[bfgs]")) { |
22 |
infile >> ws; |
infile >> ws; |
23 |
if (strcasecmp(text, "seed") == 0) { |
if (strcasecmp(text, "seed") == 0) { |
24 |
int seed = 0; |
int s = 0; |
25 |
infile >> seed >> ws; |
infile >> s >> ws; |
26 |
handle.logMessage(LOGMESSAGE, "Initialising random number generator with", seed); |
s1 = s; |
27 |
srand(seed); |
handle.logMessage(LOGMESSAGE, "Initialising random number generator with", s); |
28 |
|
srand(s1); |
29 |
|
//fixme doc |
30 |
|
} if (strcasecmp(text, "seedM") == 0) { |
31 |
|
int s = 0; |
32 |
|
infile >> s >> ws; |
33 |
|
s2 = s; |
34 |
|
handle.logMessage(LOGMESSAGE, "Initialising random number generator with", s); |
35 |
|
|
36 |
|
} if (strcasecmp(text, "seedP") == 0) { |
37 |
|
int s = 0; |
38 |
|
infile >> s >> ws; |
39 |
|
s3 = s; |
40 |
|
handle.logMessage(LOGMESSAGE, "Initialising random number generator with", s); |
41 |
|
|
42 |
} else if (strcasecmp(text, "simanniter") == 0) { |
} else if (strcasecmp(text, "simanniter") == 0) { |
43 |
infile >> simanniter; |
infile >> simanniter; |
94 |
infile >> text; |
infile >> text; |
95 |
} |
} |
96 |
|
|
97 |
|
if (s1 != 0) { |
98 |
|
seed = s1; |
99 |
|
if (s2 == 0) |
100 |
|
seedM = s1; |
101 |
|
else seedM = s2; |
102 |
|
if (s3 == 0) |
103 |
|
seedP = s1; |
104 |
|
else seedP = s3; |
105 |
|
} else { |
106 |
|
if (s2 != 0) |
107 |
|
seedP = s2; |
108 |
|
if (s3 != 0) |
109 |
|
seedP = s3; |
110 |
|
} |
111 |
|
|
112 |
if (count == 0) |
if (count == 0) |
113 |
handle.logMessage(LOGINFO, "Warning - no parameters specified for Simulated Annealing optimisation algorithm"); |
handle.logMessage(LOGINFO, "Warning - no parameters specified for Simulated Annealing optimisation algorithm"); |
114 |
|
|