Change how simulated annealing affects the transformed simplex (cf. MATH-1622).
Compared with commit 97462b1a1b6f64ab10e06db331d5b6762d979aab, this commit is
more consistent with assumptions of the original (non-hybridized) algorithm.
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/MultiDirectionalTransform.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/MultiDirectionalTransform.java
index b6f2a73..bdd53e0 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/MultiDirectionalTransform.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/optim/nonlinear/scalar/noderiv/MultiDirectionalTransform.java
@@ -90,16 +90,10 @@
evaluationFunction);
final PointValuePair expandedBest = expandedSimplex.get(0);
- if (comparator.compare(expandedBest, reflectedBest) < 0) {
+ if (comparator.compare(expandedBest, reflectedBest) < 0 ||
+ (sa != null &&
+ sa.test(expandedBest.getValue() - reflectedBest.getValue()))) {
return expandedSimplex;
- } else if (sa != null &&
- sa.test(expandedBest.getValue() - reflectedBest.getValue())) {
- // SA hybridation branch (not part of Torczon's algorithm):
- // Create a simplex that contains
- // * the reflected simplex's best point (since it is the
- // best point overall), and
- // * the expanded simplex's points (except its best point).
- return reflectedSimplex.replaceLast(expandedSimplex.asList(1, expandedSimplex.getSize()));
} else {
return reflectedSimplex;
}