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 * @author Tomáš Müller 027 * @version IFS 1.3 (Iterative Forward Search)<br> 028 * Copyright (C) 2006 - 2014 Tomáš Müller<br> 029 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br> 030 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br> 031 * <br> 032 * This library is free software; you can redistribute it and/or modify 033 * it under the terms of the GNU Lesser General Public License as 034 * published by the Free Software Foundation; either version 3 of the 035 * License, or (at your option) any later version. <br> 036 * <br> 037 * This library is distributed in the hope that it will be useful, but 038 * WITHOUT ANY WARRANTY; without even the implied warranty of 039 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 040 * Lesser General Public License for more details. <br> 041 * <br> 042 * You should have received a copy of the GNU Lesser General Public 043 * License along with this library; if not see <a href='http://www.gnu.org/licenses'>http://www.gnu.org/licenses</a>. 044 * 045 * @param <V> Variable 046 * @param <T> Value 047 **/ 048public interface ValueSelection<V extends Variable<V, T>, T extends Value<V, T>> { 049 /** Initialization 050 * @param solver current solver 051 **/ 052 public void init(Solver<V, T> solver); 053 054 /** 055 * Value selection 056 * 057 * @param solution 058 * current solution 059 * @param selectedVariable 060 * selected variable 061 * @return selected value (of the given variable) 062 */ 063 public T selectValue(Solution<V, T> solution, V selectedVariable); 064}