From f270a5036548627cf9dbfdd2584f36a3fef2e079 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:17:41 +0100 Subject: [PATCH] fixed files form Math #62 --- .../univariate/MultiStartUnivariateRealOptimizer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/Math/62/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java b/projects/Math/62/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java index 1200544..952e565 100644 --- a/projects/Math/62/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java +++ b/projects/Math/62/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java @@ -143,7 +143,7 @@ public UnivariateRealPointValuePair optimize(final FUNC f, final GoalType goal, final double min, final double max) throws FunctionEvaluationException { - return optimize(f, goal, min, max, 0); + return optimize(f, goal, min, max, min + 0.5 * (max - min)); } /** {@inheritDoc} */ @@ -157,9 +157,8 @@ public UnivariateRealPointValuePair optimize(final FUNC f, final GoalType goal, // Multi-start loop. for (int i = 0; i < starts; ++i) { try { - final double bound1 = (i == 0) ? min : min + generator.nextDouble() * (max - min); - final double bound2 = (i == 0) ? max : min + generator.nextDouble() * (max - min); - optima[i] = optimizer.optimize(f, goal, FastMath.min(bound1, bound2), FastMath.max(bound1, bound2)); + final double s = (i == 0) ? startValue : min + generator.nextDouble() * (max - min); + optima[i] = optimizer.optimize(f, goal, min, max, s); } catch (FunctionEvaluationException fee) { optima[i] = null; } catch (ConvergenceException ce) {