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;
019    
020    /**
021     * This interface specifies how to check if an optimization algorithm has
022     * converged.
023     * <br/>
024     * Deciding if convergence has been reached is a problem-dependent issue. The
025     * user should provide a class implementing this interface to allow the
026     * optimization algorithm to stop its search according to the problem at hand.
027     * <br/>
028     * For convenience, three implementations that fit simple needs are already
029     * provided: {@link SimpleValueChecker}, {@link SimpleVectorValueChecker} and
030     * {@link SimplePointChecker}. The first two consider that convergence is
031     * reached when the objective function value does not change much anymore, it
032     * does not use the point set at all.
033     * The third one considers that convergence is reached when the input point
034     * set does not change much anymore, it does not use objective function value
035     * at all.
036     *
037     * @param <PAIR> Type of the (point, objective value) pair.
038     *
039     * @see org.apache.commons.math3.optimization.SimplePointChecker
040     * @see org.apache.commons.math3.optimization.SimpleValueChecker
041     * @see org.apache.commons.math3.optimization.SimpleVectorValueChecker
042     *
043     * @version $Id: ConvergenceChecker.java 1422230 2012-12-15 12:11:13Z erans $
044     * @deprecated As of 3.1 (to be removed in 4.0).
045     * @since 3.0
046     */
047    @Deprecated
048    public interface ConvergenceChecker<PAIR> {
049        /**
050         * Check if the optimization algorithm has converged.
051         *
052         * @param iteration Current iteration.
053         * @param previous Best point in the previous iteration.
054         * @param current Best point in the current iteration.
055         * @return {@code true} if the algorithm is considered to have converged.
056         */
057        boolean converged(int iteration, PAIR previous, PAIR current);
058    }