You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2012/02/12 01:37:25 UTC
svn commit: r1243186 [2/2] - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/optimization/
main/java/org/apache/commons/math/optimization/direct/
main/java/org/apache/commons/math/optimization/general/
main/java/org/apache/commons/...
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizerTest.java Sun Feb 12 00:37:23 2012
@@ -25,7 +25,7 @@ import org.apache.commons.math.exception
import org.apache.commons.math.exception.NumberIsTooLargeException;
import org.apache.commons.math.exception.NumberIsTooSmallException;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.junit.Assert;
import org.junit.Test;
@@ -76,7 +76,7 @@ public class BOBYQAOptimizerTest {
public void testRosen() {
double[] startPoint = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected = new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected = new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
@@ -86,7 +86,7 @@ public class BOBYQAOptimizerTest {
public void testMaximize() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected = new RealPointValuePair(point(DIM,0.0),1.0);
+ PointValuePair expected = new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, boundaries,
GoalType.MAXIMIZE,
2e-10, 5e-6, 1000, expected);
@@ -101,8 +101,8 @@ public class BOBYQAOptimizerTest {
public void testEllipse() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
@@ -112,8 +112,8 @@ public class BOBYQAOptimizerTest {
public void testElliRotated() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-12, 1e-6, 10000, expected);
@@ -123,8 +123,8 @@ public class BOBYQAOptimizerTest {
public void testCigar() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
@@ -134,8 +134,8 @@ public class BOBYQAOptimizerTest {
public void testTwoAxes() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new TwoAxes(), startPoint, boundaries,
GoalType.MINIMIZE, 2*
1e-13, 1e-6, 100, expected);
@@ -145,8 +145,8 @@ public class BOBYQAOptimizerTest {
public void testCigTab() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 5e-5, 100, expected);
@@ -156,8 +156,8 @@ public class BOBYQAOptimizerTest {
public void testSphere() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
@@ -167,8 +167,8 @@ public class BOBYQAOptimizerTest {
public void testTablet() {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 100, expected);
@@ -178,8 +178,8 @@ public class BOBYQAOptimizerTest {
public void testDiffPow() {
double[] startPoint = point(DIM/2,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM/2,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new DiffPow(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-8, 1e-1, 12000, expected);
@@ -189,8 +189,8 @@ public class BOBYQAOptimizerTest {
public void testSsDiffPow() {
double[] startPoint = point(DIM/2,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM/2,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM/2,0.0),0.0);
doTest(new SsDiffPow(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-2, 1.3e-1, 50000, expected);
@@ -200,8 +200,8 @@ public class BOBYQAOptimizerTest {
public void testAckley() {
double[] startPoint = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Ackley(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-8, 1e-5, 1000, expected);
@@ -212,8 +212,8 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 1000, expected);
@@ -224,8 +224,8 @@ public class BOBYQAOptimizerTest {
double[] startPoint = point(DIM,0.1);
double[][] boundaries = boundaries(DIM,-1,2);
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, boundaries,
GoalType.MINIMIZE,
1e-13, 1e-6, 2000, expected);
@@ -236,7 +236,7 @@ public class BOBYQAOptimizerTest {
public void testConstrainedRosenWithMoreInterpolationPoints() {
final double[] startPoint = point(DIM, 0.1);
final double[][] boundaries = boundaries(DIM, -1, 2);
- final RealPointValuePair expected = new RealPointValuePair(point(DIM, 1.0), 0.0);
+ final PointValuePair expected = new PointValuePair(point(DIM, 1.0), 0.0);
// This should have been 78 because in the code the hard limit is
// said to be
@@ -272,7 +272,7 @@ public class BOBYQAOptimizerTest {
double fTol,
double pointTol,
int maxEvaluations,
- RealPointValuePair expected) {
+ PointValuePair expected) {
doTest(func,
startPoint,
boundaries,
@@ -305,7 +305,7 @@ public class BOBYQAOptimizerTest {
double pointTol,
int maxEvaluations,
int additionalInterpolationPoints,
- RealPointValuePair expected,
+ PointValuePair expected,
String assertMsg) {
System.out.println(func.getClass().getName() + " BEGIN"); // XXX
@@ -313,12 +313,12 @@ public class BOBYQAOptimizerTest {
int dim = startPoint.length;
// MultivariateOptimizer optim =
// new PowellOptimizer(1e-13, Math.ulp(1d));
-// RealPointValuePair result = optim.optimize(100000, func, goal, startPoint);
+// PointValuePair result = optim.optimize(100000, func, goal, startPoint);
final double[] lB = boundaries == null ? null : boundaries[0];
final double[] uB = boundaries == null ? null : boundaries[1];
final int numIterpolationPoints = 2 * dim + 1 + additionalInterpolationPoints;
BOBYQAOptimizer optim = new BOBYQAOptimizer(numIterpolationPoints);
- RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
+ PointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint, lB, uB);
// System.out.println(func.getClass().getName() + " = "
// + optim.getEvaluations() + " f(");
// for (double x: result.getPoint()) System.out.print(x + " ");
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/CMAESOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/CMAESOptimizerTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/CMAESOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/CMAESOptimizerTest.java Sun Feb 12 00:37:23 2012
@@ -28,7 +28,7 @@ import org.apache.commons.math.exception
import org.apache.commons.math.exception.OutOfRangeException;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.MultivariateOptimizer;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.random.MersenneTwister;
import org.junit.Assert;
import org.junit.Test;
@@ -48,8 +48,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,3);
double[] insigma = null;
double[][] boundaries = boundaries(DIM,-1,2);
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -60,8 +60,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.5);
double[] insigma = null;
double[][] boundaries = boundaries(DIM+1,-1,2);
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -73,8 +73,8 @@ public class CMAESOptimizerTest {
double[] insigma = null;
double[][] boundaries = boundaries(DIM,-1,2);
boundaries[1] = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -85,8 +85,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.5);
double[] insigma = point(DIM,-0.5);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -97,8 +97,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.5);
double[] insigma = point(DIM, 1.1);
double[][] boundaries = boundaries(DIM,-0.5,0.5);
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -109,8 +109,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.5);
double[] insigma = point(DIM+1,-0.5);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -122,8 +122,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.1);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -138,8 +138,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),1.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),1.0);
doTest(new MinusElli(), startPoint, insigma, boundaries,
GoalType.MAXIMIZE, LAMBDA, true, 0, 1.0-1e-13,
2e-10, 5e-6, 100000, expected);
@@ -158,8 +158,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Elli(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -173,8 +173,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new ElliRotated(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -188,8 +188,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Cigar(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 200000, expected);
@@ -203,8 +203,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new TwoAxes(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 2*LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 200000, expected);
@@ -218,8 +218,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.3);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new CigTab(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 5e-5, 100000, expected);
@@ -233,8 +233,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Sphere(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -248,8 +248,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Tablet(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -263,8 +263,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new DiffPow(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 10, true, 0, 1e-13,
1e-8, 1e-1, 100000, expected);
@@ -278,8 +278,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new SsDiffPow(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 10, true, 0, 1e-13,
1e-4, 1e-1, 200000, expected);
@@ -293,8 +293,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,1.0);
double[] insigma = point(DIM,1.0);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Ackley(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 2*LAMBDA, true, 0, 1e-13,
1e-9, 1e-5, 100000, expected);
@@ -308,8 +308,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.1);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,0.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,0.0),0.0);
doTest(new Rastrigin(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, (int)(200*Math.sqrt(DIM)), true, 0, 1e-13,
1e-13, 1e-6, 200000, expected);
@@ -323,8 +323,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.1);
double[] insigma = point(DIM,0.1);
double[][] boundaries = boundaries(DIM,-1,2);
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 2*LAMBDA, true, 0, 1e-13,
1e-13, 1e-6, 100000, expected);
@@ -338,8 +338,8 @@ public class CMAESOptimizerTest {
double[] startPoint = point(DIM,0.1);
double[] insigma = point(DIM,0.1);
double[][] boundaries = null;
- RealPointValuePair expected =
- new RealPointValuePair(point(DIM,1.0),0.0);
+ PointValuePair expected =
+ new PointValuePair(point(DIM,1.0),0.0);
doTest(new Rosen(), startPoint, insigma, boundaries,
GoalType.MINIMIZE, LAMBDA, false, 1, 1e-13,
1e-10, 1e-4, 1000000, expected);
@@ -372,14 +372,14 @@ public class CMAESOptimizerTest {
double fTol,
double pointTol,
int maxEvaluations,
- RealPointValuePair expected) {
+ PointValuePair expected) {
int dim = startPoint.length;
// test diagonalOnly = 0 - slow but normally fewer feval#
MultivariateOptimizer optim =
new CMAESOptimizer(
lambda, inSigma, boundaries, 30000,
stopValue, isActive, diagonalOnly, 0, new MersenneTwister(),false);
- RealPointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint);
+ PointValuePair result = optim.optimize(maxEvaluations, func, goal, startPoint);
Assert.assertEquals(expected.getValue(),
result.getValue(), fTol);
for (int i = 0; i < dim; i++) {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionMappingAdapterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionMappingAdapterTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionMappingAdapterTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionMappingAdapterTest.java Sun Feb 12 00:37:23 2012
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
import org.apache.commons.math.analysis.MultivariateFunction;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.junit.Assert;
import org.junit.Test;
@@ -42,7 +42,7 @@ public class MultivariateFunctionMapping
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
}));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(300, wrapped, GoalType.MINIMIZE,
wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 }));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
@@ -68,7 +68,7 @@ public class MultivariateFunctionMapping
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
}));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(100, wrapped, GoalType.MINIMIZE,
wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 }));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
@@ -96,7 +96,7 @@ public class MultivariateFunctionMapping
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
}));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(300, wrapped, GoalType.MINIMIZE,
wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 }));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
@@ -124,7 +124,7 @@ public class MultivariateFunctionMapping
wrapped.boundedToUnbounded(new double[] { 1.7, 2.90 })
}));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(200, wrapped, GoalType.MINIMIZE,
wrapped.boundedToUnbounded(new double[] { 1.5, 2.25 }));
final double[] bounded = wrapped.unboundedToBounded(optimum.getPoint());
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java Sun Feb 12 00:37:23 2012
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
import org.apache.commons.math.analysis.MultivariateFunction;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.optimization.SimpleRealPointChecker;
import org.junit.Assert;
import org.junit.Test;
@@ -40,7 +40,7 @@ public class MultivariateFunctionPenalty
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 1.0, 0.5 }));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(300, wrapped, GoalType.MINIMIZE, new double[] { 1.5, 2.25 });
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
@@ -61,7 +61,7 @@ public class MultivariateFunctionPenalty
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 1.0, 0.5 }));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(300, wrapped, GoalType.MINIMIZE, new double[] { -1.5, 4.0 });
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
@@ -82,7 +82,7 @@ public class MultivariateFunctionPenalty
SimplexOptimizer optimizer = new SimplexOptimizer(new SimpleRealPointChecker(1.0e-11, 1.0e-20));
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 1.0, 0.5 }));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(600, wrapped, GoalType.MINIMIZE, new double[] { -1.5, 4.0 });
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
@@ -105,7 +105,7 @@ public class MultivariateFunctionPenalty
SimplexOptimizer optimizer = new SimplexOptimizer(1e-10, 1e-30);
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 1.0, 0.5 }));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(300, wrapped, GoalType.MINIMIZE, new double[] { -1.5, 4.0 });
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
@@ -128,7 +128,7 @@ public class MultivariateFunctionPenalty
SimplexOptimizer optimizer = new SimplexOptimizer(new SimpleRealPointChecker(1.0e-10, 1.0e-20));
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 1.0, 0.5 }));
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(400, wrapped, GoalType.MINIMIZE, new double[] { -1.5, 4.0 });
Assert.assertEquals(biQuadratic.getBoundedXOptimum(), optimum.getPoint()[0], 2e-7);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java Sun Feb 12 00:37:23 2012
@@ -20,7 +20,7 @@ import org.apache.commons.math.analysis.
import org.apache.commons.math.analysis.SumSincFunction;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.MultivariateOptimizer;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.junit.Assert;
import org.junit.Test;
@@ -133,7 +133,7 @@ public class PowellOptimizerTest {
double pointTol) {
final MultivariateOptimizer optim = new PowellOptimizer(fTol, Math.ulp(1d));
- final RealPointValuePair result = optim.optimize(1000, func, goal, init);
+ final PointValuePair result = optim.optimize(1000, func, goal, init);
final double[] found = result.getPoint();
for (int i = 0, dim = optimum.length; i < dim; i++) {
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerMultiDirectionalTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerMultiDirectionalTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerMultiDirectionalTest.java Sun Feb 12 00:37:23 2012
@@ -19,7 +19,7 @@ package org.apache.commons.math.optimiza
import org.apache.commons.math.analysis.MultivariateFunction;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.optimization.SimpleScalarValueChecker;
import org.apache.commons.math.util.FastMath;
import org.junit.Assert;
@@ -32,7 +32,7 @@ public class SimplexOptimizerMultiDirect
optimizer.setSimplex(new MultiDirectionalSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(200, fourExtrema, GoalType.MINIMIZE, new double[] { -3, 0 });
Assert.assertEquals(fourExtrema.xM, optimum.getPoint()[0], 4e-6);
Assert.assertEquals(fourExtrema.yP, optimum.getPoint()[1], 3e-6);
@@ -47,7 +47,7 @@ public class SimplexOptimizerMultiDirect
optimizer.setSimplex(new MultiDirectionalSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(200, fourExtrema, GoalType.MINIMIZE, new double[] { 1, 0 });
Assert.assertEquals(fourExtrema.xP, optimum.getPoint()[0], 2e-8);
Assert.assertEquals(fourExtrema.yM, optimum.getPoint()[1], 3e-6);
@@ -62,7 +62,7 @@ public class SimplexOptimizerMultiDirect
optimizer.setSimplex(new MultiDirectionalSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(200, fourExtrema, GoalType.MAXIMIZE, new double[] { -3.0, 0.0 });
Assert.assertEquals(fourExtrema.xM, optimum.getPoint()[0], 7e-7);
Assert.assertEquals(fourExtrema.yM, optimum.getPoint()[1], 3e-7);
@@ -77,7 +77,7 @@ public class SimplexOptimizerMultiDirect
optimizer.setSimplex(new MultiDirectionalSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(200, fourExtrema, GoalType.MAXIMIZE, new double[] { 1, 0 });
Assert.assertEquals(fourExtrema.xP, optimum.getPoint()[0], 2e-8);
Assert.assertEquals(fourExtrema.yP, optimum.getPoint()[1], 3e-6);
@@ -103,7 +103,7 @@ public class SimplexOptimizerMultiDirect
optimizer.setSimplex(new MultiDirectionalSimplex(new double[][] {
{ -1.2, 1.0 }, { 0.9, 1.2 } , { 3.5, -2.3 }
}));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, rosenbrock, GoalType.MINIMIZE, new double[] { -1.2, 1 });
Assert.assertEquals(count, optimizer.getEvaluations());
@@ -129,7 +129,7 @@ public class SimplexOptimizerMultiDirect
count = 0;
SimplexOptimizer optimizer = new SimplexOptimizer(-1, 1e-3);
optimizer.setSimplex(new MultiDirectionalSimplex(4));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(1000, powell, GoalType.MINIMIZE, new double[] { 3, -1, 0, 1 });
Assert.assertEquals(count, optimizer.getEvaluations());
Assert.assertTrue(optimizer.getEvaluations() > 800);
@@ -144,7 +144,7 @@ public class SimplexOptimizerMultiDirect
SimplexOptimizer optimizer = new SimplexOptimizer();
optimizer.setSimplex(new MultiDirectionalSimplex(2));
final Gaussian2D function = new Gaussian2D(0, 0, 1);
- RealPointValuePair estimate = optimizer.optimize(1000, function,
+ PointValuePair estimate = optimizer.optimize(1000, function,
GoalType.MAXIMIZE, function.getMaximumPosition());
final double EPSILON = 1e-5;
final double expectedMaximum = function.getMaximum();
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerNelderMeadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerNelderMeadTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerNelderMeadTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerNelderMeadTest.java Sun Feb 12 00:37:23 2012
@@ -25,7 +25,7 @@ import org.apache.commons.math.linear.Ar
import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.LeastSquaresConverter;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.util.FastMath;
import org.junit.Assert;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class SimplexOptimizerNelderMeadT
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(100, fourExtrema, GoalType.MINIMIZE, new double[] { -3, 0 });
Assert.assertEquals(fourExtrema.xM, optimum.getPoint()[0], 2e-7);
Assert.assertEquals(fourExtrema.yP, optimum.getPoint()[1], 2e-5);
@@ -52,7 +52,7 @@ public class SimplexOptimizerNelderMeadT
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(100, fourExtrema, GoalType.MINIMIZE, new double[] { 1, 0 });
Assert.assertEquals(fourExtrema.xP, optimum.getPoint()[0], 5e-6);
Assert.assertEquals(fourExtrema.yM, optimum.getPoint()[1], 6e-6);
@@ -67,7 +67,7 @@ public class SimplexOptimizerNelderMeadT
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(100, fourExtrema, GoalType.MAXIMIZE, new double[] { -3, 0 });
Assert.assertEquals(fourExtrema.xM, optimum.getPoint()[0], 1e-5);
Assert.assertEquals(fourExtrema.yM, optimum.getPoint()[1], 3e-6);
@@ -82,7 +82,7 @@ public class SimplexOptimizerNelderMeadT
optimizer.setSimplex(new NelderMeadSimplex(new double[] { 0.2, 0.2 }));
final FourExtrema fourExtrema = new FourExtrema();
- final RealPointValuePair optimum
+ final PointValuePair optimum
= optimizer.optimize(100, fourExtrema, GoalType.MAXIMIZE, new double[] { 1, 0 });
Assert.assertEquals(fourExtrema.xP, optimum.getPoint()[0], 4e-6);
Assert.assertEquals(fourExtrema.yP, optimum.getPoint()[1], 5e-6);
@@ -99,7 +99,7 @@ public class SimplexOptimizerNelderMeadT
optimizer.setSimplex(new NelderMeadSimplex(new double[][] {
{ -1.2, 1 }, { 0.9, 1.2 } , { 3.5, -2.3 }
}));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, rosenbrock, GoalType.MINIMIZE, new double[] { -1.2, 1 });
Assert.assertEquals(rosenbrock.getCount(), optimizer.getEvaluations());
@@ -114,7 +114,7 @@ public class SimplexOptimizerNelderMeadT
Powell powell = new Powell();
SimplexOptimizer optimizer = new SimplexOptimizer(-1, 1e-3);
optimizer.setSimplex(new NelderMeadSimplex(4));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(200, powell, GoalType.MINIMIZE, new double[] { 3, -1, 0, 1 });
Assert.assertEquals(powell.getCount(), optimizer.getEvaluations());
Assert.assertTrue(optimizer.getEvaluations() > 110);
@@ -137,7 +137,7 @@ public class SimplexOptimizerNelderMeadT
}, new double[] { 2.0, -3.0 });
SimplexOptimizer optimizer = new SimplexOptimizer(-1, 1e-6);
optimizer.setSimplex(new NelderMeadSimplex(2));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(200, ls, GoalType.MINIMIZE, new double[] { 10, 10 });
Assert.assertEquals( 2, optimum.getPointRef()[0], 3e-5);
Assert.assertEquals(-3, optimum.getPointRef()[1], 4e-4);
@@ -161,7 +161,7 @@ public class SimplexOptimizerNelderMeadT
}, new double[] { 2, -3 }, new double[] { 10, 0.1 });
SimplexOptimizer optimizer = new SimplexOptimizer(-1, 1e-6);
optimizer.setSimplex(new NelderMeadSimplex(2));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(200, ls, GoalType.MINIMIZE, new double[] { 10, 10 });
Assert.assertEquals( 2, optimum.getPointRef()[0], 5e-5);
Assert.assertEquals(-3, optimum.getPointRef()[1], 8e-4);
@@ -187,7 +187,7 @@ public class SimplexOptimizerNelderMeadT
}));
SimplexOptimizer optimizer = new SimplexOptimizer(-1, 1e-6);
optimizer.setSimplex(new NelderMeadSimplex(2));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(200, ls, GoalType.MINIMIZE, new double[] { 10, 10 });
Assert.assertEquals( 2, optimum.getPointRef()[0], 2e-3);
Assert.assertEquals(-3, optimum.getPointRef()[1], 8e-4);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java Sun Feb 12 00:37:23 2012
@@ -26,7 +26,7 @@ import org.apache.commons.math.analysis.
import org.apache.commons.math.linear.BlockRealMatrix;
import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.optimization.SimpleScalarValueChecker;
import org.junit.Assert;
import org.junit.Test;
@@ -101,7 +101,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0 });
Assert.assertEquals(1.5, optimum.getPoint()[0], 1.0e-10);
Assert.assertEquals(0.0, optimum.getValue(), 1.0e-10);
@@ -116,7 +116,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0 });
Assert.assertEquals(7.0, optimum.getPoint()[0], 1.0e-10);
Assert.assertEquals(3.0, optimum.getPoint()[1], 1.0e-10);
@@ -137,7 +137,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0, 0, 0, 0 });
for (int i = 0; i < problem.target.length; ++i) {
Assert.assertEquals(0.55 * i, optimum.getPoint()[i], 1.0e-10);
@@ -154,7 +154,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0 });
Assert.assertEquals(1.0, optimum.getPoint()[0], 1.0e-10);
Assert.assertEquals(2.0, optimum.getPoint()[1], 1.0e-10);
@@ -194,7 +194,7 @@ public class NonLinearConjugateGradientO
new BrentSolver(),
preconditioner);
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0, 0, 0, 0 });
Assert.assertEquals( 3.0, optimum.getPoint()[0], 1.0e-10);
Assert.assertEquals( 4.0, optimum.getPoint()[1], 1.0e-10);
@@ -215,7 +215,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 0, 0, 0 });
Assert.assertTrue(optimum.getValue() > 0.5);
}
@@ -232,7 +232,7 @@ public class NonLinearConjugateGradientO
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-13, 1e-13),
new BrentSolver(1e-15, 1e-15));
- RealPointValuePair optimum1 =
+ PointValuePair optimum1 =
optimizer.optimize(200, problem1, GoalType.MINIMIZE, new double[] { 0, 1, 2, 3 });
Assert.assertEquals(1.0, optimum1.getPoint()[0], 1.0e-4);
Assert.assertEquals(1.0, optimum1.getPoint()[1], 1.0e-4);
@@ -245,7 +245,7 @@ public class NonLinearConjugateGradientO
{ 8.00, 5.98, 9.89, 9.00 },
{ 6.99, 4.99, 9.00, 9.98 }
}, new double[] { 32, 23, 33, 31 });
- RealPointValuePair optimum2 =
+ PointValuePair optimum2 =
optimizer.optimize(200, problem2, GoalType.MINIMIZE, new double[] { 0, 1, 2, 3 });
Assert.assertEquals(-81.0, optimum2.getPoint()[0], 1.0e-1);
Assert.assertEquals(137.0, optimum2.getPoint()[1], 1.0e-1);
@@ -265,7 +265,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 7, 6, 5, 4 });
Assert.assertEquals(0, optimum.getValue(), 1.0e-10);
@@ -283,7 +283,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 2, 2, 2, 2, 2, 2 });
Assert.assertEquals(0, optimum.getValue(), 1.0e-10);
}
@@ -299,7 +299,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 1, 1 });
Assert.assertEquals(2.0, optimum.getPoint()[0], 1.0e-8);
Assert.assertEquals(1.0, optimum.getPoint()[1], 1.0e-8);
@@ -317,7 +317,7 @@ public class NonLinearConjugateGradientO
NonLinearConjugateGradientOptimizer optimizer =
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-6, 1e-6));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, problem, GoalType.MINIMIZE, new double[] { 1, 1 });
Assert.assertTrue(optimum.getValue() > 0.1);
@@ -335,7 +335,7 @@ public class NonLinearConjugateGradientO
new NonLinearConjugateGradientOptimizer(ConjugateGradientFormula.POLAK_RIBIERE,
new SimpleScalarValueChecker(1e-30, 1e-30),
new BrentSolver(1e-15, 1e-13));
- RealPointValuePair optimum =
+ PointValuePair optimum =
optimizer.optimize(100, circle, GoalType.MINIMIZE, new double[] { 98.680, 47.345 });
Point2D.Double center = new Point2D.Double(optimum.getPointRef()[0], optimum.getPointRef()[1]);
Assert.assertEquals(69.960161753, circle.getRadius(center), 1.0e-8);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/linear/SimplexSolverTest.java Sun Feb 12 00:37:23 2012
@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.PointValuePair;
import org.apache.commons.math.util.Precision;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class SimplexSolverTest {
double epsilon = 1e-6;
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], 0.0d, epsilon) >= 0);
Assert.assertTrue(Precision.compareTo(solution.getPoint()[1], 0.0d, epsilon) >= 0);
@@ -52,7 +52,7 @@ public class SimplexSolverTest {
double epsilon = 1e-6;
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
Assert.assertEquals(5.0, solution.getPoint()[0] + solution.getPoint()[1], epsilon);
Assert.assertEquals(-10.0, solution.getPoint()[2], epsilon);
@@ -84,7 +84,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] {100}, Relationship.GEQ, 0.499900001));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0] * 200.d, 1.d, epsilon) >= 0);
Assert.assertEquals(0.0050, solution.getValue(), epsilon);
@@ -107,7 +107,7 @@ public class SimplexSolverTest {
double epsilon = 1e-7;
SimplexSolver simplex = new SimplexSolver();
- RealPointValuePair solution = simplex.optimize(f, constraints, GoalType.MINIMIZE, false);
+ PointValuePair solution = simplex.optimize(f, constraints, GoalType.MINIMIZE, false);
Assert.assertTrue(Precision.compareTo(solution.getPoint()[0], -1e-18d, epsilon) >= 0);
Assert.assertEquals(1.0d, solution.getPoint()[1], epsilon);
@@ -124,7 +124,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0, 1, 0 }, Relationship.GEQ, 1));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(0.0, solution.getPoint()[0], .0000001);
Assert.assertEquals(1.0, solution.getPoint()[1], .0000001);
@@ -143,7 +143,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0, 0, 0, 0, 1, 0 }, Relationship.GEQ, 5.0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(25.8, solution.getValue(), .0000001);
Assert.assertEquals(23.0, solution.getPoint()[0] + solution.getPoint()[2] + solution.getPoint()[4], 0.0000001);
@@ -162,7 +162,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.GEQ, 8.0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(13.6, solution.getValue(), .0000001);
}
@@ -177,7 +177,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 0 }, Relationship.LEQ, 1.0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(10.0, solution.getValue(), .0000001);
}
@@ -187,7 +187,7 @@ public class SimplexSolverTest {
Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>();
constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, -1.0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(0, solution.getValue(), .0000001);
Assert.assertEquals(0, solution.getPoint()[0], .0000001);
Assert.assertEquals(0, solution.getPoint()[1], .0000001);
@@ -213,7 +213,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 0.6 }, Relationship.GEQ, 10.0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution1 = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution1 = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(15.7143, solution1.getPoint()[0], .0001);
Assert.assertEquals(0.0, solution1.getPoint()[1], .0001);
@@ -235,7 +235,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.7, 0.3, 0.0, 0.0 }, Relationship.GEQ, valB));
constraints.add(new LinearConstraint(new double[] { 0.0, 0.0, 0.0, 0.0, 0.4, 0.6 }, Relationship.GEQ, valC));
- RealPointValuePair solution2 = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution2 = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(40.57143, solution2.getValue(), .0001);
}
@@ -249,7 +249,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.EQ, 4));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
Assert.assertEquals(2.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(2.0, solution.getPoint()[1], 0.0);
Assert.assertEquals(57.0, solution.getValue(), 0.0);
@@ -262,7 +262,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.LEQ, 10));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
Assert.assertEquals(10.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(30.0, solution.getValue(), 0.0);
}
@@ -280,7 +280,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.LEQ, 4));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
Assert.assertEquals(2.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(2.0, solution.getPoint()[1], 0.0);
Assert.assertEquals(50.0, solution.getValue(), 0.0);
@@ -295,7 +295,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.GEQ, 0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, false);
Assert.assertEquals(4.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(0.0, solution.getPoint()[1], 0.0);
Assert.assertEquals(-13.0, solution.getValue(), 0.0);
@@ -309,7 +309,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 1, 2 }, Relationship.LEQ, 14));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
Assert.assertEquals(-2.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(8.0, solution.getPoint()[1], 0.0);
Assert.assertEquals(12.0, solution.getValue(), 0.0);
@@ -347,7 +347,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 45, 678, 76, 52, 23 }, Relationship.EQ, 456356));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(2902.92783505155, solution.getPoint()[0], .0000001);
Assert.assertEquals(480.419243986254, solution.getPoint()[1], .0000001);
Assert.assertEquals(0.0, solution.getPoint()[2], .0000001);
@@ -366,7 +366,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 10, 0, 2 }, Relationship.LEQ, 10));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, false);
Assert.assertEquals(1.0, solution.getPoint()[0], 0.0);
Assert.assertEquals(1.0, solution.getPoint()[1], 0.0);
Assert.assertEquals(0.0, solution.getPoint()[2], 0.0);
@@ -380,7 +380,7 @@ public class SimplexSolverTest {
constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.EQ, 0));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MAXIMIZE, true);
Assert.assertEquals(0, solution.getValue(), .0000001);
}
@@ -507,7 +507,7 @@ public class SimplexSolverTest {
constraints.add(equationFromString(objective.length, "x204 - x192 = 0"));
SimplexSolver solver = new SimplexSolver();
- RealPointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
+ PointValuePair solution = solver.optimize(f, constraints, GoalType.MINIMIZE, true);
Assert.assertEquals(7518.0, solution.getValue(), .0000001);
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/UnivariateMultiStartOptimizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/UnivariateMultiStartOptimizerTest.java?rev=1243186&r1=1243185&r2=1243186&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/UnivariateMultiStartOptimizerTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/UnivariateMultiStartOptimizerTest.java Sun Feb 12 00:37:23 2012
@@ -38,7 +38,7 @@ public class UnivariateMultiStartOptimiz
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 10, g);
optimizer.optimize(300, f, GoalType.MINIMIZE, -100.0, 100.0);
- UnivariateRealPointValuePair[] optima = optimizer.getOptima();
+ UnivariatePointValuePair[] optima = optimizer.getOptima();
for (int i = 1; i < optima.length; ++i) {
double d = (optima[i].getPoint() - optima[i-1].getPoint()) / (2 * FastMath.PI);
Assert.assertTrue(FastMath.abs(d - FastMath.rint(d)) < 1.0e-8);
@@ -60,12 +60,12 @@ public class UnivariateMultiStartOptimiz
UnivariateMultiStartOptimizer<UnivariateFunction> optimizer =
new UnivariateMultiStartOptimizer<UnivariateFunction>(underlying, 5, g);
- UnivariateRealPointValuePair optimum
+ UnivariatePointValuePair optimum
= optimizer.optimize(300, f, GoalType.MINIMIZE, -0.3, -0.2);
Assert.assertEquals(-0.2719561293, optimum.getPoint(), 1e-9);
Assert.assertEquals(-0.0443342695, optimum.getValue(), 1e-9);
- UnivariateRealPointValuePair[] optima = optimizer.getOptima();
+ UnivariatePointValuePair[] optima = optimizer.getOptima();
for (int i = 0; i < optima.length; ++i) {
Assert.assertEquals(f.value(optima[i].getPoint()), optima[i].getValue(), 1e-9);
}