MATH-1622: Simulated annealing variant of "NelderMeadTransform".

This commit is contained in:
Gilles Sadowski 2021-08-25 01:50:28 +02:00
parent 80a7eb1832
commit 2ccdf8d002
1 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ public class NelderMeadTransform
@Override @Override
public UnaryOperator<Simplex> create(final MultivariateFunction evaluationFunction, public UnaryOperator<Simplex> create(final MultivariateFunction evaluationFunction,
final Comparator<PointValuePair> comparator, final Comparator<PointValuePair> comparator,
final DoublePredicate unused) { final DoublePredicate sa) {
return original -> { return original -> {
// The simplex has n + 1 points if dimension is n. // The simplex has n + 1 points if dimension is n.
final int n = original.getDimension(); final int n = original.getDimension();
@ -105,7 +105,9 @@ public class NelderMeadTransform
-gamma, -gamma,
xWorst, xWorst,
evaluationFunction); evaluationFunction);
if (comparator.compare(expanded, reflected) < 0) { if (comparator.compare(expanded, reflected) < 0 ||
(sa != null &&
sa.test(expanded.getValue() - reflected.getValue()))) {
return original.replaceLast(expanded); return original.replaceLast(expanded);
} else { } else {
return original.replaceLast(reflected); return original.replaceLast(reflected);