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.math.optimization; 019 020 /** This interface specifies how to check if a {@link 021 * DifferentiableMultivariateVectorialOptimizer optimization algorithm} has converged. 022 * 023 * <p>Deciding if convergence has been reached is a problem-dependent issue. The 024 * user should provide a class implementing this interface to allow the optimization 025 * algorithm to stop its search according to the problem at hand.</p> 026 * <p>For convenience, two implementations that fit simple needs are already provided: 027 * {@link SimpleVectorialValueChecker} and {@link SimpleVectorialPointChecker}. The first 028 * one considers convergence is reached when the objective function value does not 029 * change much anymore, it does not use the point set at all. The second one 030 * considers convergence is reached when the input point set does not change 031 * much anymore, it does not use objective function value at all.</p> 032 * 033 * @version $Revision: 780674 $ $Date: 2009-06-01 17:10:55 +0200 (lun. 01 juin 2009) $ 034 * @since 2.0 035 */ 036 037 public interface VectorialConvergenceChecker { 038 039 /** Check if the optimization algorithm has converged considering the last points. 040 * <p> 041 * This method may be called several time from the same algorithm iteration with 042 * different points. This can be detected by checking the iteration number at each 043 * call if needed. Each time this method is called, the previous and current point 044 * correspond to points with the same role at each iteration, so they can be 045 * compared. As an example, simplex-based algorithms call this method for all 046 * points of the simplex, not only for the best or worst ones. 047 * </p> 048 * @param iteration index of current iteration 049 * @param previous point from previous iteration 050 * @param current point from current iteration 051 * @return true if the algorithm is considered to have converged 052 */ 053 boolean converged(int iteration, VectorialPointValuePair previous, VectorialPointValuePair current); 054 055 }