001package org.cpsolver.ifs.termination; 002 003import org.cpsolver.ifs.model.Value; 004import org.cpsolver.ifs.model.Variable; 005import org.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 org.cpsolver.ifs.solver.Solver 020 * 021 * @version IFS 1.3 (Iterative Forward Search)<br> 022 * Copyright (C) 2006 - 2014 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 <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>. 038 * 039 * @param <V> Variable 040 * @param <T> Value 041 **/ 042public interface TerminationCondition<V extends Variable<V, T>, T extends Value<V, T>> { 043 /** 044 * Returns true when the solver can continue with the next iteration 045 * 046 * @param currentSolution 047 * current solution 048 * @return true if the solver can continue with the next iteration 049 */ 050 public boolean canContinue(Solution<V, T> currentSolution); 051}