001package net.sf.cpsolver.ifs.heuristics;
002
003import net.sf.cpsolver.ifs.model.Value;
004import net.sf.cpsolver.ifs.model.Variable;
005import net.sf.cpsolver.ifs.solution.Solution;
006import net.sf.cpsolver.ifs.solver.Solver;
007
008/**
009 * Value selection criterion. <br>
010 * <br>
011 * After a variable is selected, we need to find a value to be assigned to the
012 * variable. This problem is usually called "value selection" in constraint
013 * programming. Typically, the most useful advice is to select the best-fit
014 * value. So, we are looking for a value which is the most preferred for the
015 * variable and which causes the least trouble as well. This means that we need
016 * to find a value with the minimal potential for future conflicts with other
017 * variables. For example, a value which violates the smallest number of soft
018 * constraints can be selected among those with the smallest number of hard
019 * conflicts. <br>
020 * <br>
021 * The task of this criterion is to select a value of the given variable which
022 * will be assigned to this variable.
023 * 
024 * @see Solver
025 * 
026 * @version IFS 1.2 (Iterative Forward Search)<br>
027 *          Copyright (C) 2006 - 2010 Tomáš Müller<br>
028 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
029 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
030 * <br>
031 *          This library is free software; you can redistribute it and/or modify
032 *          it under the terms of the GNU Lesser General Public License as
033 *          published by the Free Software Foundation; either version 3 of the
034 *          License, or (at your option) any later version. <br>
035 * <br>
036 *          This library is distributed in the hope that it will be useful, but
037 *          WITHOUT ANY WARRANTY; without even the implied warranty of
038 *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
039 *          Lesser General Public License for more details. <br>
040 * <br>
041 *          You should have received a copy of the GNU Lesser General Public
042 *          License along with this library; if not see <http://www.gnu.org/licenses/>.
043 **/
044public interface ValueSelection<V extends Variable<V, T>, T extends Value<V, T>> {
045    /** Initialization */
046    public void init(Solver<V, T> solver);
047
048    /**
049     * Value selection
050     * 
051     * @param solution
052     *            current solution
053     * @param selectedVariable
054     *            selected variable
055     */
056    public T selectValue(Solution<V, T> solution, V selectedVariable);
057}