net.sf.cpsolver.ifs.model
Class GlobalConstraint

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint
      extended by net.sf.cpsolver.ifs.model.GlobalConstraint
Direct Known Subclasses:
SectionLimit

public abstract class GlobalConstraint
extends Constraint

Generic global constraint.

Global constraint is a Constraint that applies to all variables.

Version:
IFS 1.1 (Iterative Forward Search)
Copyright (C) 2006 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

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 2.1 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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(Variable variable)
          Add a variable to this constraint
 void assigned(long iteration, Value value)
          Given value is to be assigned to its varable.
 EnumerableCollection assignedVariables()
          The list of variables of this constraint that are assigned
 void removeVariable(Variable variable)
          Remove a variable from this constraint
 void unassigned(long iteration, Value value)
          Given value is unassigned from its varable.
 Vector variables()
          The list of variables of this constraint
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, 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 Vector variables()
The list of variables of this constraint

Overrides:
variables in class Constraint

assignedVariables

public EnumerableCollection assignedVariables()
The list of variables of this constraint that are assigned

Overrides:
assignedVariables in class Constraint

addVariable

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

Overrides:
addVariable in class Constraint

removeVariable

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

Overrides:
removeVariable in class Constraint

assigned

public void assigned(long iteration,
                     Value 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

unassigned

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

Overrides:
unassigned in class Constraint