commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r980039 - in /commons/proper/math/trunk/src: site/xdoc/userguide/optimization.xml test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
Date Wed, 28 Jul 2010 12:48:48 GMT
Author: erans
Date: Wed Jul 28 12:48:48 2010
New Revision: 980039

URL: http://svn.apache.org/viewvc?rev=980039&view=rev
Log:
MATH-396

Modified:
    commons/proper/math/trunk/src/site/xdoc/userguide/optimization.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java

Modified: commons/proper/math/trunk/src/site/xdoc/userguide/optimization.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/optimization.xml?rev=980039&r1=980038&r2=980039&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/userguide/optimization.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/userguide/optimization.xml Wed Jul 28 12:48:48
2010
@@ -212,6 +212,10 @@
           or to change the line-search algorithm of the inner loop if desired (the default
one is a Brent
           solver).
         </p>
+        <p>
+          The <a href="../apidocs/org/apache/commons/math/optimization/general/PowellOptimizer.html">
+          PowellOptimizer</a> provides an optimization method for non-differentiable
functions.
+        </p>
       </subsection>
       <subsection name="12.6 Curve Fitting" href="fitting">
         <p>

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java?rev=980039&r1=980038&r2=980039&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
Wed Jul 28 12:48:48 2010
@@ -39,7 +39,7 @@ public class PowellOptimizerTest {
     public void testSumSinc() throws MathException {
         final MultivariateRealFunction func = new SumSincFunction(-1);
 
-        int dim = 1;
+        int dim = 10;
         final double[] minPoint = new double[dim];
         for (int i = 0; i < dim; i++) {
             minPoint[i] = 0;
@@ -51,13 +51,13 @@ public class PowellOptimizerTest {
         for (int i = 0; i < dim; i++) {
             init[i] = minPoint[i];
         }
-        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-15, 1e-8);
+        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-9, 1e-7);
 
         // Initial is far from minimum.
         for (int i = 0; i < dim; i++) {
-            init[i] = minPoint[i] + 4;
+            init[i] = minPoint[i] + 3;
         }
-        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-15, 1e-8);
+        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-9, 1e-7);
     }
 
     @Test
@@ -83,13 +83,13 @@ public class PowellOptimizerTest {
         for (int i = 0; i < dim; i++) {
             init[i] = minPoint[i];
         }
-        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-15, 1e-8);
+        doTest(func, minPoint, init,  GoalType.MINIMIZE, 1e-9, 1e-8);
 
         // Initial is far from minimum.
         for (int i = 0; i < dim; i++) {
             init[i] = minPoint[i] - 20;
         }
-        doTest(func, minPoint, init, GoalType.MINIMIZE, 1e-15, 1e-8);
+        doTest(func, minPoint, init, GoalType.MINIMIZE, 1e-9, 1e-8);
     }
 
     @Test
@@ -115,13 +115,13 @@ public class PowellOptimizerTest {
         for (int i = 0; i < dim; i++) {
             init[i] = maxPoint[i];
         }
-        doTest(func, maxPoint, init,  GoalType.MAXIMIZE, 1e-15, 1e-8);
+        doTest(func, maxPoint, init,  GoalType.MAXIMIZE, 1e-9, 1e-8);
 
         // Initial is far from minimum.
         for (int i = 0; i < dim; i++) {
             init[i] = maxPoint[i] - 20;
         }
-        doTest(func, maxPoint, init, GoalType.MAXIMIZE, 1e-15, 1e-8);
+        doTest(func, maxPoint, init, GoalType.MAXIMIZE, 1e-9, 1e-8);
     }
 
     /**
@@ -140,12 +140,17 @@ public class PowellOptimizerTest {
                         double pointTol)
         throws MathException {
         final MultivariateRealOptimizer optim = new PowellOptimizer();
-        final double relTol = 1e-10;
         optim.setConvergenceChecker(new SimpleScalarValueChecker(objTol, -1));
 
         final RealPointValuePair result = optim.optimize(func, goal, init);
         final double[] found = result.getPoint();
 
+        System.out.println("Function value at initial guess: " + func.value(init));
+        System.out.println("Function value at optimum: " + result.getValue());
+        System.out.println("Iterations: " + optim.getIterations());
+        System.out.println("Function evaluations: " + optim.getEvaluations());
+        System.out.println(Arrays.toString(found));
+
         for (int i = 0, dim = optimum.length; i < dim; i++) {
             Assert.assertEquals(optimum[i], found[i], pointTol);
         }



Mime
View raw message