001package org.cpsolver.ifs.solution; 002 003import org.cpsolver.ifs.model.Value; 004import org.cpsolver.ifs.model.Variable; 005 006/** 007 * IFS solution comparator. <br> 008 * <br> 009 * The solution comparator compares two solutions: the current solution and the 010 * best solution found. This comparison can be based on several criteria. For 011 * example, it can lexicographically order solutions according to the number of 012 * unassigned variables (smaller number is better) and the number of violated 013 * soft constraints. 014 * 015 * @see Solution 016 * @see org.cpsolver.ifs.solver.Solver 017 * 018 * @author Tomáš Müller 019 * @version IFS 1.3 (Iterative Forward Search)<br> 020 * Copyright (C) 2006 - 2014 Tomáš Müller<br> 021 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br> 022 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br> 023 * <br> 024 * This library is free software; you can redistribute it and/or modify 025 * it under the terms of the GNU Lesser General Public License as 026 * published by the Free Software Foundation; either version 3 of the 027 * License, or (at your option) any later version. <br> 028 * <br> 029 * This library is distributed in the hope that it will be useful, but 030 * 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. <br> 033 * <br> 034 * You should have received a copy of the GNU Lesser General Public 035 * License along with this library; if not see 036 * <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>. 037 * 038 * @param <V> Variable 039 * @param <T> Value 040 */ 041public interface SolutionComparator<V extends Variable<V, T>, T extends Value<V, T>> { 042 /** 043 * Compares two solutions. Returns true if the given solution is better than 044 * its best ever found solution (see {@link Solution#saveBest()} and 045 * {@link Solution#restoreBest()}). 046 * 047 * @param currentSolution 048 * given solution 049 * @return true if the given solution is better than the best ever found 050 * solution 051 */ 052 public boolean isBetterThanBestSolution(Solution<V, T> currentSolution); 053}