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