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/09 16:41:38 UTC
[commons-math] 06/09: Web links to reference definitions of test
functions.
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 7ce320700ad0b4d0befcdbb96567d7363a561fd0
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Mon Aug 9 17:56:52 2021 +0200
Web links to reference definitions of test functions.
Changed "TestFunction.DIFF_POW" to match the definition.
---
.../commons/math4/legacy/optim/nonlinear/scalar/TestFunction.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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 44ebc4f..798ada1 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
@@ -24,6 +24,7 @@ import org.apache.commons.math4.legacy.core.jdkmath.AccurateMath;
* Multivariate scalar functions for testing an optimizer.
*/
public enum TestFunction {
+ // https://www.sfu.ca/~ssurjano/spheref.html
SPHERE(dim -> {
return x -> {
double f = 0;
@@ -87,12 +88,12 @@ public enum TestFunction {
return 1 - elli.value(x);
};
}),
+ // https://www.sfu.ca/~ssurjano/sumpow.html
DIFF_POW(dim -> {
- final double A = 10d / (dim - 1);
return x -> {
double f = 0;
for (int i = 0; i < dim; i++) {
- f += AccurateMath.pow(Math.abs(x[i]), A * i + 2);
+ f += AccurateMath.pow(Math.abs(x[i]), i + 2);
}
return f;
};
@@ -104,6 +105,7 @@ public enum TestFunction {
return f;
};
}),
+ // https://www.sfu.ca/~ssurjano/ackley.html
ACKLEY(dim -> {
final double A = 20;
final double B = 0.2;