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 2021/08/16 00:05:05 UTC

[commons-math] 01/02: Make debugging parameters optional (unit test).

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit 1d1fe2acc06c38d46404595a51e66221dfc2c922
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Sun Aug 15 18:55:49 2021 +0200

    Make debugging parameters optional (unit test).
    
    First optional parameter is the prefix of the output file's name.
    Second optional parameter is the list of simplex vertices to save.
---
 .../scalar/noderiv/SimplexOptimizerTest.java       | 108 ++++++++++++++++++---
 .../std_test_func.simplex.hedar_fukushima.csv      |  53 +++++-----
 .../std_test_func.simplex.multidirectional.csv     |  51 +++++-----
 .../noderiv/std_test_func.simplex.nelder_mead.csv  |  51 +++++-----
 4 files changed, 171 insertions(+), 92 deletions(-)

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 0de9418..23cc75f 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
@@ -18,6 +18,7 @@ package org.apache.commons.math4.legacy.optim.nonlinear.scalar.noderiv;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.ArrayList;
 import java.io.PrintWriter;
 import java.io.IOException;
 import java.nio.file.Files;
@@ -136,6 +137,8 @@ public class SimplexOptimizerTest {
         private final boolean withSA;
         /** File prefix (for saving debugging info). */
         private final String tracePrefix;
+        /** Indices of simplex points to be saved for debugging. */
+        private final int[] traceIndices;
 
         /**
          * @param function Test function.
@@ -149,6 +152,9 @@ public class SimplexOptimizerTest {
          * @param withSA Whether to perform simulated annealing.
          * @param tracePrefix Prefix of the file where to save simplex
          * transformations during the optimization.
+         * Can be {@code null} (no debugging).
+         * @param traceIndices Indices of simplex points to be saved.
+         * Can be {@code null} (all points are saved).
          */
         Task(MultivariateFunction function,
              double[] start,
@@ -158,7 +164,8 @@ public class SimplexOptimizerTest {
              double simplexSideLength,
              double jitter,
              boolean withSA,
-             String tracePrefix) {
+             String tracePrefix,
+             int[] traceIndices) {
             this.function = function;
             this.start = start;
             this.optimum = optimum;
@@ -168,6 +175,7 @@ public class SimplexOptimizerTest {
             this.jitter = jitter;
             this.withSA = withSA;
             this.tracePrefix = tracePrefix;
+            this.traceIndices = traceIndices;
         }
 
         @Override
@@ -287,11 +295,10 @@ public class SimplexOptimizerTest {
                     }
 
                     final String fieldSep = " ";
-                    // 1 line per simplex point.
+                    // 1 line per simplex point (requested for tracing).
                     final List<PointValuePair> points = simplex.asList();
-                    // Repeat first point on output (for plotting).
-                    points.add(points.get(0));
-                    for (PointValuePair p : points) {
+                    for (int index : traceIndices) {
+                        final PointValuePair p = points.get(index);
                         out.print(numEval + fieldSep +
                                   p.getValue() + fieldSep);
 
@@ -448,17 +455,86 @@ public class SimplexOptimizerTest {
             final double sideLength = a.getDouble(index++);
             final double jitter = a.getDouble(index++);
             final boolean withSA = a.getBoolean(index++);
-            final String tracePrefix = a.getString(index++);
-
-            return new Task(funcGen.withDimension(dim),
-                            start,
-                            optimum,
-                            pointTol,
-                            funcEval,
-                            sideLength,
-                            jitter,
-                            withSA,
-                            tracePrefix);
+
+            if (index == a.size()) {
+                // No more arguments.
+                return new Task(funcGen.withDimension(dim),
+                                start,
+                                optimum,
+                                pointTol,
+                                funcEval,
+                                sideLength,
+                                jitter,
+                                withSA,
+                                null,
+                                null);
+            } else {
+                // Debugging configuration.
+                final String tracePrefix = a.getString(index++);
+                final int[] spxIndices = tracePrefix == null ?
+                    null :
+                    toSimplexIndices(a.getString(index++), dim);
+
+                return new Task(funcGen.withDimension(dim),
+                                start,
+                                optimum,
+                                pointTol,
+                                funcEval,
+                                sideLength,
+                                jitter,
+                                withSA,
+                                tracePrefix,
+                                spxIndices);
+            }
+        }
+
+        /**
+         * @param str Space-separated list of indices referring to
+         * simplex's points (in the interval {@code [0, dim]}).
+         * The string "LAST" will be converted to index {@code dim}.
+         * The empty string, the string "ALL" and {@code null} will be
+         * converted to all the indices in the interval {@code [0, dim]}.
+         * @param dim Space dimension.
+         * @return the indices (in the order specified in {@code str}).
+         * @throws IllegalArgumentException if an index is out the
+         * {@code [0, dim]} interval.
+         */
+        private static int[] toSimplexIndices(String str,
+                                              int dim) {
+            final List<Integer> list = new ArrayList<>();
+
+            if (str == null ||
+                str.equals("")) {
+                for (int i = 0; i <= dim; i++) {
+                    list.add(i);
+                }
+            } else {
+                for (String s : str.split("\\s+")) {
+                    if (s.equals("LAST")) {
+                        list.add(dim);
+                    } else if (str.equals("ALL")) {
+                        for (int i = 0; i <= dim; i++) {
+                            list.add(i);
+                        }
+                    } else {
+                        final int index = Integer.valueOf(s);
+                        if (index < 0 ||
+                            index > dim) {
+                            throw new IllegalArgumentException("index: " + index +
+                                                               " (dim=" + dim + ")");
+                        }
+                        list.add(index);
+                    }
+                }
+            }
+
+            final int len = list.size();
+            final int[] indices = new int[len];
+            for (int i = 0; i < len; i++) {
+                indices[i] = list.get(i);
+            }
+
+            return indices;
         }
 
         /**
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 f007239..fdd2fb4 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
@@ -26,32 +26,33 @@
 #  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: File prefix for debugging (or empty slot for no debugging)
+#  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")
 #
 # 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, 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
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 e9dbb19..66824f0 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
@@ -26,31 +26,32 @@
 #  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: File prefix for debugging (or empty slot for no debugging)
+#  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")
 #
 # 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, 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
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 477acfe..86dc3ab 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
@@ -26,31 +26,32 @@
 #  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: File prefix for debugging (or empty slot for no debugging)
+#  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")
 #
 # 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, 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