001 package net.sf.cpsolver.ifs.model;
002
003 /**
004 * IFS model listener.
005 *
006 * @see Model
007 *
008 * @version
009 * IFS 1.1 (Iterative Forward Search)<br>
010 * Copyright (C) 2006 Tomáš Müller<br>
011 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
012 * Lazenska 391, 76314 Zlin, Czech Republic<br>
013 * <br>
014 * This library is free software; you can redistribute it and/or
015 * modify it under the terms of the GNU Lesser General Public
016 * License as published by the Free Software Foundation; either
017 * version 2.1 of the License, or (at your option) any later version.
018 * <br><br>
019 * This library is distributed in the hope that it will be useful,
020 * but WITHOUT ANY WARRANTY; without even the implied warranty of
021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
022 * Lesser General Public License for more details.
023 * <br><br>
024 * You should have received a copy of the GNU Lesser General Public
025 * License along with this library; if not, write to the Free Software
026 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
027 */
028 public interface ModelListener {
029 /** Variable is added to the model
030 * @param variable added variable
031 */
032 public void variableAdded(Variable variable);
033
034 /** Variable is removed from the model
035 * @param variable removed variable
036 */
037 public void variableRemoved(Variable variable);
038
039 /** Constraint is added to the model
040 * @param constraint added constraint
041 */
042 public void constraintAdded(Constraint constraint);
043
044 /** Constraint is removed from the model
045 * @param constraint removed constraint
046 */
047 public void constraintRemoved(Constraint constraint);
048
049 /** Called before a value is assigned to its variable ({@link Value#variable()}).
050 * @param iteration current iteration
051 * @param value value to be assigned
052 */
053 public void beforeAssigned(long iteration, Value value);
054
055 /** Called before a value is unassigned from its variable ({@link Value#variable()}).
056 * @param iteration current iteration
057 * @param value value to be unassigned
058 */
059 public void beforeUnassigned(long iteration, Value value);
060
061 /** Called after a value is assigned to its variable ({@link Value#variable()}).
062 * @param iteration current iteration
063 * @param value value to be assigned
064 */
065 public void afterAssigned(long iteration, Value value);
066
067 /** Called after a value is unassigned from its variable ({@link Value#variable()}).
068 * @param iteration current iteration
069 * @param value value to be unassigned
070 */
071 public void afterUnassigned(long iteration, Value value);
072
073 /** Notification that the model was initialized by the solver.
074 * @param solver IFS solver
075 */
076 public boolean init(net.sf.cpsolver.ifs.solver.Solver solver);
077 }