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