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 <code>minimizes</code>
+ * algorithm. The various multi-start-enabled <code>minimize</code>
* methods return the best minimum found after all starts, and the
* [EMAIL PROTECTED] #getMinima getMinima} method can be used to retrieve all
* minima from all starts (including the one already provided by the
- * [EMAIL PROTECTED] #minimizes(CostFunction, int, ConvergenceChecker,
double[],
- * double[]) minimizes} method).</p>
+ * [EMAIL PROTECTED] #minimize(CostFunction, int, ConvergenceChecker, double[],
+ * double[]) minimize} method).</p>
*
* <p>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 [EMAIL PROTECTED]
- * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[])
- * minimizes}.
+ * #minimize(CostFunction, int, ConvergenceChecker, double[], double[])
+ * minimize}.
* <p>The optimizer stores all the minima found during a set of
* restarts when multi-start mode is enabled. The [EMAIL PROTECTED]
- * #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 [EMAIL PROTECTED]
#minimizes(CostFunction,
- * int, ConvergenceChecker, double[], double[]) minimizes} method.
+ * the best one already returned by the [EMAIL PROTECTED]
#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).</p>
* <p>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 [EMAIL
PROTECTED]
- * #minimizes(CostFunction, int, ConvergenceChecker, double[], double[])
- * minimizes} method did throw a [EMAIL PROTECTED] ConvergenceException
+ * #minimize(CostFunction, int, ConvergenceChecker, double[], double[])
+ * minimize} method did throw a [EMAIL PROTECTED] ConvergenceException
* ConvergenceException}).</p>
* @return array containing the minima, or null if [EMAIL PROTECTED]
- * #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);