Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 33730 invoked from network); 15 Feb 2008 10:32:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2008 10:32:13 -0000 Received: (qmail 9383 invoked by uid 500); 15 Feb 2008 10:32:05 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 9316 invoked by uid 500); 15 Feb 2008 10:32:05 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 9307 invoked by uid 99); 15 Feb 2008 10:32:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 02:32:05 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 10:31:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 64F291A9832; Fri, 15 Feb 2008 02:31:50 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r628000 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/optimization/DirectSearchOptimizer.java test/org/apache/commons/math/optimization/MultiDirectionalTest.java test/org/apache/commons/math/optimization/NelderMeadTest.java Date: Fri, 15 Feb 2008 10:31:49 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080215103150.64F291A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Fri Feb 15 02:31:48 2008 New Revision: 628000 URL: http://svn.apache.org/viewvc?rev=628000&view=rev Log: fixed functions names (minimizes -> minimize) Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiDirectionalTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java?rev=628000&r1=627999&r2=628000&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/DirectSearchOptimizer.java Fri Feb 15 02:31:48 2008 @@ -58,12 +58,12 @@ * multi-start mode. Multi-start is a traditional way to try to avoid * being trapped in a local minimum and miss the global minimum of a * function. It can also be used to verify the convergence of an - * algorithm. The various multi-start-enabled minimizes + * algorithm. The various multi-start-enabled minimize * methods return the best minimum found after all starts, and the * {@link #getMinima getMinima} method can be used to retrieve all * minima from all starts (including the one already provided by the - * {@link #minimizes(CostFunction, int, ConvergenceChecker, double[], - * double[]) minimizes} method).

+ * {@link #minimize(CostFunction, int, ConvergenceChecker, double[], + * double[]) minimize} method).

* *

This class is the base class performing the boilerplate simplex * initialization and handling. The simplex update by itself is @@ -107,9 +107,9 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - double[] vertexA, double[] vertexB) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + double[] vertexA, double[] vertexB) throws CostException, ConvergenceException { // set up optimizer @@ -117,7 +117,7 @@ setSingleStart(); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } @@ -149,10 +149,10 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - double[] vertexA, double[] vertexB, - int starts, long seed) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + double[] vertexA, double[] vertexB, + int starts, long seed) throws CostException, ConvergenceException { // set up the simplex traveling around the box @@ -176,7 +176,7 @@ setMultiStart(starts, rvg); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } @@ -197,9 +197,9 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - double[][] vertices) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + double[][] vertices) throws CostException, ConvergenceException { // set up optimizer @@ -207,7 +207,7 @@ setSingleStart(); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } @@ -234,10 +234,10 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - double[][] vertices, - int starts, long seed) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + double[][] vertices, + int starts, long seed) throws NotPositiveDefiniteMatrixException, CostException, ConvergenceException { @@ -265,7 +265,7 @@ setMultiStart(starts, rvg); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } catch (DimensionMismatchException dme) { // this should not happen @@ -291,9 +291,9 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - RandomVectorGenerator generator) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + RandomVectorGenerator generator) throws CostException, ConvergenceException { // set up optimizer @@ -301,7 +301,7 @@ setSingleStart(); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } @@ -325,10 +325,10 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - public PointCostPair minimizes(CostFunction f, int maxEvaluations, - ConvergenceChecker checker, - RandomVectorGenerator generator, - int starts) + public PointCostPair minimize(CostFunction f, int maxEvaluations, + ConvergenceChecker checker, + RandomVectorGenerator generator, + int starts) throws CostException, ConvergenceException { // set up optimizer @@ -336,7 +336,7 @@ setMultiStart(starts, generator); // compute minimum - return minimizes(f, maxEvaluations, checker); + return minimize(f, maxEvaluations, checker); } @@ -426,27 +426,27 @@ } /** Get all the minima found during the last call to {@link - * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[]) - * minimizes}. + * #minimize(CostFunction, int, ConvergenceChecker, double[], double[]) + * minimize}. *

The optimizer stores all the minima found during a set of * restarts when multi-start mode is enabled. The {@link - * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[]) - * minimizes} method returns the best point only. This method + * #minimize(CostFunction, int, ConvergenceChecker, double[], double[]) + * minimize} method returns the best point only. This method * returns all the points found at the end of each starts, including - * the best one already returned by the {@link #minimizes(CostFunction, - * int, ConvergenceChecker, double[], double[]) minimizes} method. + * the best one already returned by the {@link #minimize(CostFunction, + * int, ConvergenceChecker, double[], double[]) minimize} method. * The array as one element for each start as specified in the constructor * (it has one element only if optimizer has been set up for single-start).

