    001package org.cpsolver.ifs.heuristics;
    002
    003import org.cpsolver.ifs.model.Value;
    004import org.cpsolver.ifs.model.Variable;
    005import org.cpsolver.ifs.solution.Solution;
    006import org.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.3 (Iterative Forward Search)<br>
    027 *          Copyright (C) 2006 - 2014 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 <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>.
    043 *
    044 * @param <V> Variable
    045 * @param <T> Value
    046 **/
    047public interface ValueSelection<V extends Variable<V, T>, T extends Value<V, T>> {
    048    /** Initialization
    049     * @param solver current solver
    050     **/
    051    public void init(Solver<V, T> solver);
    052
    053    /**
    054     * Value selection
    055     *
    056     * @param solution
    057     *            current solution
    058     * @param selectedVariable
    059     *            selected variable
    060     * @return selected value (of the given variable)
    061     */
    062    public T selectValue(Solution<V, T> solution, V selectedVariable);
    063}