commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r999948 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/optimization/direct/ main/java/org/apache/commons/math/optimization/general/ test/java/org/apache/commons/math/optimization/direct/ test/java/org/apache/commons/...
Date Wed, 22 Sep 2010 13:54:26 GMT
Author: erans
Date: Wed Sep 22 13:54:25 2010
New Revision: 999948

URL: http://svn.apache.org/viewvc?rev=999948&view=rev
Log:
MATH-413
Moving classes to a more appropriate package.
Removed unused interfaces.

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java
      - copied, changed from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java
      - copied, changed from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
      - copied, changed from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java
      - copied, changed from r998720, commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java
(from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java&r1=998720&r2=999948&rev=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractScalarOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java
Wed Sep 22 13:54:25 2010
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math.optimization.general;
+package org.apache.commons.math.optimization.direct;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.util.Incrementor;
@@ -33,19 +33,14 @@ import org.apache.commons.math.optimizat
  * Base class for implementing optimizers for multivariate scalar functions.
  * This base class handles the boiler-plate methods associated to thresholds
  * settings, iterations and evaluations counting.
- * This class is mainly intended to enforce the internal coherence of
- * Commons-FastMath.
- * A class that implements an optimization algorithm should inherit from
- * {@link AbstractScalarOptimizer} or from
- * {@link AbstractScalarDifferentiableOptimizer}.
  *
- * @param <T> the type of the objective function to be optimized
+ * @param <FUNC> Type of the objective function to be optimized
  *
  * @version $Revision$ $Date$
  * @since 2.2
  */
-public abstract class BaseAbstractScalarOptimizer<T extends MultivariateRealFunction>
-    implements BaseMultivariateRealOptimizer<T> {
+public abstract class BaseAbstractScalarOptimizer<FUNC extends MultivariateRealFunction>
+    implements BaseMultivariateRealOptimizer<FUNC> {
     /** Evaluations counter. */
     protected final Incrementor evaluations = new Incrementor();
     /** Convergence checker. */
@@ -120,7 +115,7 @@ public abstract class BaseAbstractScalar
     }
 
     /** {@inheritDoc} */
-    public RealPointValuePair optimize(T f,
+    public RealPointValuePair optimize(FUNC f,
                                        GoalType goalType,
                                        double[] startPoint)
         throws FunctionEvaluationException {

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java
(from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java&r1=998720&r2=999948&rev=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/BaseAbstractVectorialOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java
Wed Sep 22 13:54:25 2010
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math.optimization.general;
+package org.apache.commons.math.optimization.direct;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.util.Incrementor;

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=999948&r1=999947&r2=999948&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 Sep 22 13:54:25 2010
@@ -22,14 +22,13 @@ import java.util.Comparator;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.optimization.GoalType;
-import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 import org.apache.commons.math.optimization.ConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
 import org.apache.commons.math.optimization.SimpleScalarValueChecker;
-import org.apache.commons.math.optimization.general.AbstractScalarOptimizer;
 
 /**
  * This class implements simplex-based direct search optimization
@@ -76,8 +75,6 @@ import org.apache.commons.math.optimizat
  * performed by the derived classes according to the implemented
  * algorithms.</p>
  *
- * implements MultivariateRealOptimizer since 2.0
- *
  * @see MultivariateRealFunction
  * @see NelderMead
  * @see MultiDirectional
@@ -85,8 +82,7 @@ import org.apache.commons.math.optimizat
  * @since 1.2
  */
 public abstract class DirectSearchOptimizer
-    extends AbstractScalarOptimizer
-    implements MultivariateRealOptimizer {
+    extends BaseAbstractScalarOptimizer<MultivariateRealFunction> {
     /** Simplex. */
     protected RealPointValuePair[] simplex;
     /** Start simplex configuration. */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java?rev=999948&r1=999947&r2=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectional.java
Wed Sep 22 13:54:25 2010
@@ -22,6 +22,7 @@ import java.util.Comparator;
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.optimization.ConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 
 /**
  * This class implements the multi-directional direct search method.
@@ -30,25 +31,27 @@ import org.apache.commons.math.optimizat
  * @see NelderMead
  * @since 1.2
  */
-public class MultiDirectional extends DirectSearchOptimizer {
-
+public class MultiDirectional extends DirectSearchOptimizer
+    implements MultivariateRealOptimizer {
     /** Expansion coefficient. */
     private final double khi;
-
     /** Contraction coefficient. */
     private final double gamma;
 
-    /** Build a multi-directional optimizer with default coefficients.
-     * <p>The default values are 2.0 for khi and 0.5 for gamma.</p>
+    /**
+     * Build a multi-directional optimizer with default coefficients.
+     * The default values are 2.0 for khi and 0.5 for gamma.
      */
     public MultiDirectional() {
         this.khi   = 2.0;
         this.gamma = 0.5;
     }
 
-    /** Build a multi-directional optimizer with specified coefficients.
-     * @param khi expansion coefficient
-     * @param gamma contraction coefficient
+    /**
+     * Build a multi-directional optimizer with specified coefficients.
+     *
+     * @param khi Expansion coefficient.
+     * @param gamma Contraction coefficient.
      */
     public MultiDirectional(final double khi, final double gamma) {
         this.khi   = khi;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java?rev=999948&r1=999947&r2=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
Wed Sep 22 13:54:25 2010
@@ -21,6 +21,7 @@ import java.util.Comparator;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 
 /**
  * This class implements the Nelder-Mead direct search method.
@@ -29,23 +30,21 @@ import org.apache.commons.math.optimizat
  * @see MultiDirectional
  * @since 1.2
  */
-public class NelderMead extends DirectSearchOptimizer {
-
+public class NelderMead extends DirectSearchOptimizer
+    implements MultivariateRealOptimizer {
     /** Reflection coefficient. */
     private final double rho;
-
     /** Expansion coefficient. */
     private final double khi;
-
     /** Contraction coefficient. */
     private final double gamma;
-
     /** Shrinkage coefficient. */
     private final double sigma;
 
-    /** Build a Nelder-Mead optimizer with default coefficients.
-     * <p>The default coefficients are 1.0 for rho, 2.0 for khi and 0.5
-     * for both gamma and sigma.</p>
+    /**
+     * Build a Nelder-Mead optimizer with default coefficients.
+     * The default coefficients are 1.0 for rho, 2.0 for khi and 0.5
+     * for both gamma and sigma.
      */
     public NelderMead() {
         this.rho   = 1.0;
@@ -54,11 +53,13 @@ public class NelderMead extends DirectSe
         this.sigma = 0.5;
     }
 
-    /** Build a Nelder-Mead optimizer with specified coefficients.
-     * @param rho reflection coefficient
-     * @param khi expansion coefficient
-     * @param gamma contraction coefficient
-     * @param sigma shrinkage coefficient
+    /**
+     * Build a Nelder-Mead optimizer with specified coefficients.
+     *
+     * @param rho Reflection coefficient.
+     * @param khi Expansion coefficient.
+     * @param gamma Contraction coefficient.
+     * @param sigma Shrinkage coefficient.
      */
     public NelderMead(final double rho, final double khi,
                       final double gamma, final double sigma) {

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
(from r998720, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java&r1=998720&r2=999948&rev=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
Wed Sep 22 13:54:25 2010
@@ -15,18 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math.optimization.general;
+package org.apache.commons.math.optimization.direct;
 
 import java.util.Arrays;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.RealPointValuePair;
 import org.apache.commons.math.optimization.ConvergenceChecker;
+import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 import org.apache.commons.math.optimization.univariate.BracketFinder;
 import org.apache.commons.math.optimization.univariate.BrentOptimizer;
 import org.apache.commons.math.optimization.univariate.UnivariateRealPointValuePair;
@@ -47,7 +49,8 @@ import org.apache.commons.math.optimizat
  * @since 2.2
  */
 public class PowellOptimizer
-    extends AbstractScalarOptimizer {
+    extends BaseAbstractScalarOptimizer<MultivariateRealFunction>
+    implements MultivariateRealOptimizer {
     /**
      * Minimum relative tolerance.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java?rev=999948&r1=999947&r2=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
Wed Sep 22 13:54:25 2010
@@ -29,6 +29,7 @@ import org.apache.commons.math.linear.Re
 import org.apache.commons.math.optimization.ConvergenceChecker;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
+import org.apache.commons.math.optimization.direct.BaseAbstractVectorialOptimizer;
 import org.apache.commons.math.util.FastMath;
 
 /**
@@ -72,7 +73,8 @@ public abstract class AbstractLeastSquar
 
     /**
      * Simple constructor with default settings.
-     * The convergence check is set to a {@link SimpleVectorialValueChecker}.
+     * The convergence check is set to a {@link
+     * org.apache.commons.math.optimization.SimpleVectorialValueChecker}.
      */
     protected AbstractLeastSquaresOptimizer() {}
     /**

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java?rev=999948&r1=999947&r2=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
Wed Sep 22 13:54:25 2010
@@ -24,6 +24,7 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.ConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
+import org.apache.commons.math.optimization.direct.BaseAbstractScalarOptimizer;
 
 /**
  * Base class for implementing optimizers for multivariate scalar

Copied: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java
(from r998720, commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java?p2=commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java&p1=commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java&r1=998720&r2=999948&rev=999948&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/PowellOptimizerTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java
Wed Sep 22 13:54:25 2010
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math.optimization.general;
+package org.apache.commons.math.optimization.direct;
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.MathException;



Mime
View raw message