--- trunk/gadget/optinfopso.cc 2017/05/08 11:58:23 27 +++ trunk/gadget/optinfopso.cc 2017/07/05 12:08:06 28 @@ -6,7 +6,7 @@ OptInfoPso::OptInfoPso() : OptInfo(), goal(1e-5), psoiter(100000), c1(1.496), c2(1.496), w_max(PSO_INERTIA), w_min(0.3), clamp_pos(1), nhood_strategy(PSO_NHOOD_RING), - nhood_size(5), w_strategy(PSO_W_LIN_DEC) + nhood_size(5), w_strategy(PSO_W_LIN_DEC), scale(0) { type = OPTPSO; handle.logMessage(LOGMESSAGE, "Initialising PSO optimisation algorithm"); @@ -15,9 +15,9 @@ void OptInfoPso::read(CommentStream& infile, char* text) { handle.logMessage(LOGMESSAGE, "Reading PSO optimisation parameters"); - unsigned s1 = 0; - unsigned s2 = 0; - unsigned s3 = 0; +// unsigned s1 = 0; +// unsigned s2 = 0; +// unsigned s3 = 0; int count = 0; while (!infile.eof() && strcasecmp(text, "[PSO]") && strcasecmp(text, "[simann]") && strcasecmp(text, "[hooke]") && strcasecmp(text, "[bfgs]")) { @@ -25,9 +25,9 @@ if (strcasecmp(text, "seed") == 0) { int s = 0; infile >> s >> ws; - s1 = s; +// s1 = s; handle.logMessage(LOGMESSAGE, "Initialising random number generator with", s); - srand(s1); + srand(s); } else if (strcasecmp(text, "psoiter") == 0) { infile >> psoiter; @@ -71,7 +71,11 @@ infile >> size; count++; - } else { + } else if (strcasecmp(text, "scale") == 0) { + infile >> scale; + count++; + + } else { handle.logMessage(LOGINFO, "Warning in optinfofile - unrecognised option", text); infile >> text; //read and ignore the next entry } @@ -94,6 +98,11 @@ handle.logMessage(LOGINFO, "Warning in optinfofile - Invalid w_strategy. Setting to default PSO_W_LIN_DEC"); w_strategy=PSO_W_LIN_DEC; } + + if (scale != 0 && scale != 1) { + handle.logMessage(LOGINFO, "Warning in optinfofile - value of scale outside bounds", scale); + scale = 0; + } } void OptInfoPso::Print(ofstream& outfile, int prec) {