*

The array containing the minima is ordered with the results * from the runs that did converge first, sorted from lowest to * highest minimum cost, and null elements corresponding to the runs * that did not converge (all elements will be null if the {@link - * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[]) - * minimizes} method did throw a {@link ConvergenceException + * #minimize(CostFunction, int, ConvergenceChecker, double[], double[]) + * minimize} method did throw a {@link ConvergenceException * ConvergenceException}).

* @return array containing the minima, or null if {@link - * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[]) - * minimizes} has not been called + * #minimize(CostFunction, int, ConvergenceChecker, double[], double[]) + * minimize} has not been called */ public PointCostPair[] getMinima() { return (PointCostPair[]) minima.clone(); @@ -466,7 +466,7 @@ * @exception ConvergenceException if none of the starts did * converge (it is not thrown if at least one start did converge) */ - private PointCostPair minimizes(CostFunction f, int maxEvaluations, + private PointCostPair minimize(CostFunction f, int maxEvaluations, ConvergenceChecker checker) throws CostException, ConvergenceException { Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiDirectionalTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiDirectionalTest.java?rev=628000&r1=627999&r2=628000&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiDirectionalTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/MultiDirectionalTest.java Fri Feb 15 02:31:48 2008 @@ -47,8 +47,8 @@ } }; try { - new MultiDirectional(1.9, 0.4).minimizes(wrong, 10, new ValueChecker(1.0e-3), - new double[] { -0.5 }, new double[] { 0.5 }); + new MultiDirectional(1.9, 0.4).minimize(wrong, 10, new ValueChecker(1.0e-3), + new double[] { -0.5 }, new double[] { 0.5 }); fail("an exception should have been thrown"); } catch (CostException ce) { // expected behavior @@ -57,8 +57,8 @@ fail("wrong exception caught: " + e.getMessage()); } try { - new MultiDirectional(1.9, 0.4).minimizes(wrong, 10, new ValueChecker(1.0e-3), - new double[] { 0.5 }, new double[] { 1.5 }); + new MultiDirectional(1.9, 0.4).minimize(wrong, 10, new ValueChecker(1.0e-3), + new double[] { 0.5 }, new double[] { 1.5 }); fail("an exception should have been thrown"); } catch (CostException ce) { // expected behavior @@ -83,10 +83,10 @@ count = 0; PointCostPair optimum = - new MultiDirectional().minimizes(rosenbrock, 100, new ValueChecker(1.0e-3), - new double[][] { - { -1.2, 1.0 }, { 0.9, 1.2 } , { 3.5, -2.3 } - }); + new MultiDirectional().minimize(rosenbrock, 100, new ValueChecker(1.0e-3), + new double[][] { + { -1.2, 1.0 }, { 0.9, 1.2 } , { 3.5, -2.3 } + }); assertTrue(count > 60); assertTrue(optimum.getCost() > 0.01); @@ -110,9 +110,9 @@ count = 0; PointCostPair optimum = - new MultiDirectional().minimizes(powell, 1000, new ValueChecker(1.0e-3), - new double[] { 3.0, -1.0, 0.0, 1.0 }, - new double[] { 4.0, 0.0, 1.0, 2.0 }); + new MultiDirectional().minimize(powell, 1000, new ValueChecker(1.0e-3), + new double[] { 3.0, -1.0, 0.0, 1.0 }, + new double[] { 4.0, 0.0, 1.0, 2.0 }); assertTrue(count > 850); assertTrue(optimum.getCost() > 0.015); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java?rev=628000&r1=627999&r2=628000&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/NelderMeadTest.java Fri Feb 15 02:31:48 2008 @@ -53,8 +53,8 @@ } }; try { - new NelderMead(0.9, 1.9, 0.4, 0.6).minimizes(wrong, 10, new ValueChecker(1.0e-3), - new double[] { -0.5 }, new double[] { 0.5 }); + new NelderMead(0.9, 1.9, 0.4, 0.6).minimize(wrong, 10, new ValueChecker(1.0e-3), + new double[] { -0.5 }, new double[] { 0.5 }); fail("an exception should have been thrown"); } catch (CostException ce) { // expected behavior @@ -63,8 +63,8 @@ fail("wrong exception caught: " + e.getMessage()); } try { - new NelderMead(0.9, 1.9, 0.4, 0.6).minimizes(wrong, 10, new ValueChecker(1.0e-3), - new double[] { 0.5 }, new double[] { 1.5 }); + new NelderMead(0.9, 1.9, 0.4, 0.6).minimize(wrong, 10, new ValueChecker(1.0e-3), + new double[] { 0.5 }, new double[] { 1.5 }); fail("an exception should have been thrown"); } catch (CostException ce) { // expected behavior @@ -90,10 +90,10 @@ count = 0; NelderMead nm = new NelderMead(); try { - nm.minimizes(rosenbrock, 100, new ValueChecker(1.0e-3), - new double[][] { - { -1.2, 1.0 }, { 3.5, -2.3 }, { 0.4, 1.5 } - }, 1, 5384353l); + nm.minimize(rosenbrock, 100, new ValueChecker(1.0e-3), + new double[][] { + { -1.2, 1.0 }, { 3.5, -2.3 }, { 0.4, 1.5 } + }, 1, 5384353l); fail("an exception should have been thrown"); } catch (ConvergenceException ce) { // expected behavior @@ -103,10 +103,10 @@ count = 0; PointCostPair optimum = - nm.minimizes(rosenbrock, 100, new ValueChecker(1.0e-3), - new double[][] { - { -1.2, 1.0 }, { 0.9, 1.2 }, { 3.5, -2.3 } - }, 10, 1642738l); + nm.minimize(rosenbrock, 100, new ValueChecker(1.0e-3), + new double[][] { + { -1.2, 1.0 }, { 0.9, 1.2 }, { 3.5, -2.3 } + }, 10, 1642738l); assertTrue(count > 700); assertTrue(count < 800); @@ -137,10 +137,10 @@ new double[] { 0.2, 0.2 }, new UniformRandomGenerator(rg)); optimum = - nm.minimizes(rosenbrock, 100, new ValueChecker(1.0e-3), rvg); + nm.minimize(rosenbrock, 100, new ValueChecker(1.0e-3), rvg); assertEquals(0.0, optimum.getCost(), 2.0e-4); optimum = - nm.minimizes(rosenbrock, 100, new ValueChecker(1.0e-3), rvg, 3); + nm.minimize(rosenbrock, 100, new ValueChecker(1.0e-3), rvg, 3); assertEquals(0.0, optimum.getCost(), 3.0e-5); } @@ -163,10 +163,10 @@ count = 0; NelderMead nm = new NelderMead(); PointCostPair optimum = - nm.minimizes(powell, 200, new ValueChecker(1.0e-3), - new double[] { 3.0, -1.0, 0.0, 1.0 }, - new double[] { 4.0, 0.0, 1.0, 2.0 }, - 1, 1642738l); + nm.minimize(powell, 200, new ValueChecker(1.0e-3), + new double[] { 3.0, -1.0, 0.0, 1.0 }, + new double[] { 4.0, 0.0, 1.0, 2.0 }, + 1, 1642738l); assertTrue(count < 150); assertEquals(0.0, optimum.getCost(), 6.0e-4); assertEquals(0.0, optimum.getPoint()[0], 0.07);