MATH-1377

Short-circuit unnecessary computations.
This commit is contained in:
Gilles 2016-06-11 20:31:44 +02:00
parent 66a775c9fe
commit a6a48cfd37
1 changed files with 5 additions and 0 deletions

View File

@ -166,6 +166,11 @@ public class SimplexOptimizer extends MultivariateOptimizer {
PointValuePair prev = previous[i];
converged = converged &&
checker.converged(iteration, prev, simplex.getPoint(i));
if (!converged) {
// Short circuit, since "converged" will stay "false".
break;
}
}
if (converged) {
// We have found an optimum.