    001    /*
    002     * Licensed to the Apache Software Foundation (ASF) under one or more
    003     * contributor license agreements.  See the NOTICE file distributed with
    004     * this work for additional information regarding copyright ownership.
    005     * The ASF licenses this file to You under the Apache License, Version 2.0
    006     * (the "License"); you may not use this file except in compliance with
    007     * the License.  You may obtain a copy of the License at
    008     *
    009     *      http://www.apache.org/licenses/LICENSE-2.0
    010     *
    011     * Unless required by applicable law or agreed to in writing, software
    012     * distributed under the License is distributed on an "AS IS" BASIS,
    013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014     * See the License for the specific language governing permissions and
    015     * limitations under the License.
    016     */
    017
    018    package org.apache.commons.math3.optimization.univariate;
    019
    020    import org.apache.commons.math3.analysis.UnivariateFunction;
    021    import org.apache.commons.math3.optimization.BaseOptimizer;
    022    import org.apache.commons.math3.optimization.GoalType;
    023
    024    /**
    025     * This interface is mainly intended to enforce the internal coherence of
    026     * Commons-Math. Users of the API are advised to base their code on
    027     * the following interfaces:
    028     * <ul>
    029     *  <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
    030     * </ul>
    031     *
    032     * @param <FUNC> Type of the objective function to be optimized.
    033     *
    034     * @version $Id: BaseUnivariateOptimizer.java 1422230 2012-12-15 12:11:13Z erans $
    035     * @deprecated As of 3.1 (to be removed in 4.0).
    036     * @since 3.0
    037     */
    038    @Deprecated
    039    public interface BaseUnivariateOptimizer<FUNC extends UnivariateFunction>
    040        extends BaseOptimizer<UnivariatePointValuePair> {
    041        /**
    042         * Find an optimum in the given interval.
    043         *
    044         * An optimizer may require that the interval brackets a single optimum.
    045         *
    046         * @param f Function to optimize.
    047         * @param goalType Type of optimization goal: either
    048         * {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}.
    049         * @param min Lower bound for the interval.
    050         * @param max Upper bound for the interval.
    051         * @param maxEval Maximum number of function evaluations.
    052         * @return a (point, value) pair where the function is optimum.
    053         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
    054         * if the maximum evaluation count is exceeded.
    055         * @throws org.apache.commons.math3.exception.ConvergenceException
    056         * if the optimizer detects a convergence problem.
    057         * @throws IllegalArgumentException if {@code min > max} or the endpoints
    058         * do not satisfy the requirements specified by the optimizer.
    059         */
    060        UnivariatePointValuePair optimize(int maxEval, FUNC f, GoalType goalType,
    061                                              double min, double max);
    062
    063        /**
    064         * Find an optimum in the given interval, start at startValue.
    065         * An optimizer may require that the interval brackets a single optimum.
    066         *
    067         * @param f Function to optimize.
    068         * @param goalType Type of optimization goal: either
    069         * {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}.
    070         * @param min Lower bound for the interval.
    071         * @param max Upper bound for the interval.
    072         * @param startValue Start value to use.
    073         * @param maxEval Maximum number of function evaluations.
    074         * @return a (point, value) pair where the function is optimum.
    075         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
    076         * if the maximum evaluation count is exceeded.
    077         * @throws org.apache.commons.math3.exception.ConvergenceException if the
    078         * optimizer detects a convergence problem.
    079         * @throws IllegalArgumentException if {@code min > max} or the endpoints
    080         * do not satisfy the requirements specified by the optimizer.
    081         * @throws org.apache.commons.math3.exception.NullArgumentException if any
    082         * argument is {@code null}.
    083         */
    084        UnivariatePointValuePair optimize(int maxEval, FUNC f, GoalType goalType,
    085                                              double min, double max,
    086                                              double startValue);
    087    }