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 f58da4abf50d8ff627cc66dc89ece734ab98a0e5 Author: Gilles Sadowski <gillese...@gmail.com> AuthorDate: Thu Aug 26 02:05:15 2021 +0200 Use default SA setup in "SimplexOptimizerTest" (unit test). A single additional search finds the optimum of the test functions. --- .../scalar/noderiv/SimplexOptimizerTest.java | 8 +---- .../std_test_func.simplex.hedar_fukushima.csv | 34 +++++++++++----------- .../noderiv/std_test_func.simplex.nelder_mead.csv | 2 +- 3 files changed, 19 insertions(+), 25 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 a8fc3ff..33d6190 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 @@ -48,7 +48,6 @@ import org.apache.commons.math4.legacy.optim.SimpleBounds; import org.apache.commons.math4.legacy.optim.nonlinear.scalar.GoalType; import org.apache.commons.math4.legacy.optim.nonlinear.scalar.ObjectiveFunction; import org.apache.commons.math4.legacy.optim.nonlinear.scalar.SimulatedAnnealing; -import org.apache.commons.math4.legacy.optim.nonlinear.scalar.PopulationSize; import org.apache.commons.math4.legacy.optim.nonlinear.scalar.TestFunction; /** @@ -195,7 +194,6 @@ public class SimplexOptimizerTest { final int dim = start.length; final SimulatedAnnealing sa; - final PopulationSize popSize; if (withSA) { final SimulatedAnnealing.CoolingSchedule coolSched = SimulatedAnnealing.CoolingSchedule.decreasingExponential(SA_COOL_FACTOR); @@ -205,11 +203,8 @@ public class SimplexOptimizerTest { SA_END_PROB, coolSched, RandomSource.KISS.create()); - - popSize = new PopulationSize(dim); } else { sa = null; - popSize = null; } final SimplexOptimizer optim = new SimplexOptimizer(-1, CONVERGENCE_CHECK); @@ -225,8 +220,7 @@ public class SimplexOptimizerTest { new InitialGuess(start), initialSimplex, factory, - sa, - popSize); + sa); final double[] endPoint = result.getPoint(); final double funcValue = result.getValue(); 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 f63414c..d6c0d66 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 @@ -30,22 +30,22 @@ # # Caveat: Some tests are commented out (cf. JIRA: MATH-1552). # -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, 6, 10, 5e-5, 600, 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 +PARABOLA, 8, 0 0 0 0 0 0 0 0, 20, 40, 1e-4, 900, true +ROSENBROCK, 2, 1 1, 0.9, 1.1, 1e-4, 160, true +CIGAR, 2, 0 0, 2, 3, 5e-5, 140, true +SPHERE, 2, 0 0, 2, 3, 5e-4, 110, true +ELLI, 2, 0 0, 3, 4, 1e-4, 150, true +TWO_AXES, 2, 0 0, 3, 4, 1e-4, 160, true +CIG_TAB, 2, 0 0, 3, 4, 1e-3, 150, true +TABLET, 2, 0 0, 3, 4, 2e-4, 160, true +SUM_POW, 2, 0 0, 3, 4, 1e-2, 110, true +ACKLEY, 2, 0 0, 2, 4, 1e-6, 170, true +RASTRIGIN, 2, 0 0, 6, 10, 5e-5, 130, true +GRIEWANK, 2, 0 0, 2, 3, 1e-1, 100, true +LEVY, 2, 1 1, 0.9, 1.1, 1e-3, 110, true +SCHWEFEL, 2, 420.9687 420.9687, 9, 11, 1, 110, true +ZAKHAROV, 2, 0 0, 3, 4, 1e-4, 130, true +PERM, 2, 1 2, 0.9, 1.1, 2e-3, 150, true +STYBLINSKI_TANG, 2, -2.903534 -2.903534, 1, 2, 1e-4, 120, 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.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 99e520d..5ee1cae 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 @@ -45,7 +45,7 @@ SUM_POW, 2, 0 0, 3, 4, 1e-2, 75, false ACKLEY, 2, 0 0, 2, 4, 1e-6, 145, false ACKLEY, 2, 0 0, 2, 4, 1e-6, 160, true RASTRIGIN, 2, 0 0, 6, 10, 5e-5, 105, false -RASTRIGIN, 2, 0 0, 6, 10, 5e-5, 120, true +RASTRIGIN, 2, 0 0, 6, 10, 5e-5, 140, true GRIEWANK, 2, 0 0, 2, 3, 1e-1, 75, false GRIEWANK, 2, 0 0, 2, 3, 1e-1, 90, true LEVY, 2, 1 1, 0.9, 1.1, 1e-3, 75, false