diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java index c5bd08bb4..cd1ca1dd2 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java @@ -159,7 +159,8 @@ public class SimplexOptimizer extends MultivariateOptimizer { int iteration = 0; final ConvergenceChecker checker = getConvergenceChecker(); while (true) { - if (getIterations() > 0) { + iteration = getIterations(); + if (iteration > 0) { boolean converged = true; for (int i = 0; i < simplex.getSize(); i++) { PointValuePair prev = previous[i];