562 |
|
|
563 |
while (1) { |
while (1) { |
564 |
if (isZero(bestf)) { |
if (isZero(bestf)) { |
565 |
|
iters = EcoSystem->getFuncEval() - offset; |
566 |
handle.logMessage(LOGINFO, "Error in Hooke & Jeeves optimisation after", iters, "function evaluations, f(x) = 0"); |
handle.logMessage(LOGINFO, "Error in Hooke & Jeeves optimisation after", iters, "function evaluations, f(x) = 0"); |
567 |
converge = -1; |
converge = -1; |
568 |
return; |
return; |
588 |
newf = this->bestNearby(delta, trialx, bestf, param); |
newf = this->bestNearby(delta, trialx, bestf, param); |
589 |
/* if too many function evaluations occur, terminate the algorithm */ |
/* if too many function evaluations occur, terminate the algorithm */ |
590 |
|
|
591 |
|
iters = EcoSystem->getFuncEval() - offset; |
592 |
if (iters > hookeiter) { |
if (iters > hookeiter) { |
593 |
handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); |
handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); |
594 |
handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); |
handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); |
665 |
bestf = newf; |
bestf = newf; |
666 |
for (i = 0; i < nvars; i++) |
for (i = 0; i < nvars; i++) |
667 |
x[i] = trialx[i]; |
x[i] = trialx[i]; |
668 |
|
newf = this->bestNearby(delta, trialx, bestf, param); |
669 |
if (isEqual(newf, bestf)) |
if (isEqual(newf, bestf)) |
670 |
break; |
break; |
671 |
|
|
672 |
/* if too many function evaluations occur, terminate the algorithm */ |
/* if too many function evaluations occur, terminate the algorithm */ |
673 |
|
iters = EcoSystem->getFuncEval() - offset; |
674 |
if (iters > hookeiter) { |
if (iters > hookeiter) { |
675 |
handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); |
handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); |
676 |
handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); |
handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); |
687 |
} |
} |
688 |
} // while (newf < bestf) |
} // while (newf < bestf) |
689 |
|
|
690 |
|
iters = EcoSystem->getFuncEval() - offset; |
691 |
if (newf < bestf) { |
if (newf < bestf) { |
692 |
for (i = 0; i < nvars; i++) |
for (i = 0; i < nvars; i++) |
693 |
bestx[i] = x[i] * init[i]; |
bestx[i] = x[i] * init[i]; |