001package net.sf.cpsolver.ifs.model; 002 003import java.util.Set; 004 005/** 006 * IFS constraint listener. 007 * 008 * @see Constraint 009 * 010 * @version IFS 1.2 (Iterative Forward Search)<br> 011 * Copyright (C) 2006 - 2010 Tomáš Müller<br> 012 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br> 013 * <a href="http://muller.unitime.org">http://muller.unitime.org</a><br> 014 * <br> 015 * This library is free software; you can redistribute it and/or modify 016 * it under the terms of the GNU Lesser General Public License as 017 * published by the Free Software Foundation; either version 3 of the 018 * License, or (at your option) any later version. <br> 019 * <br> 020 * This library is distributed in the hope that it will be useful, but 021 * WITHOUT ANY WARRANTY; without even the implied warranty of 022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 023 * Lesser General Public License for more details. <br> 024 * <br> 025 * You should have received a copy of the GNU Lesser General Public 026 * License along with this library; if not see 027 * <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>. 028 */ 029public interface ConstraintListener<T extends Value<?, T>> { 030 /** 031 * Called by the constraint, before a value is assigned to its variable. 032 * 033 * @param iteration 034 * current iteration 035 * @param constraint 036 * source constraint 037 * @param assigned 038 * value which will be assigned to its variable ( 039 * {@link Value#variable()}) 040 * @param unassigned 041 * set of conflicting values which will be unassigned by the 042 * constraint before it assigns the given value 043 */ 044 public void constraintBeforeAssigned(long iteration, Constraint<?, T> constraint, T assigned, Set<T> unassigned); 045 046 /** 047 * Called by the constraint, after a value is assigned to its variable. 048 * 049 * @param iteration 050 * current iteration 051 * @param constraint 052 * source constraint 053 * @param assigned 054 * value which was assigned to its variable ( 055 * {@link Value#variable()}) 056 * @param unassigned 057 * set of conflicting values which were unassigned by the 058 * constraint before it assigned the given value 059 */ 060 public void constraintAfterAssigned(long iteration, Constraint<?, T> constraint, T assigned, Set<T> unassigned); 061}