Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-math
diff --git a/commons-math-legacy/src/test/gnuplot/legacy/optim/nonlinear/scalar/noderiv/simplex_2D.gnuplot b/commons-math-legacy/src/test/gnuplot/legacy/optim/nonlinear/scalar/noderiv/simplex_2D.gnuplot
index ece6416..83056b3 100644
--- a/commons-math-legacy/src/test/gnuplot/legacy/optim/nonlinear/scalar/noderiv/simplex_2D.gnuplot
+++ b/commons-math-legacy/src/test/gnuplot/legacy/optim/nonlinear/scalar/noderiv/simplex_2D.gnuplot
@@ -32,8 +32,9 @@
numOptim = STATS_blocks
evalColIndex = 1
objColIndex = 2
-xColIndex = 3
-yColIndex = 4
+absObjDiffColIndex = 3
+xColIndex = 4
+yColIndex = 5
set size 1, 1
set origin 0, 0
@@ -46,7 +47,10 @@
numEval = STATS_max
# Objective function range.
- stats file index iOptim u objColIndex nooutput
+ # Using the absolute value of the difference with the objective function
+ # at the optimum in order to be able to display the logarithm even if the
+ # objective function can be negative.
+ stats file index iOptim u absObjDiffColIndex nooutput
numSpx = STATS_blank
minObj = STATS_min
maxObj = STATS_max
@@ -89,11 +93,11 @@
plot \
file index iOptim \
every ::0::2 \
- u 0:(log($2)) \
- w l lc "black" title "log_{10}f", \
+ u 0:(log($3)) \
+ w l lc "black" title "log_{10}|f(x) - f(optimum)|", \
'' index iOptim \
every ::0::2:iSpx \
- u 0:(log($2)) \
+ u 0:(log($3)) \
w lp pt 1 lc "black" lw 2 notitle
# Simplex.
@@ -107,10 +111,14 @@
every :::(iSpx - showSpx < 0 ? 0 : iSpx - showSpx)::iSpx \
u xColIndex:yColIndex \
w l notitle, \
- '' index "Optimum" u 1:2 ps 5 pt 4 notitle
+ '' index "Optimum" \
+ u 1:2 ps 2.5 pt 4 title "Expected", \
+ '' index iOptim \
+ every :::lastSpx::lastSpx \
+ u xColIndex:yColIndex ps 1.5 pt 6 title "Found"
unset multiplot
- pause 0.1
+ pause 0.15
}
pause 1
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/TestFunction.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/TestFunction.java
index 0292bd8..f28bf11 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/TestFunction.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/TestFunction.java
@@ -19,7 +19,6 @@
import java.util.function.Function;
import java.util.function.DoubleUnaryOperator;
import org.apache.commons.math4.legacy.analysis.MultivariateFunction;
-import org.apache.commons.math4.legacy.core.jdkmath.AccurateMath;
/**
* Generators of {@link MultivariateFunction multivariate scalar functions}.
@@ -71,20 +70,26 @@
};
}),
TWO_AXES(dim -> {
+ final int halfDim = dim / 2;
return x -> {
double f = 0;
- for (int i = 0; i < dim; i++) {
- f += (i < dim / 2 ? 1e6 : 1) * x[i] * x[i];
+ for (int i = 0; i < halfDim; i++) {
+ f += 1e6 * x[i] * x[i];
+ }
+ for (int i = halfDim; i < dim; i++) {
+ f += x[i] * x[i];
}
return f;
};
}),
ELLI(dim -> {
- final double last = dim - 1;
+ final double M = Math.pow(1e3, 1d / (dim - 1));
return x -> {
+ double factor = 1;
double f = 0;
for (int i = 0; i < dim; i++) {
- f += Math.pow(1e3, i / last) * x[i] * x[i];
+ f += factor * x[i] * x[i];
+ factor *= M;
}
return f;
};
@@ -96,22 +101,15 @@
};
}),
// https://www.sfu.ca/~ssurjano/sumpow.html
- DIFF_POW(dim -> {
+ SUM_POW(dim -> {
return x -> {
double f = 0;
for (int i = 0; i < dim; i++) {
- f += AccurateMath.pow(Math.abs(x[i]), i + 2);
+ f += Math.pow(Math.abs(x[i]), i + 2);
}
return f;
};
}),
- SS_DIFF_POW(dim -> {
- final MultivariateFunction diffPow = DIFF_POW.withDimension(dim);
- return x -> {
- double f = Math.pow(diffPow.value(x), 0.25);
- return f;
- };
- }),
// https://www.sfu.ca/~ssurjano/ackley.html
ACKLEY(dim -> {
final double A = 20;
@@ -134,33 +132,26 @@
// https://www.sfu.ca/~ssurjano/rastr.html
RASTRIGIN(dim -> {
final double A = 10;
+ final double twopi = 2 * Math.PI;
return x -> {
double sum = 0;
for (int i = 0; i < dim; i++) {
final double xi = x[i];
- sum += xi * xi - A * Math.cos(2 * Math.PI * xi);
+ sum += xi * xi - A * Math.cos(twopi * xi);
}
return A * dim + sum;
};
}),
- // https://www.sfu.ca/~ssurjano/powell.html
- POWELL(dim -> {
- final int last = dim / 4;
+ // http://benchmarkfcns.xyz/benchmarkfcns/salomonfcn.html
+ SALOMON(dim -> {
return x -> {
- double f = 0;
- for (int i = 0; i < last; i++) {
- final int fourI = 4 * i;
- final double x4i = x[fourI];
- final double x4iP1 = x[fourI + 1];
- final double x4iP2 = x[fourI + 2];
- final double x4iP3 = x[fourI + 3];
- final double a = x4i + 10 * x4iP1;
- final double b = x4iP2 - x4iP3;
- final double c = x4iP1 - 2 * x4iP2;
- final double d = x4i - x4iP3;
- f += a * a + 5 * b * b + c * c * c * c + 10 * d * d * d * d;
+ double sum = 0;
+ for (int i = 0; i < dim; i++) {
+ final double xi = x[i];
+ sum += xi * xi;
}
- return f;
+ final double sqrtSum = Math.sqrt(sum);
+ return 1 - Math.cos(2 * Math.PI * sqrtSum) + 0.1 * sqrtSum;
};
}),
ROSENBROCK(dim -> {
@@ -177,6 +168,20 @@
return f;
};
}),
+ // http://benchmarkfcns.xyz/benchmarkfcns/happycatfcn.html
+ HAPPY_CAT(dim -> {
+ final double alpha = 0.125;
+ return x -> {
+ double sum = 0;
+ double sumSq = 0;
+ for (int i = 0; i < dim; i++) {
+ final double xi = x[i];
+ sum += xi;
+ sumSq += xi * xi;
+ }
+ return Math.pow(sumSq - dim, 2 * alpha) + (0.5 * sumSq + sum) / dim + 0.5;
+ };
+ }),
PARABOLA(dim -> {
return x -> {
double f = 0;
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index bd6cd3a..98cc641 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -177,27 +177,15 @@
}
@Test
- public void testDiffPow() {
+ public void testSumPow() {
final int dim = DIM / 2;
double[] startPoint = OptimTestUtils.point(dim, 1.0);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(OptimTestUtils.point(dim, 0.0), 0.0);
- doTest(TestFunction.DIFF_POW.withDimension(dim), startPoint, boundaries,
+ doTest(TestFunction.SUM_POW.withDimension(dim), startPoint, boundaries,
GoalType.MINIMIZE,
- 1e-8, 1e-1, 21000, expected);
- }
-
- @Test
- public void testSsDiffPow() {
- final int dim = DIM / 2;
- double[] startPoint = OptimTestUtils.point(dim, 1.0);
- double[][] boundaries = null;
- PointValuePair expected =
- new PointValuePair(OptimTestUtils.point(dim, 0.0), 0.0);
- doTest(TestFunction.SS_DIFF_POW.withDimension(dim), startPoint, boundaries,
- GoalType.MINIMIZE,
- 1e-2, 1.3e-1, 50000, expected);
+ 1e-8, 1e-1, 21720, expected);
}
@Test
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index bf9bdb4..9724e27 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -299,36 +299,21 @@
}
@Test
- public void testDiffPow() {
+ public void testSumPow() {
double[] startPoint = OptimTestUtils.point(DIM,1.0);
double[] insigma = OptimTestUtils.point(DIM,0.1);
double[][] boundaries = null;
PointValuePair expected =
new PointValuePair(OptimTestUtils.point(DIM,0.0),0.0);
- doTest(TestFunction.DIFF_POW.withDimension(DIM), startPoint, insigma, boundaries,
+ doTest(TestFunction.SUM_POW.withDimension(DIM), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 10, true, 0, 1e-13,
1e-8, 1e-1, 100000, expected);
- doTest(TestFunction.DIFF_POW.withDimension(DIM), startPoint, insigma, boundaries,
+ doTest(TestFunction.SUM_POW.withDimension(DIM), startPoint, insigma, boundaries,
GoalType.MINIMIZE, 10, false, 0, 1e-13,
1e-8, 2e-1, 100000, expected);
}
@Test
- public void testSsDiffPow() {
- double[] startPoint = OptimTestUtils.point(DIM,1.0);
- double[] insigma = OptimTestUtils.point(DIM,0.1);
- double[][] boundaries = null;
- PointValuePair expected =
- new PointValuePair(OptimTestUtils.point(DIM,0.0),0.0);
- doTest(TestFunction.SS_DIFF_POW.withDimension(DIM), startPoint, insigma, boundaries,
- GoalType.MINIMIZE, 10, true, 0, 1e-13,
- 1e-4, 1e-1, 200000, expected);
- doTest(TestFunction.SS_DIFF_POW.withDimension(DIM), startPoint, insigma, boundaries,
- GoalType.MINIMIZE, 10, false, 0, 1e-13,
- 1e-4, 1e-1, 200000, expected);
- }
-
- @Test
public void testAckley() {
double[] startPoint = OptimTestUtils.point(DIM,1.0);
double[] insigma = OptimTestUtils.point(DIM,1.0);
diff --git a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizerTest.java b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizerTest.java
index 23cc75f..a8fc3ff 100644
--- a/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizerTest.java
+++ b/commons-math-legacy/src/test/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/SimplexOptimizerTest.java
@@ -33,7 +33,10 @@
import org.junit.jupiter.params.aggregator.ArgumentsAggregationException;
import org.junit.jupiter.params.aggregator.AggregateWith;
import org.junit.jupiter.params.provider.CsvFileSource;
+import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
+import org.apache.commons.rng.sampling.distribution.ContinuousUniformSampler;
+import org.apache.commons.rng.sampling.UnitSphereSampler;
import org.apache.commons.math4.legacy.core.MathArrays;
import org.apache.commons.math4.legacy.exception.MathUnsupportedOperationException;
import org.apache.commons.math4.legacy.exception.TooManyEvaluationsException;
@@ -89,7 +92,7 @@
@ParameterizedTest
@CsvFileSource(resources = NELDER_MEAD_INPUT_FILE)
void testFunctionWithNelderMead(@AggregateWith(TaskAggregator.class) Task task) {
- // task.checkAlongLine(1000, true);
+ // task.checkAlongLine(1000);
task.run(new NelderMeadTransform());
}
@@ -114,7 +117,7 @@
/** Default convergence criterion. */
private static final double CONVERGENCE_CHECK = 1e-9;
/** Default cooling factor. */
- private static final double SA_COOL_FACTOR = 0.5;
+ private static final double SA_COOL_FACTOR = 0.7;
/** Default acceptance probability at beginning of SA. */
private static final double SA_START_PROB = 0.9;
/** Default acceptance probability at end of SA. */
@@ -131,8 +134,6 @@
private final int functionEvaluations;
/** Side length of initial simplex. */
private final double simplexSideLength;
- /** Range of random noise. */
- private final double jitter;
/** Whether to perform simulated annealing. */
private final boolean withSA;
/** File prefix (for saving debugging info). */
@@ -148,7 +149,6 @@
* {@code optimum}.
* @param functionEvaluations Allowed number of function evaluations.
* @param simplexSideLength Side length of initial simplex.
- * @param jitter Size of random jitter.
* @param withSA Whether to perform simulated annealing.
* @param tracePrefix Prefix of the file where to save simplex
* transformations during the optimization.
@@ -162,7 +162,6 @@
double pointTolerance,
int functionEvaluations,
double simplexSideLength,
- double jitter,
boolean withSA,
String tracePrefix,
int[] traceIndices) {
@@ -172,7 +171,6 @@
this.pointTolerance = pointTolerance;
this.functionEvaluations = functionEvaluations;
this.simplexSideLength = simplexSideLength;
- this.jitter = jitter;
this.withSA = withSA;
this.tracePrefix = tracePrefix;
this.traceIndices = traceIndices;
@@ -219,16 +217,12 @@
optim.addObserver(createCallback(factory));
}
- final Simplex initialSimplex =
- Simplex.alongAxes(OptimTestUtils.point(dim,
- simplexSideLength,
- jitter));
- final double[] startPoint = OptimTestUtils.point(start, jitter);
+ final Simplex initialSimplex = Simplex.equalSidesAlongAxes(dim, simplexSideLength);
final PointValuePair result =
optim.optimize(new MaxEval(maxEval),
new ObjectiveFunction(function),
GoalType.MINIMIZE,
- new InitialGuess(startPoint),
+ new InitialGuess(start),
initialSimplex,
factory,
sa,
@@ -258,6 +252,7 @@
final String sep = "__";
final String name = tracePrefix + sanitizeBasename(function + sep +
+ Arrays.toString(start) + sep +
factory + sep);
// Create file; write first data block (optimum) and columns header.
@@ -274,15 +269,17 @@
out.println();
out.println("#");
- out.print("# <1: evaluations> <2: objective>");
+ out.print("# <1: evaluations> <2: f(x)> <3: |f(x) - f(optimum)|>");
for (int i = 0; i < start.length; i++) {
- out.print(" <" + (i + 3) + ": coordinate " + i + ">");
+ out.print(" <" + (i + 4) + ": x[" + i + "]>");
}
out.println();
} catch (IOException e) {
Assertions.fail(e.getMessage());
}
+ final double fAtOptimum = function.value(optimum);
+
// Return callback function.
return (simplex, isInit, numEval) -> {
try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(Paths.get(name),
@@ -300,7 +297,8 @@
for (int index : traceIndices) {
final PointValuePair p = points.get(index);
out.print(numEval + fieldSep +
- p.getValue() + fieldSep);
+ p.getValue() + fieldSep +
+ Math.abs(p.getValue() - fAtOptimum) + fieldSep);
final double[] coord = p.getPoint();
for (int i = 0; i < coord.length; i++) {
@@ -321,12 +319,10 @@
* {@link #start} is reached at the {@link #optimum}.
*
* @param numPoints Number of points at which to evaluate the function.
- * @param plot Whether to generate a file (for visual debugging).
*/
- public void checkAlongLine(int numPoints,
- boolean plot) {
- if (plot) {
- final String name = createPlotBasename(function, start, optimum);
+ public void checkAlongLine(int numPoints) {
+ if (tracePrefix != null) {
+ final String name = tracePrefix + createPlotBasename(function, start, optimum);
try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(Paths.get(name)))) {
checkAlongLine(numPoints, out);
} catch (IOException e) {
@@ -448,14 +444,29 @@
final TestFunction funcGen = a.get(index++, TestFunction.class);
final int dim = a.getInteger(index++);
- final double[] start = toArrayOfDoubles(a.getString(index++), dim);
final double[] optimum = toArrayOfDoubles(a.getString(index++), dim);
+ final double minRadius = a.getDouble(index++);
+ final double maxRadius = a.getDouble(index++);
+ if (minRadius < 0 ||
+ maxRadius < 0 ||
+ minRadius >= maxRadius) {
+ throw new ArgumentsAggregationException("radii");
+ }
final double pointTol = a.getDouble(index++);
final int funcEval = a.getInteger(index++);
- final double sideLength = a.getDouble(index++);
- final double jitter = a.getDouble(index++);
final boolean withSA = a.getBoolean(index++);
+ // Generate a start point within a spherical shell around the optimum.
+ final UniformRandomProvider rng = OptimTestUtils.rng();
+ final double radius = ContinuousUniformSampler.of(rng, minRadius, maxRadius).sample();
+ final double[] start = UnitSphereSampler.of(rng, dim).sample();
+ for (int i = 0; i < dim; i++) {
+ start[i] *= radius;
+ start[i] += optimum[i];
+ }
+ // Simplex side.
+ final double sideLength = 0.5 * (maxRadius - minRadius);
+
if (index == a.size()) {
// No more arguments.
return new Task(funcGen.withDimension(dim),
@@ -464,7 +475,6 @@
pointTol,
funcEval,
sideLength,
- jitter,
withSA,
null,
null);
@@ -481,7 +491,6 @@
pointTol,
funcEval,
sideLength,
- jitter,
withSA,
tracePrefix,
spxIndices);
diff --git a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.hedar_fukushima.csv b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.hedar_fukushima.csv
index fdd2fb4..3e6fa4c 100644
--- a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.hedar_fukushima.csv
+++ b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.hedar_fukushima.csv
@@ -17,42 +17,35 @@
#
# Format (CSV) defined in "SimplexOptimizerTest.Task" class.
# Columns are:
-# 0: function name (value from "TestFunction" enum)
-# 1: space dimension (n)
-# 2: nominal start point ("n" space-separated values)
-# 3: optimum ("n" space-separated values)
-# 4: maximum expected distance from the result to the optimum
-# 5: expected number of function evaluations
-# 6: length of the sides of the initial simplex
-# 7: size of the random noise (to generate slightly different initial conditions)
-# 8: whether to perform simulated annealing
-# 9: [optional] File prefix for debugging (or empty slot for no debugging)
-# 10: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
+# 0: Function name (value from "TestFunction" enum)
+# 1: Space dimension (n)
+# 2: Optimum ("n" space-separated values)
+# 3: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 4: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 5: Maximum expected distance from the result to the optimum
+# 6: Expected number of function evaluations
+# 7: Whether to perform simulated annealing
+# 8: [optional] File prefix for debugging (or empty slot for no debugging)
+# 9: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
#
# Caveat: Some tests are commented out (cf. JIRA: MATH-1552).
#
-PARABOLA, 2, 4.6 5.8, 0 0, 1e-4, 820, 1, 2e-1, true
-PARABOLA, 4, 2.5 3.1 4.6 5.8, 0 0 0 0, 1e-4, 820, 1, 2e-1, true
-ROSENBROCK, 2, -1.2 1, 1 1, 1e-4, 380, 1, 1e-1, true
-ROSENBROCK, 5, -4.4 -3.5 -2.6 -1.7 -0.8, 1 1 1 1 1, 1e-4, 3800, 5e-1, 1e-1, true
-ROSENBROCK, 10, -0.1 0.1 0.2 -0.1 -0.2 0.3 0.2 -0.1 0.2 -0.3, 1 1 1 1 1 1 1 1 1 1, 5e-5, 38000, 3, 5e-2, true
-POWELL, 4, 3 -1 -2 1, 0 0 0 0, 5e-3, 1100, 3, 1e-1, true
-CIGAR, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-5, 75000, 3, 1e-1, true
-SPHERE, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-4, 47000, 3, 1e-1, true
-ELLI, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 25000, 3, 1e-1, true
-#TWO_AXES, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 1000, 3, 1e-1, true
-#CIG_TAB, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 1000, 3, 1e-1, true
-TABLET, 11, 2 3 4 -3 -2 -1 2 3 4 3 -1, 0 0 0 0 0 0 0 0 0 0 0, 2e-4, 41000, 3, 1e-1, true
-#DIFF_POW, 7, 1 -1 1 -1 1 -1 1, 0 0 0 0 0 0 0, 1e-2, 2500, 3, 1e-1, true
-SS_DIFF_POW, 6, -3.2 2.1 1.2 -2.3 3.2 -2.1, 0 0 0 0 0 0, 1e-3, 10500, 3, 1e-1, true
-#ACKLEY, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 1100, 3, 5e-1, true
-#RASTRIGIN, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 10000, 3, 5e-1, true
-#GRIEWANK, 3, -210 123 -456, 0 0 0, 1e-1, 1000, 50, 100, true
-#LEVY, 4, 4 -6 -2 8, 1 1 1 1, 1e-3, 3000, 1, 1, true
-#SCHWEFEL, 2, 100 -200, 420.9687 420.9687, 1, 300, 100, 100, true
-ZAKHAROV, 5, -4 -2 3 5 7, 0 0 0 0 0, 1e-4, 2200, 1.5, 1, true
-PERM, 2, -2 -1, 1 2, 2e-3, 210, 5e-1, 1e-1, true
-#PERM, 3, -2 -3 -1, 1 2 3, 5e-5, 200, 5e-1, 1e-1, true
-#PERM, 4, -2 -3 -4 -1, 1 2 3 4, 5e-4, 2200, 5e-1, 1e-1, true
-#PERM, 5, -2 -3 -4 -5 -1, 1 2 3 4 5, 5e-4, 200, 5e-1, 1e-1, true
-#STYBLINSKI_TANG, 4, 1 2 3 4, -2.903534 -2.903534 -2.903534 -2.903534, 1e-4, 500, 1, 5e-1, true
+PARABOLA, 8, 0 0 0 0 0 0 0 0, 20, 40, 1e-4, 7200, true
+ROSENBROCK, 2, 1 1, 0.9, 1.1, 1e-4, 420, true
+CIGAR, 2, 0 0, 2, 3, 5e-5, 240, true
+SPHERE, 2, 0 0, 2, 3, 5e-4, 200, true
+ELLI, 2, 0 0, 3, 4, 1e-4, 350, true
+TWO_AXES, 2, 0 0, 3, 4, 1e-4, 400, true
+CIG_TAB, 2, 0 0, 3, 4, 1e-3, 280, true
+TABLET, 2, 0 0, 3, 4, 2e-4, 340, true
+SUM_POW, 2, 0 0, 3, 4, 1e-2, 190, true
+ACKLEY, 2, 0 0, 2, 4, 1e-6, 310, true
+#RASTRIGIN, 2, 0 0, 0.9, 1.1, 5e-5, 1000, true
+GRIEWANK, 2, 0 0, 2, 3, 1e-1, 500, true
+LEVY, 2, 1 1, 0.9, 1.1, 1e-3, 200, true
+SCHWEFEL, 2, 420.9687 420.9687, 9, 11, 1, 200, true
+ZAKHAROV, 2, 0 0, 3, 4, 1e-4, 1000, true
+PERM, 2, 1 2, 0.9, 1.1, 2e-3, 260, true
+STYBLINSKI_TANG, 2, -2.903534 -2.903534, 1, 2, 1e-4, 210, true
+#HAPPY_CAT, 2, -1 -1, 2, 3, 1e-4, 500, true
+#SALOMON, 2, 0 0, 2, 3, 1e-4, 500, true
diff --git a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.multidirectional.csv b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.multidirectional.csv
index 66824f0..f13c7eb 100644
--- a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.multidirectional.csv
+++ b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.multidirectional.csv
@@ -17,41 +17,35 @@
#
# Format (CSV) defined in "SimplexOptimizerTest.Task" class.
# Columns are:
-# 0: function name (value from "TestFunction" enum)
-# 1: space dimension (n)
-# 2: nominal start point ("n" space-separated values)
-# 3: optimum ("n" space-separated values)
-# 4: maximum expected distance from the result to the optimum
-# 5: expected number of function evaluations
-# 6: length of the sides of the initial simplex
-# 7: size of the random noise (to generate slightly different initial conditions)
-# 8: whether to perform simulated annealing
-# 9: [optional] File prefix for debugging (or empty slot for no debugging)
-# 10: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
+# 0: Function name (value from "TestFunction" enum)
+# 1: Space dimension (n)
+# 2: Optimum ("n" space-separated values)
+# 3: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 4: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 5: Maximum expected distance from the result to the optimum
+# 6: Expected number of function evaluations
+# 7: Whether to perform simulated annealing
+# 8: [optional] File prefix for debugging (or empty slot for no debugging)
+# 9: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
#
# Caveat: Some tests are commented out (cf. JIRA: MATH-1552).
#
-PARABOLA, 4, 2.5 3.1 4.6 5.8, 0 0 0 0, 1e-4, 380, 1, 2e-1, false
-ROSENBROCK, 2, -1.2 1, 1 1, 2e-3, 11100, 1, 1e-1, false
-#ROSENBROCK, 5, -4.4 -3.5 -2.6 -1.7 -0.8, 1 1 1 1 1, 1e-4, 180, 5e-1, 1e-1, false
-ROSENBROCK, 10, -0.1 0.1 0.2 -0.1 -0.2 0.3 0.2 -0.1 0.2 -0.3, 1 1 1 1 1 1 1 1 1 1, 3e-3, 100000, 1, 5e-2, false
-#POWELL, 4, 3 -1 -2 1, 0 0 0 0, 5e-3, 420, 1, 1e-1, false
-CIGAR, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-6, 7000, 1, 1e-1, false
-SPHERE, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-5, 3600, 1, 1e-1, false
-ELLI, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 50000, 1, 1e-1, false
-TWO_AXES, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-6, 3200, 1, 1e-1, false
-CIG_TAB, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 5e-6, 2900, 1, 1e-1, false
-TABLET, 11, 2 3 4 -3 -2 -1 2 3 4 3 -1, 0 0 0 0 0 0 0 0 0 0 0, 5e-6, 3200, 1, 1e-1, false
-DIFF_POW, 7, 1 -1 1 -1 1 -1 1, 0 0 0 0 0 0 0, 5e-4, 2500, 1, 1e-1, false
-SS_DIFF_POW, 6, -3.2 2.1 1.2 -2.3 3.2 -2.1, 0 0 0 0 0 0, 1e-3, 4000, 1, 1e-1, false
-ACKLEY, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 770, 1, 5e-1, false
-#RASTRIGIN, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 10000, 1, 5e-1, false
-#GRIEWANK, 3, -210 123 -456, 0 0 0, 1e-1, 1000, 50, 100, false
-#LEVY, 4, 4 -6 -2 8, 1 1 1 1, 1e-3, 3000, 1, 1, false
-#SCHWEFEL, 2, 100 -200, 420.9687 420.9687, 1, 300, 100, 100, false
-ZAKHAROV, 5, -4 -2 3 5 7, 0 0 0 0 0, 1e-4, 3100, 1.5, 1, false
-PERM, 2, -2 -1, 1 2, 3e-2, 25000, 5e-1, 1e-1, false
-#PERM, 3, -2 -3 -1, 1 2 3, 5e-5, 200, 5e-1, 1e-1, false
-#PERM, 4, -2 -3 -4 -1, 1 2 3 4, 5e-4, 2200, 5e-1, 1e-1, false
-#PERM, 5, -2 -3 -4 -5 -1, 1 2 3 4 5, 5e-4, 200, 5e-1, 1e-1, false
-#STYBLINSKI_TANG, 4, 1 2 3 4, -2.903534 -2.903534 -2.903534 -2.903534, 1e-4, 500, 1, 5e-1, false
+PARABOLA, 8, 0 0 0 0 0 0 0 0, 20, 40, 1e-4, 7200, false
+ROSENBROCK, 2, 1 1, 0.9, 1.1, 2e-3, 600, true
+CIGAR, 2, 0 0, 2, 3, 5e-5, 240, false
+SPHERE, 2, 0 0, 2, 3, 5e-4, 200, false
+ELLI, 2, 0 0, 3, 4, 1e-4, 350, false
+TWO_AXES, 2, 0 0, 3, 4, 1e-4, 400, false
+CIG_TAB, 2, 0 0, 3, 4, 1e-3, 280, false
+TABLET, 2, 0 0, 3, 4, 2e-4, 340, false
+SUM_POW, 2, 0 0, 3, 4, 1e-2, 190, false
+ACKLEY, 2, 0 0, 2, 4, 1e-6, 310, false
+#RASTRIGIN, 2, 0 0, 0.9, 1.1, 5e-5, 1000, false
+GRIEWANK, 2, 0 0, 2, 3, 1e-1, 500, false
+LEVY, 2, 1 1, 0.9, 1.1, 1e-3, 200, false
+SCHWEFEL, 2, 420.9687 420.9687, 9, 11, 1, 200, false
+ZAKHAROV, 2, 0 0, 3, 4, 1e-4, 1000, false
+PERM, 2, 1 2, 0.9, 1.1, 2e-3, 540, true
+STYBLINSKI_TANG, 2, -2.903534 -2.903534, 1, 2, 1e-4, 210, false
+#HAPPY_CAT, 2, -1 -1, 2, 3, 1e-4, 500, false
+#SALOMON, 2, 0 0, 2, 3, 1e-4, 500, false
diff --git a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.nelder_mead.csv b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.nelder_mead.csv
index 86dc3ab..457ae74 100644
--- a/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.nelder_mead.csv
+++ b/commons-math-legacy/src/test/resources/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/std_test_func.simplex.nelder_mead.csv
@@ -17,41 +17,35 @@
#
# Format (CSV) defined in "SimplexOptimizerTest.Task" class.
# Columns are:
-# 0: function name (value from "TestFunction" enum)
-# 1: space dimension (n)
-# 2: nominal start point ("n" space-separated values)
-# 3: optimum ("n" space-separated values)
-# 4: maximum expected distance from the result to the optimum
-# 5: expected number of function evaluations
-# 6: length of the sides of the initial simplex
-# 7: size of the random noise (to generate slightly different initial conditions)
-# 8: whether to perform simulated annealing
-# 9: [optional] File prefix for debugging (or empty slot for no debugging)
-# 10: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
+# 0: Function name (value from "TestFunction" enum)
+# 1: Space dimension (n)
+# 2: Optimum ("n" space-separated values)
+# 3: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 4: Minimal radius of the spherical shell around the optimum (within which to randomly select a start point)
+# 5: Maximum expected distance from the result to the optimum
+# 6: Expected number of function evaluations
+# 7: Whether to perform simulated annealing
+# 8: [optional] File prefix for debugging (or empty slot for no debugging)
+# 9: [optional] Indices (space-separated) of simplex points to save (empty means "all points")
#
# Caveat: Some tests are commented out (cf. JIRA: MATH-1552).
#
-PARABOLA, 4, 2.5 3.1 4.6 5.8, 0 0 0 0, 1e-4, 200, 1, 2e-1, false
-ROSENBROCK, 2, -1.2 1, 1 1, 1e-4, 180, 1, 1e-1, false
-ROSENBROCK, 5, -4.4 -3.5 -2.6 -1.7 -0.8, 1 1 1 1 1, 1e-4, 800, 5e-1, 1e-1, false
-ROSENBROCK, 10, -0.1 0.1 0.2 -0.1 -0.2 0.3 0.2 -0.1 0.2 -0.3, 1 1 1 1 1 1 1 1 1 1, 5e-5, 9000, 1, 5e-2, false
-POWELL, 4, 3 -1 -2 1, 0 0 0 0, 5e-3, 420, 1, 1e-1, false
-CIGAR, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-5, 7000, 1, 1e-1, false
-SPHERE, 13, -1.2 2.3 -3.2 2.1 1.2 -2.3 3.2 -2.1 -1.2 2.3 -3.2 2.1 -1.2, 0 0 0 0 0 0 0 0 0 0 0 0 0, 5e-4, 3000, 1, 1e-1, false
-ELLI, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 50000, 1, 1e-1, false
-#TWO_AXES, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 5000, 1, 1e-1, false
-#CIG_TAB, 10, 2 3 4 -3 -2 -1 2 3 4 3, 0 0 0 0 0 0 0 0 0 0, 1e-4, 7000, 1, 1e-1, false
-TABLET, 11, 2 3 4 -3 -2 -1 2 3 4 3 -1, 0 0 0 0 0 0 0 0 0 0 0, 2e-4, 3600, 1, 1e-1, false
-#DIFF_POW, 7, 1 -1 1 -1 1 -1 1, 0 0 0 0 0 0 0, 5e-4, 2500, 1, 1e-1, false
-SS_DIFF_POW, 6, -3.2 2.1 1.2 -2.3 3.2 -2.1, 0 0 0 0 0 0, 1e-3, 4000, 1, 1e-1, false
-ACKLEY, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 430, 1, 5e-1, false
-#RASTRIGIN, 4, 3 4 -3 -2, 0 0 0 0, 1e-6, 10000, 1, 5e-1, false
-#GRIEWANK, 3, -210 123 -456, 0 0 0, 1e-1, 1000, 50, 100, false
-#LEVY, 4, 4 -6 -2 8, 1 1 1 1, 1e-3, 3000, 1, 1, false
-#SCHWEFEL, 2, 100 -200, 420.9687 420.9687, 1, 300, 100, 100, false
-ZAKHAROV, 5, -4 -2 3 5 7, 0 0 0 0 0, 5e-5, 500, 1.5, 1, false
-PERM, 2, -2 -1, 1 2, 5e-5, 200, 5e-1, 1e-1, false
-#PERM, 3, -2 -3 -1, 1 2 3, 5e-5, 200, 5e-1, 1e-1, false
-PERM, 4, -2 -3 -4 -1, 1 2 3 4, 5e-3, 2800, 5e-1, 1e-1, false
-#PERM, 5, -2 -3 -4 -5 -1, 1 2 3 4 5, 5e-4, 200, 5e-1, 1e-1, false
-#STYBLINSKI_TANG, 4, 1 2 3 4, -2.903534 -2.903534 -2.903534 -2.903534, 1e-4, 500, 1, 5e-1, false
+PARABOLA, 8, 0 0 0 0 0 0 0 0, 20, 40, 1e-4, 7200, false
+ROSENBROCK, 2, 1 1, 0.9, 1.1, 1e-4, 420, false
+CIGAR, 2, 0 0, 2, 3, 5e-5, 240, false
+SPHERE, 2, 0 0, 2, 3, 5e-4, 200, false
+ELLI, 2, 0 0, 3, 4, 1e-4, 350, false
+TWO_AXES, 2, 0 0, 3, 4, 1e-4, 400, false
+CIG_TAB, 2, 0 0, 3, 4, 1e-3, 280, false
+TABLET, 2, 0 0, 3, 4, 2e-4, 340, false
+SUM_POW, 2, 0 0, 3, 4, 1e-2, 190, true
+ACKLEY, 2, 0 0, 2, 4, 1e-6, 310, false
+#RASTRIGIN, 2, 0 0, 0.9, 1.1, 5e-5, 1000, false
+GRIEWANK, 2, 0 0, 2, 3, 1e-1, 500, false
+LEVY, 2, 1 1, 0.9, 1.1, 1e-3, 200, false
+SCHWEFEL, 2, 420.9687 420.9687, 9, 11, 1, 200, false
+ZAKHAROV, 2, 0 0, 3, 4, 1e-4, 1000, false
+PERM, 2, 1 2, 0.9, 1.1, 2e-3, 260, false
+STYBLINSKI_TANG, 2, -2.903534 -2.903534, 1, 2, 1e-4, 210, false
+#HAPPY_CAT, 2, -1 -1, 2, 3, 1e-4, 500, false
+#SALOMON, 2, 0 0, 2, 3, 1e-4, 500, false