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 018package 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 * @deprecated As of 3.1 (to be removed in 4.0). 044 * @since 3.0 045 */ 046@Deprecated 047public interface ConvergenceChecker<PAIR> { 048 /** 049 * Check if the optimization algorithm has converged. 050 * 051 * @param iteration Current iteration. 052 * @param previous Best point in the previous iteration. 053 * @param current Best point in the current iteration. 054 * @return {@code true} if the algorithm is considered to have converged. 055 */ 056 boolean converged(int iteration, PAIR previous, PAIR current); 057}