commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1030918 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
Date Thu, 04 Nov 2010 12:57:33 GMT
Author: erans
Date: Thu Nov  4 12:57:33 2010
New Revision: 1030918

URL: http://svn.apache.org/viewvc?rev=1030918&view=rev
Log:
MATH-428
Added a constructor.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java?rev=1030918&r1=1030917&r2=1030918&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
Thu Nov  4 12:57:33 2010
@@ -55,23 +55,39 @@ public class NelderMeadSimplex extends A
      * @param n Dimension of the simplex.
      */
     public NelderMeadSimplex(final int n) {
-        this(n, DEFAULT_RHO, DEFAULT_KHI, DEFAULT_GAMMA, DEFAULT_SIGMA);
+        this(n, 1d);
+    }
+
+    /**
+     * Build a Nelder-Mead simplex with default coefficients.
+     * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5
+     * for both gamma and sigma.
+     *
+     * @param n Dimension of the simplex.
+     * @param sideLength Length of the sides of the default (hypercube)
+     * simplex. See {@link AbstractSimplex#AbstractSimplex(int,double)}.
+     */
+    public NelderMeadSimplex(final int n, double sideLength) {
+        this(n, sideLength,
+             DEFAULT_RHO, DEFAULT_KHI, DEFAULT_GAMMA, DEFAULT_SIGMA);
     }
 
     /**
      * Build a Nelder-Mead simplex with specified coefficients.
      *
      * @param n Dimension of the simplex. See
-     * {@link AbstractSimplex#AbstractSimplex(int)}.
+     * {@link AbstractSimplex#AbstractSimplex(int,double)}.
+     * @param sideLength Length of the sides of the default (hypercube)
+     * simplex. See {@link AbstractSimplex#AbstractSimplex(int,double)}.
      * @param rho Reflection coefficient.
      * @param khi Expansion coefficient.
      * @param gamma Contraction coefficient.
      * @param sigma Shrinkage coefficient.
      */
-    public NelderMeadSimplex(final int n,
+    public NelderMeadSimplex(final int n, double sideLength,
                              final double rho, final double khi,
                              final double gamma, final double sigma) {
-        super(n);
+        super(n, sideLength);
 
         this.rho = rho;
         this.khi = khi;
@@ -80,6 +96,22 @@ public class NelderMeadSimplex extends A
     }
 
     /**
+     * Build a Nelder-Mead simplex with specified coefficients.
+     *
+     * @param n Dimension of the simplex. See
+     * {@link AbstractSimplex#AbstractSimplex(int)}.
+     * @param rho Reflection coefficient.
+     * @param khi Expansion coefficient.
+     * @param gamma Contraction coefficient.
+     * @param sigma Shrinkage coefficient.
+     */
+    public NelderMeadSimplex(final int n,
+                             final double rho, final double khi,
+                             final double gamma, final double sigma) {
+        this(n, 1d, rho, khi, gamma, sigma);
+    }
+
+    /**
      * Build a Nelder-Mead simplex with default coefficients.
      * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5
      * for both gamma and sigma.



Mime
View raw message