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