From abfacd6d14758ae1e9b1475a7699118bc3e32f0d Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Wed, 16 Jun 2010 13:53:18 +0000 Subject: [PATCH] MATH-376 git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@955230 13f79535-47bb-0310-9956-ffa450edef68 --- .../optimization/direct/DirectSearchOptimizer.java | 11 ++++++----- src/site/xdoc/changes.xml | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java b/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java index 4b0a68968..9861c47cf 100644 --- a/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java +++ b/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java @@ -61,10 +61,10 @@ import org.apache.commons.math.optimization.SimpleScalarValueChecker; * configuration from a unit hypercube. Each call to {@link * #optimize(MultivariateRealFunction, GoalType, double[]) optimize} will reuse * the current start configuration and move it such that its first vertex - * is at the provided start point of the optimization. If the same optimizer - * is used to solve different problems and the number of parameters change, - * the start configuration must be reset or a dimension mismatch - * will occur.

+ * is at the provided start point of the optimization. If the {@code optimize} + * method is called to solve a different problem and the number of parameters + * change, the start configuration will be reset to a default one with the + * appropriate dimensions.

* *

If {@link #setConvergenceChecker(RealConvergenceChecker)} is not called, * a default {@link SimpleScalarValueChecker} is used.

@@ -267,7 +267,8 @@ public abstract class DirectSearchOptimizer implements MultivariateRealOptimizer throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { - if (startConfiguration == null) { + if (startConfiguration == null + || startConfiguration.length != startPoint.length) { // no initial configuration has been set up for simplex // build a default one from a unit hypercube final double[] unit = new double[startPoint.length]; diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 8fb7cf7dc..f9014d9d1 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -52,6 +52,9 @@ The type attribute can be add,update,fix,remove. If the output is not quite correct, check for invisible trailing spaces! --> + + Allow multiple optimizations with a default simplex. + Added new "equalsIncludingNaN" methods that have the same semantics as the old "equals" methods. These are deprecated, and their semantics will be modified (in the next major release) such that