From 51aa6e6ca29a8265784c037bc3a42455329ee4ab Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Thu, 23 Sep 2010 12:11:56 +0000 Subject: [PATCH] MATH-413 (point 13) Selecting a random start value (instead of interval bounds). git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1000422 13f79535-47bb-0310-9956-ffa450edef68 --- .../MultiStartUnivariateRealOptimizer.java | 24 +++++++------------ ...MultiStartUnivariateRealOptimizerTest.java | 10 ++++---- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java b/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java index aa14ce6c1..952e56569 100644 --- a/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java +++ b/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java @@ -143,18 +143,22 @@ public class MultiStartUnivariateRealOptimizer 150); - assertTrue(optimizer.getEvaluations() < 250); + assertTrue(optimizer.getEvaluations() > 200); + assertTrue(optimizer.getEvaluations() < 300); } @Test @@ -68,14 +68,14 @@ public class MultiStartUnivariateRealOptimizerTest { UnivariateRealPointValuePair optimum = optimizer.optimize(f, GoalType.MINIMIZE, -0.3, -0.2); - assertEquals(-0.2719561271, optimum.getPoint(), 1e-9); + assertEquals(-0.2719561293, optimum.getPoint(), 1e-9); assertEquals(-0.0443342695, optimum.getValue(), 1e-9); UnivariateRealPointValuePair[] optima = optimizer.getOptima(); for (int i = 0; i < optima.length; ++i) { assertEquals(f.value(optima[i].getPoint()), optima[i].getValue(), 1e-9); } - assertTrue(optimizer.getEvaluations() >= 110); - assertTrue(optimizer.getEvaluations() <= 150); + assertTrue(optimizer.getEvaluations() >= 50); + assertTrue(optimizer.getEvaluations() <= 100); } }