Remove deprecated optimization package.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/b4669aad Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/b4669aad Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/b4669aad Branch: refs/heads/master Commit: b4669aad3f2185894db7d4fb84cbcc311c32e34d Parents: 35b688b Author: Thomas Neidhart <thomas.neidh...@gmail.com> Authored: Wed Feb 25 22:34:53 2015 +0100 Committer: Thomas Neidhart <thomas.neidh...@gmail.com> Committed: Wed Feb 25 22:34:53 2015 +0100 ---------------------------------------------------------------------- findbugs-exclude-filter.xml | 57 +- .../AbstractConvergenceChecker.java | 102 - .../BaseMultivariateMultiStartOptimizer.java | 192 -- .../optimization/BaseMultivariateOptimizer.java | 61 - .../BaseMultivariateSimpleBoundsOptimizer.java | 65 - ...seMultivariateVectorMultiStartOptimizer.java | 204 -- .../BaseMultivariateVectorOptimizer.java | 63 - .../math4/optimization/BaseOptimizer.java | 61 - .../math4/optimization/ConvergenceChecker.java | 57 - ...entiableMultivariateMultiStartOptimizer.java | 52 - .../DifferentiableMultivariateOptimizer.java | 37 - ...leMultivariateVectorMultiStartOptimizer.java | 53 - ...fferentiableMultivariateVectorOptimizer.java | 32 - .../commons/math4/optimization/GoalType.java | 37 - .../math4/optimization/InitialGuess.java | 48 - .../optimization/LeastSquaresConverter.java | 182 -- ...ariateDifferentiableMultiStartOptimizer.java | 52 - .../MultivariateDifferentiableOptimizer.java | 37 - ...DifferentiableVectorMultiStartOptimizer.java | 53 - ...ltivariateDifferentiableVectorOptimizer.java | 32 - .../MultivariateMultiStartOptimizer.java | 52 - .../optimization/MultivariateOptimizer.java | 35 - .../math4/optimization/OptimizationData.java | 30 - .../math4/optimization/PointValuePair.java | 128 - .../optimization/PointVectorValuePair.java | 151 -- .../math4/optimization/SimpleBounds.java | 63 - .../math4/optimization/SimplePointChecker.java | 145 -- .../math4/optimization/SimpleValueChecker.java | 136 - .../optimization/SimpleVectorValueChecker.java | 145 -- .../commons/math4/optimization/Target.java | 50 - .../commons/math4/optimization/Weight.java | 68 - .../optimization/direct/AbstractSimplex.java | 347 --- .../optimization/direct/BOBYQAOptimizer.java | 2465 ------------------ .../BaseAbstractMultivariateOptimizer.java | 318 --- ...stractMultivariateSimpleBoundsOptimizer.java | 82 - ...BaseAbstractMultivariateVectorOptimizer.java | 370 --- .../optimization/direct/CMAESOptimizer.java | 1441 ---------- .../direct/MultiDirectionalSimplex.java | 218 -- .../MultivariateFunctionMappingAdapter.java | 301 --- .../MultivariateFunctionPenaltyAdapter.java | 190 -- .../optimization/direct/NelderMeadSimplex.java | 283 -- .../optimization/direct/PowellOptimizer.java | 352 --- .../optimization/direct/SimplexOptimizer.java | 233 -- .../math4/optimization/direct/package-info.java | 24 - .../math4/optimization/fitting/CurveFitter.java | 298 --- .../optimization/fitting/GaussianFitter.java | 365 --- .../optimization/fitting/HarmonicFitter.java | 384 --- .../optimization/fitting/PolynomialFitter.java | 111 - .../fitting/WeightedObservedPoint.java | 76 - .../optimization/fitting/package-info.java | 30 - .../AbstractDifferentiableOptimizer.java | 90 - .../general/AbstractLeastSquaresOptimizer.java | 577 ---- .../AbstractScalarDifferentiableOptimizer.java | 114 - .../general/ConjugateGradientFormula.java | 50 - .../general/GaussNewtonOptimizer.java | 194 -- .../general/LevenbergMarquardtOptimizer.java | 943 ------- .../NonLinearConjugateGradientOptimizer.java | 311 --- .../optimization/general/Preconditioner.java | 46 - .../optimization/general/package-info.java | 22 - .../linear/AbstractLinearOptimizer.java | 162 -- .../optimization/linear/LinearConstraint.java | 234 -- .../linear/LinearObjectiveFunction.java | 148 -- .../optimization/linear/LinearOptimizer.java | 92 - .../linear/NoFeasibleSolutionException.java | 42 - .../math4/optimization/linear/Relationship.java | 67 - .../optimization/linear/SimplexSolver.java | 238 -- .../optimization/linear/SimplexTableau.java | 635 ----- .../linear/UnboundedSolutionException.java | 42 - .../math4/optimization/linear/package-info.java | 22 - .../math4/optimization/package-info.java | 79 - .../BaseAbstractUnivariateOptimizer.java | 162 -- .../univariate/BaseUnivariateOptimizer.java | 86 - .../optimization/univariate/BracketFinder.java | 289 -- .../optimization/univariate/BrentOptimizer.java | 316 --- .../SimpleUnivariateValueChecker.java | 139 - .../UnivariateMultiStartOptimizer.java | 202 -- .../univariate/UnivariateOptimizer.java | 29 - .../univariate/UnivariatePointValuePair.java | 68 - .../optimization/univariate/package-info.java | 22 - ...teDifferentiableMultiStartOptimizerTest.java | 100 - ...erentiableVectorMultiStartOptimizerTest.java | 246 -- .../MultivariateMultiStartOptimizerTest.java | 79 - .../math4/optimization/PointValuePairTest.java | 40 - .../optimization/PointVectorValuePairTest.java | 44 - .../optimization/SimplePointCheckerTest.java | 57 - .../optimization/SimpleValueCheckerTest.java | 55 - .../SimpleVectorValueCheckerTest.java | 57 - .../direct/BOBYQAOptimizerTest.java | 631 ----- .../optimization/direct/CMAESOptimizerTest.java | 761 ------ .../MultivariateFunctionMappingAdapterTest.java | 194 -- .../MultivariateFunctionPenaltyAdapterTest.java | 196 -- .../direct/PowellOptimizerTest.java | 239 -- .../SimplexOptimizerMultiDirectionalTest.java | 207 -- .../direct/SimplexOptimizerNelderMeadTest.java | 268 -- .../optimization/fitting/CurveFitterTest.java | 154 -- .../fitting/GaussianFitterTest.java | 365 --- .../fitting/HarmonicFitterTest.java | 203 -- .../fitting/PolynomialFitterTest.java | 288 -- ...stractLeastSquaresOptimizerAbstractTest.java | 524 ---- .../AbstractLeastSquaresOptimizerTest.java | 100 - ...ractLeastSquaresOptimizerTestValidation.java | 322 --- .../optimization/general/CircleProblem.java | 139 - .../optimization/general/CircleScalar.java | 89 - .../optimization/general/CircleVectorial.java | 91 - .../general/GaussNewtonOptimizerTest.java | 154 -- .../LevenbergMarquardtOptimizerTest.java | 388 --- .../math4/optimization/general/MinpackTest.java | 1212 --------- ...NonLinearConjugateGradientOptimizerTest.java | 388 --- .../general/RandomCirclePointGenerator.java | 92 - .../RandomStraightLinePointGenerator.java | 99 - .../general/StatisticalReferenceDataset.java | 367 --- .../StatisticalReferenceDatasetFactory.java | 150 -- .../general/StraightLineProblem.java | 159 -- .../optimization/linear/SimplexSolverTest.java | 646 ----- .../optimization/linear/SimplexTableauTest.java | 116 - .../univariate/BracketFinderTest.java | 119 - .../univariate/BrentOptimizerTest.java | 256 -- .../SimpleUnivariateValueCheckerTest.java | 55 - .../UnivariateMultiStartOptimizerTest.java | 111 - 119 files changed, 2 insertions(+), 25548 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/findbugs-exclude-filter.xml ---------------------------------------------------------------------- diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml index db03c27..a99e76f 100644 --- a/findbugs-exclude-filter.xml +++ b/findbugs-exclude-filter.xml @@ -39,11 +39,6 @@ <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.univariate.BrentOptimizer" /> - <Method name="localMin" params="boolean,double,double,double,double,double" returns="double" /> - <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.univariate.BrentOptimizer" /> <Method name="localMin" params="boolean,double,double,double,double,double" returns="double" /> <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> @@ -73,10 +68,7 @@ <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> </Match> <Match> - <Or> - <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" /> - <Class name="org.apache.commons.math4.optimization.direct.BOBYQAOptimizer" /> - </Or> + <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" /> <Method name="altmov" params="int,double" returns="double[]" /> <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> </Match> @@ -97,11 +89,6 @@ <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.linear.LinearConstraint" /> - <Method name="equals" params="java.lang.Object" returns="boolean" /> - <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.linear.LinearConstraint" /> <Method name="equals" params="java.lang.Object" returns="boolean" /> <Bug pattern="FE_FLOATING_POINT_EQUALITY" /> @@ -133,10 +120,7 @@ In the original code, this is sequential and fall-through is expected --> <Match> - <Or> - <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" /> - <Class name="org.apache.commons.math4.optimization.direct.BOBYQAOptimizer" /> - </Or> + <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" /> <Or> <Method name="bobyqb" params="double[],double[]" returns="double" /> <Method name="trsbox" /> @@ -144,18 +128,6 @@ <Bug pattern="SF_SWITCH_FALLTHROUGH" /> </Match> - <!-- Spurious: The fields are deprecated and not used anymore - (to be removed in 4.0) - --> - <Match> - <Class name="org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer" /> - <Or> - <Field name="weightedResidualJacobian" /> - <Field name="weightedResiduals" /> - </Or> - <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" /> - </Match> - <!-- Spurious: Findbugs confused by final local variables --> <Match> <Class name="org.apache.commons.math4.util.FastMath" /> @@ -175,21 +147,11 @@ <Bug pattern="EI_EXPOSE_REP" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.PointValuePair"/> - <Method name="getPointRef" params="" returns="double[]" /> - <Bug pattern="EI_EXPOSE_REP" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.PointValuePair"/> <Method name="getPointRef" params="" returns="double[]" /> <Bug pattern="EI_EXPOSE_REP" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.PointValuePair"/> - <Method name="<init>" params="double[],double,boolean" returns="void" /> - <Bug pattern="EI_EXPOSE_REP2" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.PointValuePair"/> <Method name="<init>" params="double[],double,boolean" returns="void" /> <Bug pattern="EI_EXPOSE_REP2" /> @@ -199,20 +161,10 @@ <Or> <Class name="org.apache.commons.math4.optim.PointValuePair"/> <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/> - <Class name="org.apache.commons.math4.optimization.PointValuePair"/> - <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/> </Or> <Bug pattern="SE_NO_SUITABLE_CONSTRUCTOR" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/> - <Or> - <Method name="getPointRef" params="" returns="double[]" /> - <Method name="getValueRef" params="" returns="double[]" /> - </Or> - <Bug pattern="EI_EXPOSE_REP" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/> <Or> <Method name="getPointRef" params="" returns="double[]" /> @@ -221,11 +173,6 @@ <Bug pattern="EI_EXPOSE_REP" /> </Match> <Match> - <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/> - <Method name="<init>" params="double[],double[][],boolean" returns="void" /> - <Bug pattern="EI_EXPOSE_REP2" /> - </Match> - <Match> <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/> <Method name="<init>" params="double[],double[][],boolean" returns="void" /> <Bug pattern="EI_EXPOSE_REP2" /> http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java deleted file mode 100644 index 9f57533..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.util.Precision; - -/** - * Base class for all convergence checker implementations. - * - * @param <PAIR> Type of (point, value) pair. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public abstract class AbstractConvergenceChecker<PAIR> - implements ConvergenceChecker<PAIR> { - /** - * Default relative threshold. - * @deprecated in 3.1 (to be removed in 4.0) because this value is too small - * to be useful as a default (cf. MATH-798). - */ - @Deprecated - private static final double DEFAULT_RELATIVE_THRESHOLD = 100 * Precision.EPSILON; - /** - * Default absolute threshold. - * @deprecated in 3.1 (to be removed in 4.0) because this value is too small - * to be useful as a default (cf. MATH-798). - */ - @Deprecated - private static final double DEFAULT_ABSOLUTE_THRESHOLD = 100 * Precision.SAFE_MIN; - /** - * Relative tolerance threshold. - */ - private final double relativeThreshold; - /** - * Absolute tolerance threshold. - */ - private final double absoluteThreshold; - - /** - * Build an instance with default thresholds. - * @deprecated in 3.1 (to be removed in 4.0). Convergence thresholds are - * problem-dependent. As this class is intended for users who want to set - * their own convergence criterion instead of relying on an algorithm's - * default procedure, they should also set the thresholds appropriately - * (cf. MATH-798). - */ - @Deprecated - public AbstractConvergenceChecker() { - this.relativeThreshold = DEFAULT_RELATIVE_THRESHOLD; - this.absoluteThreshold = DEFAULT_ABSOLUTE_THRESHOLD; - } - - /** - * Build an instance with a specified thresholds. - * - * @param relativeThreshold relative tolerance threshold - * @param absoluteThreshold absolute tolerance threshold - */ - public AbstractConvergenceChecker(final double relativeThreshold, - final double absoluteThreshold) { - this.relativeThreshold = relativeThreshold; - this.absoluteThreshold = absoluteThreshold; - } - - /** - * @return the relative threshold. - */ - public double getRelativeThreshold() { - return relativeThreshold; - } - - /** - * @return the absolute threshold. - */ - public double getAbsoluteThreshold() { - return absoluteThreshold; - } - - /** - * {@inheritDoc} - */ - public abstract boolean converged(int iteration, - PAIR previous, - PAIR current); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java deleted file mode 100644 index 59b8277..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import java.util.Arrays; -import java.util.Comparator; - -import org.apache.commons.math4.analysis.MultivariateFunction; -import org.apache.commons.math4.exception.MathIllegalStateException; -import org.apache.commons.math4.exception.NotStrictlyPositiveException; -import org.apache.commons.math4.exception.NullArgumentException; -import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Base class for all implementations of a multi-start optimizer. - * - * This interface is mainly intended to enforce the internal coherence of - * Commons-Math. Users of the API are advised to base their code on - * {@link MultivariateMultiStartOptimizer} or on - * {@link DifferentiableMultivariateMultiStartOptimizer}. - * - * @param <FUNC> Type of the objective function to be optimized. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public class BaseMultivariateMultiStartOptimizer<FUNC extends MultivariateFunction> - implements BaseMultivariateOptimizer<FUNC> { - /** Underlying classical optimizer. */ - private final BaseMultivariateOptimizer<FUNC> optimizer; - /** Maximal number of evaluations allowed. */ - private int maxEvaluations; - /** Number of evaluations already performed for all starts. */ - private int totalEvaluations; - /** Number of starts to go. */ - private int starts; - /** Random generator for multi-start. */ - private RandomVectorGenerator generator; - /** Found optima. */ - private PointValuePair[] optima; - - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform. If {@code starts == 1}, - * the {@link #optimize(int,MultivariateFunction,GoalType,double[]) - * optimize} will return the same solution as {@code optimizer} would. - * @param generator Random vector generator to use for restarts. - * @throws NullArgumentException if {@code optimizer} or {@code generator} - * is {@code null}. - * @throws NotStrictlyPositiveException if {@code starts < 1}. - */ - protected BaseMultivariateMultiStartOptimizer(final BaseMultivariateOptimizer<FUNC> optimizer, - final int starts, - final RandomVectorGenerator generator) { - if (optimizer == null || - generator == null) { - throw new NullArgumentException(); - } - if (starts < 1) { - throw new NotStrictlyPositiveException(starts); - } - - this.optimizer = optimizer; - this.starts = starts; - this.generator = generator; - } - - /** - * Get all the optima found during the last call to {@link - * #optimize(int,MultivariateFunction,GoalType,double[]) optimize}. - * The optimizer stores all the optima found during a set of - * restarts. The {@link #optimize(int,MultivariateFunction,GoalType,double[]) - * optimize} method returns the best point only. This method - * returns all the points found at the end of each starts, - * including the best one already returned by the {@link - * #optimize(int,MultivariateFunction,GoalType,double[]) optimize} method. - * <br/> - * The returned array as one element for each start as specified - * in the constructor. It is ordered with the results from the - * runs that did converge first, sorted from best to worst - * objective value (i.e in ascending order if minimizing and in - * descending order if maximizing), followed by and null elements - * corresponding to the runs that did not converge. This means all - * elements will be null if the {@link #optimize(int,MultivariateFunction,GoalType,double[]) - * optimize} method did throw an exception. - * This also means that if the first element is not {@code null}, it - * is the best point found across all starts. - * - * @return an array containing the optima. - * @throws MathIllegalStateException if {@link - * #optimize(int,MultivariateFunction,GoalType,double[]) optimize} - * has not been called. - */ - public PointValuePair[] getOptima() { - if (optima == null) { - throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET); - } - return optima.clone(); - } - - /** {@inheritDoc} */ - public int getMaxEvaluations() { - return maxEvaluations; - } - - /** {@inheritDoc} */ - public int getEvaluations() { - return totalEvaluations; - } - - /** {@inheritDoc} */ - public ConvergenceChecker<PointValuePair> getConvergenceChecker() { - return optimizer.getConvergenceChecker(); - } - - /** - * {@inheritDoc} - */ - public PointValuePair optimize(int maxEval, final FUNC f, - final GoalType goal, - double[] startPoint) { - maxEvaluations = maxEval; - RuntimeException lastException = null; - optima = new PointValuePair[starts]; - totalEvaluations = 0; - - // Multi-start loop. - for (int i = 0; i < starts; ++i) { - // CHECKSTYLE: stop IllegalCatch - try { - optima[i] = optimizer.optimize(maxEval - totalEvaluations, f, goal, - i == 0 ? startPoint : generator.nextVector()); - } catch (RuntimeException mue) { - lastException = mue; - optima[i] = null; - } - // CHECKSTYLE: resume IllegalCatch - - totalEvaluations += optimizer.getEvaluations(); - } - - sortPairs(goal); - - if (optima[0] == null) { - throw lastException; // cannot be null if starts >=1 - } - - // Return the found point given the best objective function value. - return optima[0]; - } - - /** - * Sort the optima from best to worst, followed by {@code null} elements. - * - * @param goal Goal type. - */ - private void sortPairs(final GoalType goal) { - Arrays.sort(optima, new Comparator<PointValuePair>() { - public int compare(final PointValuePair o1, - final PointValuePair o2) { - if (o1 == null) { - return (o2 == null) ? 0 : 1; - } else if (o2 == null) { - return -1; - } - final double v1 = o1.getValue(); - final double v2 = o2.getValue(); - return (goal == GoalType.MINIMIZE) ? - Double.compare(v1, v2) : Double.compare(v2, v1); - } - }); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java deleted file mode 100644 index ce156a0..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateFunction; - -/** - * This interface is mainly intended to enforce the internal coherence of - * Commons-FastMath. Users of the API are advised to base their code on - * the following interfaces: - * <ul> - * <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li> - * <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li> - * </ul> - * - * @param <FUNC> Type of the objective function to be optimized. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface BaseMultivariateOptimizer<FUNC extends MultivariateFunction> - extends BaseOptimizer<PointValuePair> { - /** - * Optimize an objective function. - * - * @param f Objective function. - * @param goalType Type of optimization goal: either - * {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}. - * @param startPoint Start point for optimization. - * @param maxEval Maximum number of function evaluations. - * @return the point/value pair giving the optimal value for objective - * function. - * @throws org.apache.commons.math4.exception.DimensionMismatchException - * if the start point dimension is wrong. - * @throws org.apache.commons.math4.exception.TooManyEvaluationsException - * if the maximal number of evaluations is exceeded. - * @throws org.apache.commons.math4.exception.NullArgumentException if - * any argument is {@code null}. - * @deprecated As of 3.1. In 4.0, it will be replaced by the declaration - * corresponding to this {@link org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateOptimizer#optimize(int,MultivariateFunction,GoalType,OptimizationData[]) method}. - */ - @Deprecated - PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, - double[] startPoint); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java deleted file mode 100644 index b237dee..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateFunction; - -/** - * This interface is mainly intended to enforce the internal coherence of - * Commons-FastMath. Users of the API are advised to base their code on - * the following interfaces: - * <ul> - * <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li> - * <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li> - * </ul> - * - * @param <FUNC> Type of the objective function to be optimized. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface BaseMultivariateSimpleBoundsOptimizer<FUNC extends MultivariateFunction> - extends BaseMultivariateOptimizer<FUNC> { - /** - * Optimize an objective function. - * - * @param f Objective function. - * @param goalType Type of optimization goal: either - * {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}. - * @param startPoint Start point for optimization. - * @param maxEval Maximum number of function evaluations. - * @param lowerBound Lower bound for each of the parameters. - * @param upperBound Upper bound for each of the parameters. - * @return the point/value pair giving the optimal value for objective - * function. - * @throws org.apache.commons.math4.exception.DimensionMismatchException - * if the array sizes are wrong. - * @throws org.apache.commons.math4.exception.TooManyEvaluationsException - * if the maximal number of evaluations is exceeded. - * @throws org.apache.commons.math4.exception.NullArgumentException if - * {@code f}, {@code goalType} or {@code startPoint} is {@code null}. - * @throws org.apache.commons.math4.exception.NumberIsTooSmallException if any - * of the initial values is less than its lower bound. - * @throws org.apache.commons.math4.exception.NumberIsTooLargeException if any - * of the initial values is greater than its upper bound. - */ - PointValuePair optimize(int maxEval, FUNC f, GoalType goalType, - double[] startPoint, - double[] lowerBound, double[] upperBound); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java deleted file mode 100644 index f3048d1..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import java.util.Arrays; -import java.util.Comparator; - -import org.apache.commons.math4.analysis.MultivariateVectorFunction; -import org.apache.commons.math4.exception.ConvergenceException; -import org.apache.commons.math4.exception.MathIllegalStateException; -import org.apache.commons.math4.exception.NotStrictlyPositiveException; -import org.apache.commons.math4.exception.NullArgumentException; -import org.apache.commons.math4.exception.util.LocalizedFormats; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Base class for all implementations of a multi-start optimizer. - * - * This interface is mainly intended to enforce the internal coherence of - * Commons-Math. Users of the API are advised to base their code on - * {@link DifferentiableMultivariateVectorMultiStartOptimizer}. - * - * @param <FUNC> Type of the objective function to be optimized. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public class BaseMultivariateVectorMultiStartOptimizer<FUNC extends MultivariateVectorFunction> - implements BaseMultivariateVectorOptimizer<FUNC> { - /** Underlying classical optimizer. */ - private final BaseMultivariateVectorOptimizer<FUNC> optimizer; - /** Maximal number of evaluations allowed. */ - private int maxEvaluations; - /** Number of evaluations already performed for all starts. */ - private int totalEvaluations; - /** Number of starts to go. */ - private int starts; - /** Random generator for multi-start. */ - private RandomVectorGenerator generator; - /** Found optima. */ - private PointVectorValuePair[] optima; - - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform. If {@code starts == 1}, - * the {@link #optimize(int,MultivariateVectorFunction,double[],double[],double[]) - * optimize} will return the same solution as {@code optimizer} would. - * @param generator Random vector generator to use for restarts. - * @throws NullArgumentException if {@code optimizer} or {@code generator} - * is {@code null}. - * @throws NotStrictlyPositiveException if {@code starts < 1}. - */ - protected BaseMultivariateVectorMultiStartOptimizer(final BaseMultivariateVectorOptimizer<FUNC> optimizer, - final int starts, - final RandomVectorGenerator generator) { - if (optimizer == null || - generator == null) { - throw new NullArgumentException(); - } - if (starts < 1) { - throw new NotStrictlyPositiveException(starts); - } - - this.optimizer = optimizer; - this.starts = starts; - this.generator = generator; - } - - /** - * Get all the optima found during the last call to {@link - * #optimize(int,MultivariateVectorFunction,double[],double[],double[]) optimize}. - * The optimizer stores all the optima found during a set of - * restarts. The {@link #optimize(int,MultivariateVectorFunction,double[],double[],double[]) - * optimize} method returns the best point only. This method - * returns all the points found at the end of each starts, including - * the best one already returned by the {@link - * #optimize(int,MultivariateVectorFunction,double[],double[],double[]) optimize} method. - * <br/> - * The returned array as one element for each start as specified - * in the constructor. It is ordered with the results from the - * runs that did converge first, sorted from best to worst - * objective value (i.e. in ascending order if minimizing and in - * descending order if maximizing), followed by and null elements - * corresponding to the runs that did not converge. This means all - * elements will be null if the {@link - * #optimize(int,MultivariateVectorFunction,double[],double[],double[]) optimize} method did - * throw a {@link ConvergenceException}). This also means that if - * the first element is not {@code null}, it is the best point found - * across all starts. - * - * @return array containing the optima - * @throws MathIllegalStateException if {@link - * #optimize(int,MultivariateVectorFunction,double[],double[],double[]) optimize} has not been - * called. - */ - public PointVectorValuePair[] getOptima() { - if (optima == null) { - throw new MathIllegalStateException(LocalizedFormats.NO_OPTIMUM_COMPUTED_YET); - } - return optima.clone(); - } - - /** {@inheritDoc} */ - public int getMaxEvaluations() { - return maxEvaluations; - } - - /** {@inheritDoc} */ - public int getEvaluations() { - return totalEvaluations; - } - - /** {@inheritDoc} */ - public ConvergenceChecker<PointVectorValuePair> getConvergenceChecker() { - return optimizer.getConvergenceChecker(); - } - - /** - * {@inheritDoc} - */ - public PointVectorValuePair optimize(int maxEval, final FUNC f, - double[] target, double[] weights, - double[] startPoint) { - maxEvaluations = maxEval; - RuntimeException lastException = null; - optima = new PointVectorValuePair[starts]; - totalEvaluations = 0; - - // Multi-start loop. - for (int i = 0; i < starts; ++i) { - - // CHECKSTYLE: stop IllegalCatch - try { - optima[i] = optimizer.optimize(maxEval - totalEvaluations, f, target, weights, - i == 0 ? startPoint : generator.nextVector()); - } catch (ConvergenceException oe) { - optima[i] = null; - } catch (RuntimeException mue) { - lastException = mue; - optima[i] = null; - } - // CHECKSTYLE: resume IllegalCatch - - totalEvaluations += optimizer.getEvaluations(); - } - - sortPairs(target, weights); - - if (optima[0] == null) { - throw lastException; // cannot be null if starts >=1 - } - - // Return the found point given the best objective function value. - return optima[0]; - } - - /** - * Sort the optima from best to worst, followed by {@code null} elements. - * - * @param target Target value for the objective functions at optimum. - * @param weights Weights for the least-squares cost computation. - */ - private void sortPairs(final double[] target, - final double[] weights) { - Arrays.sort(optima, new Comparator<PointVectorValuePair>() { - public int compare(final PointVectorValuePair o1, - final PointVectorValuePair o2) { - if (o1 == null) { - return (o2 == null) ? 0 : 1; - } else if (o2 == null) { - return -1; - } - return Double.compare(weightedResidual(o1), weightedResidual(o2)); - } - private double weightedResidual(final PointVectorValuePair pv) { - final double[] value = pv.getValueRef(); - double sum = 0; - for (int i = 0; i < value.length; ++i) { - final double ri = value[i] - target[i]; - sum += weights[i] * ri * ri; - } - return sum; - } - }); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java deleted file mode 100644 index 34908ec..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateVectorFunction; - -/** - * This interface is mainly intended to enforce the internal coherence of - * Commons-Math. Users of the API are advised to base their code on - * the following interfaces: - * <ul> - * <li>{@link org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer}</li> - * </ul> - * - * @param <FUNC> Type of the objective function to be optimized. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface BaseMultivariateVectorOptimizer<FUNC extends MultivariateVectorFunction> - extends BaseOptimizer<PointVectorValuePair> { - /** - * Optimize an objective function. - * Optimization is considered to be a weighted least-squares minimization. - * The cost function to be minimized is - * <code>∑weight<sub>i</sub>(objective<sub>i</sub> - target<sub>i</sub>)<sup>2</sup></code> - * - * @param f Objective function. - * @param target Target value for the objective functions at optimum. - * @param weight Weights for the least squares cost computation. - * @param startPoint Start point for optimization. - * @return the point/value pair giving the optimal value for objective - * function. - * @param maxEval Maximum number of function evaluations. - * @throws org.apache.commons.math4.exception.DimensionMismatchException - * if the start point dimension is wrong. - * @throws org.apache.commons.math4.exception.TooManyEvaluationsException - * if the maximal number of evaluations is exceeded. - * @throws org.apache.commons.math4.exception.NullArgumentException if - * any argument is {@code null}. - * @deprecated As of 3.1. In 4.0, this will be replaced by the declaration - * corresponding to this {@link org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateVectorOptimizer#optimize(int,MultivariateVectorFunction,OptimizationData[]) method}. - */ - @Deprecated - PointVectorValuePair optimize(int maxEval, FUNC f, double[] target, - double[] weight, double[] startPoint); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java deleted file mode 100644 index 68c1f87..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -/** - * This interface is mainly intended to enforce the internal coherence of - * Commons-Math. Users of the API are advised to base their code on - * the following interfaces: - * <ul> - * <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li> - * <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li> - * <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableVectorOptimizer}</li> - * <li>{@link org.apache.commons.math4.optimization.univariate.UnivariateOptimizer}</li> - * </ul> - * - * @param <PAIR> Type of the point/objective pair. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface BaseOptimizer<PAIR> { - /** - * Get the maximal number of function evaluations. - * - * @return the maximal number of function evaluations. - */ - int getMaxEvaluations(); - - /** - * Get the number of evaluations of the objective function. - * The number of evaluations corresponds to the last call to the - * {@code optimize} method. It is 0 if the method has not been - * called yet. - * - * @return the number of evaluations of the objective function. - */ - int getEvaluations(); - - /** - * Get the convergence checker. - * - * @return the object used to check for convergence. - */ - ConvergenceChecker<PAIR> getConvergenceChecker(); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java deleted file mode 100644 index 3c157dc..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -/** - * This interface specifies how to check if an optimization algorithm has - * converged. - * <br/> - * Deciding if convergence has been reached is a problem-dependent issue. The - * user should provide a class implementing this interface to allow the - * optimization algorithm to stop its search according to the problem at hand. - * <br/> - * For convenience, three implementations that fit simple needs are already - * provided: {@link SimpleValueChecker}, {@link SimpleVectorValueChecker} and - * {@link SimplePointChecker}. The first two consider that convergence is - * reached when the objective function value does not change much anymore, it - * does not use the point set at all. - * The third one considers that convergence is reached when the input point - * set does not change much anymore, it does not use objective function value - * at all. - * - * @param <PAIR> Type of the (point, objective value) pair. - * - * @see org.apache.commons.math4.optimization.SimplePointChecker - * @see org.apache.commons.math4.optimization.SimpleValueChecker - * @see org.apache.commons.math4.optimization.SimpleVectorValueChecker - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface ConvergenceChecker<PAIR> { - /** - * Check if the optimization algorithm has converged. - * - * @param iteration Current iteration. - * @param previous Best point in the previous iteration. - * @param current Best point in the current iteration. - * @return {@code true} if the algorithm is considered to have converged. - */ - boolean converged(int iteration, PAIR previous, PAIR current); -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java deleted file mode 100644 index 27d2f8c..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Special implementation of the {@link DifferentiableMultivariateOptimizer} - * interface adding multi-start features to an existing optimizer. - * - * This class wraps a classical optimizer to use it several times in - * turn with different starting points in order to avoid being trapped - * into a local extremum when looking for a global one. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public class DifferentiableMultivariateMultiStartOptimizer - extends BaseMultivariateMultiStartOptimizer<DifferentiableMultivariateFunction> - implements DifferentiableMultivariateOptimizer { - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform (including the - * first one), multi-start is disabled if value is less than or - * equal to 1. - * @param generator Random vector generator to use for restarts. - */ - public DifferentiableMultivariateMultiStartOptimizer(final DifferentiableMultivariateOptimizer optimizer, - final int starts, - final RandomVectorGenerator generator) { - super(optimizer, starts, generator); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java deleted file mode 100644 index f1d8da2..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction; - -/** - * This interface represents an optimization algorithm for - * {@link DifferentiableMultivariateFunction scalar differentiable objective - * functions}. - * Optimization algorithms find the input point set that either {@link GoalType - * maximize or minimize} an objective function. - * - * @see MultivariateOptimizer - * @see DifferentiableMultivariateVectorOptimizer - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public interface DifferentiableMultivariateOptimizer - extends BaseMultivariateOptimizer<DifferentiableMultivariateFunction> {} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java deleted file mode 100644 index b76365e..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Special implementation of the {@link DifferentiableMultivariateVectorOptimizer} - * interface addind multi-start features to an existing optimizer. - * - * This class wraps a classical optimizer to use it several times in - * turn with different starting points in order to avoid being trapped - * into a local extremum when looking for a global one. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public class DifferentiableMultivariateVectorMultiStartOptimizer - extends BaseMultivariateVectorMultiStartOptimizer<DifferentiableMultivariateVectorFunction> - implements DifferentiableMultivariateVectorOptimizer { - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform (including the - * first one), multi-start is disabled if value is less than or - * equal to 1. - * @param generator Random vector generator to use for restarts. - */ - public DifferentiableMultivariateVectorMultiStartOptimizer( - final DifferentiableMultivariateVectorOptimizer optimizer, - final int starts, - final RandomVectorGenerator generator) { - super(optimizer, starts, generator); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java deleted file mode 100644 index d4ecdf5..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction; - -/** - * This interface represents an optimization algorithm for - * {@link DifferentiableMultivariateVectorFunction vectorial differentiable - * objective functions}. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.0 - */ -@Deprecated -public interface DifferentiableMultivariateVectorOptimizer - extends BaseMultivariateVectorOptimizer<DifferentiableMultivariateVectorFunction> {} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/GoalType.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/GoalType.java b/src/main/java/org/apache/commons/math4/optimization/GoalType.java deleted file mode 100644 index d61072f..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/GoalType.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import java.io.Serializable; - -/** - * Goal type for an optimization problem. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public enum GoalType implements Serializable { - - /** Maximization goal. */ - MAXIMIZE, - - /** Minimization goal. */ - MINIMIZE - -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java b/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java deleted file mode 100644 index b12680c..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -/** - * Starting point (first guess) of the optimization procedure. - * <br/> - * Immutable class. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.1 - */ -@Deprecated -public class InitialGuess implements OptimizationData { - /** Initial guess. */ - private final double[] init; - - /** - * @param startPoint Initial guess. - */ - public InitialGuess(double[] startPoint) { - init = startPoint.clone(); - } - - /** - * Gets the initial guess. - * - * @return the initial guess. - */ - public double[] getInitialGuess() { - return init.clone(); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java b/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java deleted file mode 100644 index 74ca4ee..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateFunction; -import org.apache.commons.math4.analysis.MultivariateVectorFunction; -import org.apache.commons.math4.exception.DimensionMismatchException; -import org.apache.commons.math4.linear.RealMatrix; - -/** This class converts {@link MultivariateVectorFunction vectorial - * objective functions} to {@link MultivariateFunction scalar objective functions} - * when the goal is to minimize them. - * <p> - * This class is mostly used when the vectorial objective function represents - * a theoretical result computed from a point set applied to a model and - * the models point must be adjusted to fit the theoretical result to some - * reference observations. The observations may be obtained for example from - * physical measurements whether the model is built from theoretical - * considerations. - * </p> - * <p> - * This class computes a possibly weighted squared sum of the residuals, which is - * a scalar value. The residuals are the difference between the theoretical model - * (i.e. the output of the vectorial objective function) and the observations. The - * class implements the {@link MultivariateFunction} interface and can therefore be - * minimized by any optimizer supporting scalar objectives functions.This is one way - * to perform a least square estimation. There are other ways to do this without using - * this converter, as some optimization algorithms directly support vectorial objective - * functions. - * </p> - * <p> - * This class support combination of residuals with or without weights and correlations. - * </p> - * - * @see MultivariateFunction - * @see MultivariateVectorFunction - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ - -@Deprecated -public class LeastSquaresConverter implements MultivariateFunction { - - /** Underlying vectorial function. */ - private final MultivariateVectorFunction function; - - /** Observations to be compared to objective function to compute residuals. */ - private final double[] observations; - - /** Optional weights for the residuals. */ - private final double[] weights; - - /** Optional scaling matrix (weight and correlations) for the residuals. */ - private final RealMatrix scale; - - /** Build a simple converter for uncorrelated residuals with the same weight. - * @param function vectorial residuals function to wrap - * @param observations observations to be compared to objective function to compute residuals - */ - public LeastSquaresConverter(final MultivariateVectorFunction function, - final double[] observations) { - this.function = function; - this.observations = observations.clone(); - this.weights = null; - this.scale = null; - } - - /** Build a simple converter for uncorrelated residuals with the specific weights. - * <p> - * The scalar objective function value is computed as: - * <pre> - * objective = ∑weight<sub>i</sub>(observation<sub>i</sub>-objective<sub>i</sub>)<sup>2</sup> - * </pre> - * </p> - * <p> - * Weights can be used for example to combine residuals with different standard - * deviations. As an example, consider a residuals array in which even elements - * are angular measurements in degrees with a 0.01° standard deviation and - * odd elements are distance measurements in meters with a 15m standard deviation. - * In this case, the weights array should be initialized with value - * 1.0/(0.01<sup>2</sup>) in the even elements and 1.0/(15.0<sup>2</sup>) in the - * odd elements (i.e. reciprocals of variances). - * </p> - * <p> - * The array computed by the objective function, the observations array and the - * weights array must have consistent sizes or a {@link DimensionMismatchException} - * will be triggered while computing the scalar objective. - * </p> - * @param function vectorial residuals function to wrap - * @param observations observations to be compared to objective function to compute residuals - * @param weights weights to apply to the residuals - * @exception DimensionMismatchException if the observations vector and the weights - * vector dimensions do not match (objective function dimension is checked only when - * the {@link #value(double[])} method is called) - */ - public LeastSquaresConverter(final MultivariateVectorFunction function, - final double[] observations, final double[] weights) { - if (observations.length != weights.length) { - throw new DimensionMismatchException(observations.length, weights.length); - } - this.function = function; - this.observations = observations.clone(); - this.weights = weights.clone(); - this.scale = null; - } - - /** Build a simple converter for correlated residuals with the specific weights. - * <p> - * The scalar objective function value is computed as: - * <pre> - * objective = y<sup>T</sup>y with y = scale×(observation-objective) - * </pre> - * </p> - * <p> - * The array computed by the objective function, the observations array and the - * the scaling matrix must have consistent sizes or a {@link DimensionMismatchException} - * will be triggered while computing the scalar objective. - * </p> - * @param function vectorial residuals function to wrap - * @param observations observations to be compared to objective function to compute residuals - * @param scale scaling matrix - * @throws DimensionMismatchException if the observations vector and the scale - * matrix dimensions do not match (objective function dimension is checked only when - * the {@link #value(double[])} method is called) - */ - public LeastSquaresConverter(final MultivariateVectorFunction function, - final double[] observations, final RealMatrix scale) { - if (observations.length != scale.getColumnDimension()) { - throw new DimensionMismatchException(observations.length, scale.getColumnDimension()); - } - this.function = function; - this.observations = observations.clone(); - this.weights = null; - this.scale = scale.copy(); - } - - /** {@inheritDoc} */ - public double value(final double[] point) { - // compute residuals - final double[] residuals = function.value(point); - if (residuals.length != observations.length) { - throw new DimensionMismatchException(residuals.length, observations.length); - } - for (int i = 0; i < residuals.length; ++i) { - residuals[i] -= observations[i]; - } - - // compute sum of squares - double sumSquares = 0; - if (weights != null) { - for (int i = 0; i < residuals.length; ++i) { - final double ri = residuals[i]; - sumSquares += weights[i] * ri * ri; - } - } else if (scale != null) { - for (final double yi : scale.operate(residuals)) { - sumSquares += yi * yi; - } - } else { - for (final double ri : residuals) { - sumSquares += ri * ri; - } - } - - return sumSquares; - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java deleted file mode 100644 index ca558f0..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Special implementation of the {@link MultivariateDifferentiableOptimizer} - * interface adding multi-start features to an existing optimizer. - * - * This class wraps a classical optimizer to use it several times in - * turn with different starting points in order to avoid being trapped - * into a local extremum when looking for a global one. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.1 - */ -@Deprecated -public class MultivariateDifferentiableMultiStartOptimizer - extends BaseMultivariateMultiStartOptimizer<MultivariateDifferentiableFunction> - implements MultivariateDifferentiableOptimizer { - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform (including the - * first one), multi-start is disabled if value is less than or - * equal to 1. - * @param generator Random vector generator to use for restarts. - */ - public MultivariateDifferentiableMultiStartOptimizer(final MultivariateDifferentiableOptimizer optimizer, - final int starts, - final RandomVectorGenerator generator) { - super(optimizer, starts, generator); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java deleted file mode 100644 index 67e894e..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction; - -/** - * This interface represents an optimization algorithm for - * {@link MultivariateDifferentiableFunction scalar differentiable objective - * functions}. - * Optimization algorithms find the input point set that either {@link GoalType - * maximize or minimize} an objective function. - * - * @see MultivariateOptimizer - * @see MultivariateDifferentiableVectorOptimizer - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.1 - */ -@Deprecated -public interface MultivariateDifferentiableOptimizer - extends BaseMultivariateOptimizer<MultivariateDifferentiableFunction> {} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java deleted file mode 100644 index 63e8953..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Special implementation of the {@link MultivariateDifferentiableVectorOptimizer} - * interface adding multi-start features to an existing optimizer. - * - * This class wraps a classical optimizer to use it several times in - * turn with different starting points in order to avoid being trapped - * into a local extremum when looking for a global one. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.1 - */ -@Deprecated -public class MultivariateDifferentiableVectorMultiStartOptimizer - extends BaseMultivariateVectorMultiStartOptimizer<MultivariateDifferentiableVectorFunction> - implements MultivariateDifferentiableVectorOptimizer { - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform (including the - * first one), multi-start is disabled if value is less than or - * equal to 1. - * @param generator Random vector generator to use for restarts. - */ - public MultivariateDifferentiableVectorMultiStartOptimizer( - final MultivariateDifferentiableVectorOptimizer optimizer, - final int starts, - final RandomVectorGenerator generator) { - super(optimizer, starts, generator); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java deleted file mode 100644 index 569624d..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction; - -/** - * This interface represents an optimization algorithm for - * {@link MultivariateDifferentiableVectorFunction differentiable vectorial - * objective functions}. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 3.1 - */ -@Deprecated -public interface MultivariateDifferentiableVectorOptimizer - extends BaseMultivariateVectorOptimizer<MultivariateDifferentiableVectorFunction> {} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java deleted file mode 100644 index 8c0df54..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateFunction; -import org.apache.commons.math4.random.RandomVectorGenerator; - -/** - * Special implementation of the {@link MultivariateOptimizer} interface adding - * multi-start features to an existing optimizer. - * - * This class wraps a classical optimizer to use it several times in - * turn with different starting points in order to avoid being trapped - * into a local extremum when looking for a global one. - * - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public class MultivariateMultiStartOptimizer - extends BaseMultivariateMultiStartOptimizer<MultivariateFunction> - implements MultivariateOptimizer { - /** - * Create a multi-start optimizer from a single-start optimizer. - * - * @param optimizer Single-start optimizer to wrap. - * @param starts Number of starts to perform (including the - * first one), multi-start is disabled if value is less than or - * equal to 1. - * @param generator Random vector generator to use for restarts. - */ - public MultivariateMultiStartOptimizer(final MultivariateOptimizer optimizer, - final int starts, - final RandomVectorGenerator generator) { - super(optimizer, starts, generator); - } -} http://git-wip-us.apache.org/repos/asf/commons-math/blob/b4669aad/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java deleted file mode 100644 index e0d2715..0000000 --- a/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.math4.optimization; - -import org.apache.commons.math4.analysis.MultivariateFunction; - -/** - * This interface represents an optimization algorithm for {@link MultivariateFunction - * scalar objective functions}. - * <p>Optimization algorithms find the input point set that either {@link GoalType - * maximize or minimize} an objective function.</p> - * - * @see MultivariateDifferentiableOptimizer - * @see MultivariateDifferentiableVectorOptimizer - * @deprecated As of 3.1 (to be removed in 4.0). - * @since 2.0 - */ -@Deprecated -public interface MultivariateOptimizer - extends BaseMultivariateOptimizer<MultivariateFunction> {}