net.sf.cpsolver.ifs.model
Class GlobalConstraint<V extends Variable<V,T>,T extends Value<V,T>>

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint<V,T>
      extended by net.sf.cpsolver.ifs.model.GlobalConstraint<V,T>
All Implemented Interfaces:
Comparable<Constraint<V,T>>
Direct Known Subclasses:
ConfigLimit, CourseLimit, ReservationLimit, SectionLimit

public abstract class GlobalConstraint<V extends Variable<V,T>,T extends Value<V,T>>
extends Constraint<V,T>

Generic global constraint.

Global constraint is a Constraint that applies to all variables.

Version:
IFS 1.2 (Iterative Forward Search)
Copyright (C) 2006 - 2010 Tomáš Müller
muller@unitime.org
http://muller.unitime.org

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
See Also:
Variable, Model, Constraint, Solver

Field Summary
 
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
GlobalConstraint()
           
 
Method Summary
 void addVariable(V variable)
          Add a variable to this constraint
 void assigned(long iteration, T value)
          Given value is to be assigned to its varable.
 Collection<V> assignedVariables()
          The list of variables of this constraint that are assigned
 void removeVariable(V variable)
          Remove a variable from this constraint
 void unassigned(long iteration, T value)
          Given value is unassigned from its varable.
 List<V> variables()
          The list of variables of this constraint
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, compareTo, computeConflicts, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, getName, hashCode, inConflict, isConsistent, isHard, removeConstraintListener, setModel
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalConstraint

public GlobalConstraint()
Method Detail

variables

public List<V> variables()
The list of variables of this constraint

Overrides:
variables in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

assignedVariables

public Collection<V> assignedVariables()
The list of variables of this constraint that are assigned

Overrides:
assignedVariables in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

addVariable

public void addVariable(V variable)
Add a variable to this constraint

Overrides:
addVariable in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

removeVariable

public void removeVariable(V variable)
Remove a variable from this constraint

Overrides:
removeVariable in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

assigned

public void assigned(long iteration,
                     T value)
Given value is to be assigned to its varable. In this method, the constraint should unassigns all varaibles which are in conflict with the given assignment because of this constraint.

Overrides:
assigned in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>

unassigned

public void unassigned(long iteration,
                       T value)
Given value is unassigned from its varable.

Overrides:
unassigned in class Constraint<V extends Variable<V,T>,T extends Value<V,T>>