278 |
// |
// |
279 |
// A function to read optimisation information |
// A function to read optimisation information |
280 |
// |
// |
281 |
void Ecosystem::readOptimisation(CommentStream& infile) { |
void Ecosystem::readOptimisation(CommentStream& infile, unsigned* seed) { |
282 |
char* text = new char[MaxStrLength]; |
char* text = new char[MaxStrLength]; |
283 |
strncpy(text, "", MaxStrLength); |
strncpy(text, "", MaxStrLength); |
284 |
handle.logMessage(LOGMESSAGE, "Reading optimisation information"); |
handle.logMessage(LOGMESSAGE, "Reading optimisation information"); |
305 |
optvec.resize(new OptInfoSimann()); |
optvec.resize(new OptInfoSimann()); |
306 |
else if (strcasecmp(text, "[bfgs]") == 0) |
else if (strcasecmp(text, "[bfgs]") == 0) |
307 |
optvec.resize(new OptInfoBFGS()); |
optvec.resize(new OptInfoBFGS()); |
308 |
|
else if (strcasecmp(text, "[pso]") == 0) |
309 |
|
optvec.resize(new OptInfoPso()); |
310 |
else |
else |
311 |
handle.logFileUnexpected(LOGFAIL, "[hooke], [simann], or [bfgs]", text); |
handle.logFileUnexpected(LOGFAIL, "[hooke], [simann], [bfgs], or [pso]", text); |
312 |
|
|
313 |
if (!infile.eof()) { |
if (!infile.eof()) { |
314 |
infile >> text; |
infile >> text; |
315 |
|
optvec[count]->setSeed(seed); |
316 |
optvec[count]->read(infile, text); |
optvec[count]->read(infile, text); |
317 |
} else |
} else |
318 |
handle.logMessage(LOGINFO, "Warning - no parameters specified for optimisation algorithm"); |
handle.logMessage(LOGINFO, "Warning - no parameters specified for optimisation algorithm"); |