001    package net.sf.cpsolver.ifs.termination;
002    
003    import net.sf.cpsolver.ifs.solution.Solution;
004    
005    /**
006     * Termination condition.
007     * <br><br>
008     * The termination condition determines when the algorithm should finish. For example, 
009     * the solver should terminate when the maximal number of iterations or some other given 
010     * timeout value is reached. Moreover, it can stop the search process when the current 
011     * solution is good enough, e.g., all variables are assigned and/or some other solution 
012     * parameters are in the required ranges. For example, the solver can stop when all 
013     * variables are assigned and less than 10% of the soft constraints are violated. 
014     * Termination of the process by the user can also be a part of the termination condition.
015     *
016     * @see net.sf.cpsolver.ifs.solver.Solver
017     *
018     * @version
019     * IFS 1.1 (Iterative Forward Search)<br>
020     * Copyright (C) 2006 Tomáš Müller<br>
021     * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
022     * Lazenska 391, 76314 Zlin, Czech Republic<br>
023     * <br>
024     * This library is free software; you can redistribute it and/or
025     * modify it under the terms of the GNU Lesser General Public
026     * License as published by the Free Software Foundation; either
027     * version 2.1 of the License, or (at your option) any later version.
028     * <br><br>
029     * This library is distributed in the hope that it will be useful,
030     * but WITHOUT ANY WARRANTY; without even the implied warranty of
031     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
032     * Lesser General Public License for more details.
033     * <br><br>
034     * You should have received a copy of the GNU Lesser General Public
035     * License along with this library; if not, write to the Free Software
036     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
037     **/
038    public interface TerminationCondition {
039        /** Returns true when the solver can continue with the next iteration
040         * @param currentSolution current solution
041         */
042        public boolean canContinue(Solution currentSolution);
043    }