001 package net.sf.cpsolver.ifs.solution;
002
003 /**
004 * IFS solution comparator.
005 * <br><br>
006 * The solution comparator compares two solutions: the current solution and the best solution found. This comparison can
007 * be based on several criteria. For example, it can lexicographically order solutions according to the number of
008 * unassigned variables (smaller number is better) and the number of violated soft constraints.
009 *
010 * @see Solution
011 * @see net.sf.cpsolver.ifs.solver.Solver
012 *
013 * @version
014 * IFS 1.1 (Iterative Forward Search)<br>
015 * Copyright (C) 2006 Tomáš Müller<br>
016 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
017 * Lazenska 391, 76314 Zlin, Czech Republic<br>
018 * <br>
019 * This library is free software; you can redistribute it and/or
020 * modify it under the terms of the GNU Lesser General Public
021 * License as published by the Free Software Foundation; either
022 * version 2.1 of the License, or (at your option) any later version.
023 * <br><br>
024 * This library is distributed in the hope that it will be useful,
025 * but WITHOUT ANY WARRANTY; without even the implied warranty of
026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
027 * Lesser General Public License for more details.
028 * <br><br>
029 * You should have received a copy of the GNU Lesser General Public
030 * License along with this library; if not, write to the Free Software
031 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
032 */
033 public interface SolutionComparator {
034 /** Compares two solutions. Returns true if the given solution is better than its best ever found solution (see {@link Solution#saveBest()} and {@link Solution#restoreBest()}).
035 * @param currentSolution given solution
036 * @return true if the given solution is better than the best ever found solution
037 */
038 public boolean isBetterThanBestSolution(Solution currentSolution);
039 }