net.sf.cpsolver.coursett.constraint
Class ClassLimitConstraint

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint<Lecture,Placement>
      extended by net.sf.cpsolver.coursett.constraint.ClassLimitConstraint
All Implemented Interfaces:
Comparable<Constraint<Lecture,Placement>>

public class ClassLimitConstraint
extends Constraint<Lecture,Placement>

Class limit constraint.

Version:
CourseTT 1.2 (University Course Timetabling)
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/.

Field Summary
 
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
ClassLimitConstraint(int classLimit, String name)
           
ClassLimitConstraint(Lecture parent, String name)
           
 
Method Summary
 void addParentAdepts(Collection<Placement> adepts, Lecture parent, Placement value, Set<Placement> conflicts)
           
 int classLimit()
           
 void computeAdepts(Collection<Placement> adepts, List<Lecture> variables, Placement value, Set<Placement> conflicts)
           
 void computeConflicts(Placement value, Set<Placement> conflicts)
          The only method which has to be implemented by any constraint.
 int currentClassLimit(Placement value, Set<Placement> conflicts)
           
 int getClassLimitDelta()
           
 String getName()
          Constraint's name -- for printing purposes
 Lecture getParentLecture()
           
 boolean inConflict(Placement value)
          Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint.
 boolean isEnabled()
           
 void setClassLimitDelta(int classLimitDelta)
           
 void setEnabled(boolean enabled)
           
 String toString()
           
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, addVariable, assigned, assignedVariables, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isConsistent, isHard, removeConstraintListener, removeVariable, setModel, unassigned, variables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassLimitConstraint

public ClassLimitConstraint(int classLimit,
                            String name)

ClassLimitConstraint

public ClassLimitConstraint(Lecture parent,
                            String name)
Method Detail

getClassLimitDelta

public int getClassLimitDelta()

setClassLimitDelta

public void setClassLimitDelta(int classLimitDelta)

classLimit

public int classLimit()

getParentLecture

public Lecture getParentLecture()

currentClassLimit

public int currentClassLimit(Placement value,
                             Set<Placement> conflicts)

computeConflicts

public void computeConflicts(Placement value,
                             Set<Placement> conflicts)
Description copied from class: Constraint
The only method which has to be implemented by any constraint. It returns the values which needs to be unassigned in order to make this constraint consistent with the given value if it is assigned to its variable. The computed list of conflicting values is added to the given set of conflicts.

Specified by:
computeConflicts in class Constraint<Lecture,Placement>
Parameters:
value - value to be assigned to its varaible
conflicts - resultant set of conflicting values

computeAdepts

public void computeAdepts(Collection<Placement> adepts,
                          List<Lecture> variables,
                          Placement value,
                          Set<Placement> conflicts)

addParentAdepts

public void addParentAdepts(Collection<Placement> adepts,
                            Lecture parent,
                            Placement value,
                            Set<Placement> conflicts)

inConflict

public boolean inConflict(Placement value)
Description copied from class: Constraint
Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint. This method is used by MAC (see MacPropagation).

Overrides:
inConflict in class Constraint<Lecture,Placement>

getName

public String getName()
Description copied from class: Constraint
Constraint's name -- for printing purposes

Overrides:
getName in class Constraint<Lecture,Placement>

setEnabled

public void setEnabled(boolean enabled)

isEnabled

public boolean isEnabled()

toString

public String toString()
Overrides:
toString in class Object