Author: erans
Date: Wed Jun 16 13:53:18 2010
New Revision: 955230

URL: http://svn.apache.org/viewvc?rev=955230&view=rev
Log:
MATH-376

Modified:
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java?rev=955230&r1=955229&r2=955230&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
 Wed Jun 16 13:53:18 2010
@@ -61,10 +61,10 @@ import org.apache.commons.math.optimizat
  * 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 <em>must</em> be reset or a dimension mismatch
- * will occur.</p>
+ * 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.</p>
  *
  * <p>If {...@link #setConvergenceChecker(RealConvergenceChecker)} is not 
called,
  * a default {...@link SimpleScalarValueChecker} is used.</p>
@@ -267,7 +267,8 @@ public abstract class DirectSearchOptimi
         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];

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=955230&r1=955229&r2=955230&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Wed Jun 16 13:53:18 2010
@@ -52,6 +52,9 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="2.2" date="TBD" description="TBD">
+      <action dev="erans" type="fix" issue="MATH-376">
+        Allow multiple optimizations with a default simplex.
+      </action>      
       <action dev="erans" type="update" issue="MATH-370">
         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


Reply via email to