net.sf.cpsolver.coursett.model
Class Lecture

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Variable
      extended by net.sf.cpsolver.coursett.model.Lecture
All Implemented Interfaces:
Comparable, ConstantVariable

public class Lecture
extends Variable
implements ConstantVariable

Lecture (variable).

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

Field Summary
 boolean iCommitted
           
static boolean sAllowBreakHard
           
static boolean sSaveMemory
           
 
Fields inherited from class net.sf.cpsolver.ifs.model.Variable
iId, iValue
 
Constructor Summary
Lecture(Long id, Long solverGroupId, Long schedulingSubpartId, String name, Vector timeLocations, Vector roomLocations, int nrRooms, Placement initialPlacement, int minClassLimit, int maxClassLimit, double room2limitRatio)
          Constructor
Lecture(Long id, Long solverGroupId, String name)
           
 
Method Summary
 Set activeJenrls()
          Active jenrl constraints (active mean that there is at least one student between its classes)
 void addActiveJenrl(JenrlConstraint constr)
          Add active jenrl constraint (active mean that there is at least one student between its classes)
 void addContstraint(Constraint constraint)
          Adds a constraint.
 void addStudent(Student student)
          Add an enrolled student
 boolean allowBreakHard()
           
 boolean areStudentConflictsHard(Lecture lecture)
           
 void assign(long iteration, Value value)
          Assign value to this variable.
 boolean canShareRoom()
           
 boolean canShareRoom(Lecture other)
           
 Set canShareRoomConstraints()
           
 int classLimit()
           
 int classLimit(Placement assignment, Set conflicts)
           
 int compareTo(Object o)
           
 Vector computeValues(boolean allowBreakHard)
          Domain -- all combinations of room and time locations
 Vector conflictLectures(Student student)
          Lectures different from this one, where it is student conflict of the given student between this and the lecture
 Set conflictStudents()
          List of students of this class which are in conflict with any other assignment
 Set conflictStudents(Value value)
          List of students of this class in conflict with the given assignment
 int countDistanceStudentConflicts(Value value)
           
 int countDistanceStudentConflictsOfTheSameProblem(Value value)
           
 int countHardStudentConflicts(Value value)
           
 int countHardStudentConflictsOfTheSameProblem(Value value)
           
 int countInitialStudentConflicts()
          Number of student conflicts caused by the initial assignment of this lecture
 int countStudentConflicts(Value value)
          Number of student conflicts caused by the given assignment of this lecture
 int countStudentConflictsOfTheSameProblem(Value value)
           
 boolean equals(Object o)
           
 int getBestRoomPreference()
          Best room preference of this lecture
 double getBestTimePreference()
           
 Lecture getChild(Student student, Long subpartId)
           
 Vector getChildren(Long subpartId)
           
 Enumeration getChildrenSubpartIds()
           
 Long getClassId()
          Class id
 ClassLimitConstraint getClassLimitConstraint()
           
 int getCommitedConflicts(Placement placement)
           
 Configuration getConfiguration()
           
 Long getDepartment()
          Controlling Course Offering Department
 DepartmentSpreadConstraint getDeptSpreadConstraint()
          Departmental spreading constraint
 long getDiscouragedRoomSize()
           
 long getId()
          Class id
 Hashtable getInitialStudentConflicts()
          Table of student conflicts caused by the initial assignment of this lecture in format (another lecture, number)
 Vector getInstructorConstraints()
          Instructor constraint
 String getInstructorName()
           
 Vector getInstructorNames()
          Instructor name
 int[] getMinMaxRoomPreference()
           
 double[] getMinMaxTimePreference()
           
 String getName()
          Class name
 String getNote()
           
 String getNotValidReason(Placement placement)
           
 int getNrRooms()
           
 int getOrd()
           
 Lecture getParent()
           
 Long getScheduler()
          Scheduler (Managing Department)
 Long getSchedulingSubpartId()
           
 Long getSolverGroupId()
           
 Set getSpreadConstraints()
           
 int getSpreadPenalty()
           
 long getStronglyDiscouragedRoomSize()
           
 String getValuesString()
           
 Set getWeakeningConstraints()
           
 Set groupConstraints()
           
 Set hardGroupSoftConstraints()
           
 boolean hasAnyChildren()
           
 boolean hasChildren(Long subpartId)
           
 int hashCode()
           
 boolean hasParent()
           
 boolean hasStudent(Student student)
          Returns true if the given student is enrolled
 Set initialStudentConflicts()
          List of student conflicts caused by the initial assignment of this lecture
 boolean isCommitted()
           
 boolean isConstant()
          True, if the variable is constant.
 int isInConflict(Student student)
          True if this lecture is in a student conflict with the given student
 boolean isSingleSection()
           
 boolean isSingleton()
           
 boolean isValid(Placement placement)
           
 JenrlConstraint jenrlConstraint(Lecture another)
          All JENRL constraints of this lecture
 Enumeration jenrlConstraints()
           
 int maxAchievableClassLimit()
           
 int maxClassLimit()
           
 int maxRoomSize()
           
 int maxRoomUse()
           
 int minClassLimit()
           
 int minRoomSize()
           
 int minRoomUse()
           
 int nrRoomLocations()
           
 int nrTimeLocations()
           
 int nrValues()
           
 int nrValues(RoomLocation room)
           
 int nrValues(TimeLocation time)
           
 int nrValues(Vector rooms)
           
 double nrWeightedStudents()
           
 void purgeInvalidValues(boolean interactiveMode)
           
 void removeActiveJenrl(JenrlConstraint constr)
          Remove active jenrl constraint (active mean that there is at least one student between its classes)
 void removeContstraint(Constraint constraint)
          Removes a constraint.
 void removeStudent(Student student)
           
 Vector roomLocations()
          All room locations
 double roomToLimitRatio()
           
 Set sameStudents(Lecture lecture)
          List of students enrolled in this class as well as in the given class
 Vector sameStudentsLectures()
           
 Vector sameSubpartLectures()
          Set of lectures of the same class (only section is different)
 void setCommitted(boolean committed)
           
 void setConfiguration(Configuration configuration)
           
 void setDepartment(Long dept)
          Controlling Course Offering Department
 void setNote(String note)
           
 void setOrd(int ord)
           
 void setParent(Lecture parent)
           
 void setSameSubpartLectures(Vector sameSubpartLectures)
          Set of lectures of the same class (only section is different)
 void setScheduler(Long scheduler)
          Scheduler (Managing Department)
 Set students()
          List of enrolled students
 Vector timeLocations()
          All time locations
 String toString()
           
 void unassign(long iteration)
          Unassign value from this variable.
 Vector values()
          All values
 
Methods inherited from class net.sf.cpsolver.ifs.model.Variable
addVariableListener, constraints, constraintVariables, countAssignments, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getVariableListeners, hardConstraints, hasAssignment, hasInitialAssignment, hasValues, lastAssignmentIteration, lastUnassignmentIteration, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

iCommitted

public boolean iCommitted

sSaveMemory

public static boolean sSaveMemory

sAllowBreakHard

public static boolean sAllowBreakHard
Constructor Detail

Lecture

public Lecture(Long id,
               Long solverGroupId,
               Long schedulingSubpartId,
               String name,
               Vector timeLocations,
               Vector roomLocations,
               int nrRooms,
               Placement initialPlacement,
               int minClassLimit,
               int maxClassLimit,
               double room2limitRatio)
Constructor

Parameters:
id - unique identification
name - class name
timeLocations - set of time locations
roomLocations - set of room location
initialPlacement - initial placement

Lecture

public Lecture(Long id,
               Long solverGroupId,
               String name)
Method Detail

getSolverGroupId

public Long getSolverGroupId()

addActiveJenrl

public void addActiveJenrl(JenrlConstraint constr)
Add active jenrl constraint (active mean that there is at least one student between its classes)


activeJenrls

public Set activeJenrls()
Active jenrl constraints (active mean that there is at least one student between its classes)


removeActiveJenrl

public void removeActiveJenrl(JenrlConstraint constr)
Remove active jenrl constraint (active mean that there is at least one student between its classes)


getClassId

public Long getClassId()
Class id


getSchedulingSubpartId

public Long getSchedulingSubpartId()

getName

public String getName()
Class name

Overrides:
getName in class Variable

getId

public long getId()
Class id

Overrides:
getId in class Variable

getInstructorNames

public Vector getInstructorNames()
Instructor name


getInstructorName

public String getInstructorName()

students

public Set students()
List of enrolled students


nrWeightedStudents

public double nrWeightedStudents()

addStudent

public void addStudent(Student student)
Add an enrolled student


removeStudent

public void removeStudent(Student student)

hasStudent

public boolean hasStudent(Student student)
Returns true if the given student is enrolled


setSameSubpartLectures

public void setSameSubpartLectures(Vector sameSubpartLectures)
Set of lectures of the same class (only section is different)


sameSubpartLectures

public Vector sameSubpartLectures()
Set of lectures of the same class (only section is different)


sameStudents

public Set sameStudents(Lecture lecture)
List of students enrolled in this class as well as in the given class


conflictStudents

public Set conflictStudents(Value value)
List of students of this class in conflict with the given assignment


conflictStudents

public Set conflictStudents()
List of students of this class which are in conflict with any other assignment


conflictLectures

public Vector conflictLectures(Student student)
Lectures different from this one, where it is student conflict of the given student between this and the lecture


isInConflict

public int isInConflict(Student student)
True if this lecture is in a student conflict with the given student


computeValues

public Vector computeValues(boolean allowBreakHard)
Domain -- all combinations of room and time locations


values

public Vector values()
All values

Overrides:
values in class Variable

equals

public boolean equals(Object o)
Overrides:
equals in class Variable

getBestTimePreference

public double getBestTimePreference()

getBestRoomPreference

public int getBestRoomPreference()
Best room preference of this lecture


countStudentConflicts

public int countStudentConflicts(Value value)
Number of student conflicts caused by the given assignment of this lecture


countStudentConflictsOfTheSameProblem

public int countStudentConflictsOfTheSameProblem(Value value)

countHardStudentConflicts

public int countHardStudentConflicts(Value value)

countHardStudentConflictsOfTheSameProblem

public int countHardStudentConflictsOfTheSameProblem(Value value)

countDistanceStudentConflicts

public int countDistanceStudentConflicts(Value value)

countDistanceStudentConflictsOfTheSameProblem

public int countDistanceStudentConflictsOfTheSameProblem(Value value)

countInitialStudentConflicts

public int countInitialStudentConflicts()
Number of student conflicts caused by the initial assignment of this lecture


getInitialStudentConflicts

public Hashtable getInitialStudentConflicts()
Table of student conflicts caused by the initial assignment of this lecture in format (another lecture, number)


initialStudentConflicts

public Set initialStudentConflicts()
List of student conflicts caused by the initial assignment of this lecture


addContstraint

public void addContstraint(Constraint constraint)
Description copied from class: Variable
Adds a constraint. Called automatically when the constraint is added to the model, i.e., Model.addConstraint(Constraint) is called.

Overrides:
addContstraint in class Variable
Parameters:
constraint - added constraint

removeContstraint

public void removeContstraint(Constraint constraint)
Description copied from class: Variable
Removes a constraint. Called automatically when the constraint is removed from the model, i.e., Model.removeConstraint(Constraint) is called.

Overrides:
removeContstraint in class Variable
Parameters:
constraint - added constraint

jenrlConstraint

public JenrlConstraint jenrlConstraint(Lecture another)
All JENRL constraints of this lecture


jenrlConstraints

public Enumeration jenrlConstraints()

minClassLimit

public int minClassLimit()

maxClassLimit

public int maxClassLimit()

maxAchievableClassLimit

public int maxAchievableClassLimit()

classLimit

public int classLimit()

classLimit

public int classLimit(Placement assignment,
                      Set conflicts)

roomToLimitRatio

public double roomToLimitRatio()

minRoomUse

public int minRoomUse()

maxRoomUse

public int maxRoomUse()

toString

public String toString()
Overrides:
toString in class Variable

getValuesString

public String getValuesString()

getDepartment

public Long getDepartment()
Controlling Course Offering Department


setDepartment

public void setDepartment(Long dept)
Controlling Course Offering Department


getScheduler

public Long getScheduler()
Scheduler (Managing Department)


setScheduler

public void setScheduler(Long scheduler)
Scheduler (Managing Department)


getDeptSpreadConstraint

public DepartmentSpreadConstraint getDeptSpreadConstraint()
Departmental spreading constraint


getInstructorConstraints

public Vector getInstructorConstraints()
Instructor constraint


getClassLimitConstraint

public ClassLimitConstraint getClassLimitConstraint()

getSpreadConstraints

public Set getSpreadConstraints()

getWeakeningConstraints

public Set getWeakeningConstraints()

roomLocations

public Vector roomLocations()
All room locations


timeLocations

public Vector timeLocations()
All time locations


nrTimeLocations

public int nrTimeLocations()

nrRoomLocations

public int nrRoomLocations()

nrValues

public int nrValues()

nrValues

public int nrValues(TimeLocation time)

nrValues

public int nrValues(RoomLocation room)

nrValues

public int nrValues(Vector rooms)

allowBreakHard

public boolean allowBreakHard()

getNrRooms

public int getNrRooms()

getParent

public Lecture getParent()

setParent

public void setParent(Lecture parent)

hasParent

public boolean hasParent()

hasChildren

public boolean hasChildren(Long subpartId)

hasAnyChildren

public boolean hasAnyChildren()

getChildren

public Vector getChildren(Long subpartId)

getChildrenSubpartIds

public Enumeration getChildrenSubpartIds()

isSingleSection

public boolean isSingleSection()

areStudentConflictsHard

public boolean areStudentConflictsHard(Lecture lecture)

sameStudentsLectures

public Vector sameStudentsLectures()

getChild

public Lecture getChild(Student student,
                        Long subpartId)

getCommitedConflicts

public int getCommitedConflicts(Placement placement)

assign

public void assign(long iteration,
                   Value value)
Description copied from class: Variable
Assign value to this variable. If the variable has already assigned another value, it is unassigned first. Also, all conflicting values are unassigned before the given value is assigned to this variable.

Overrides:
assign in class Variable
Parameters:
iteration - current iteration
value - the value to be assigned

unassign

public void unassign(long iteration)
Description copied from class: Variable
Unassign value from this variable.

Overrides:
unassign in class Variable
Parameters:
iteration - current iteration

hardGroupSoftConstraints

public Set hardGroupSoftConstraints()

groupConstraints

public Set groupConstraints()

minRoomSize

public int minRoomSize()

maxRoomSize

public int maxRoomSize()

getDiscouragedRoomSize

public long getDiscouragedRoomSize()

getStronglyDiscouragedRoomSize

public long getStronglyDiscouragedRoomSize()

canShareRoom

public boolean canShareRoom()

canShareRoom

public boolean canShareRoom(Lecture other)

canShareRoomConstraints

public Set canShareRoomConstraints()

isSingleton

public boolean isSingleton()

isValid

public boolean isValid(Placement placement)

getNotValidReason

public String getNotValidReason(Placement placement)

purgeInvalidValues

public void purgeInvalidValues(boolean interactiveMode)

setCommitted

public void setCommitted(boolean committed)

isCommitted

public boolean isCommitted()

isConstant

public boolean isConstant()
Description copied from interface: ConstantVariable
True, if the variable is constant.

Specified by:
isConstant in interface ConstantVariable

getSpreadPenalty

public int getSpreadPenalty()

hashCode

public int hashCode()
Overrides:
hashCode in class Variable

getConfiguration

public Configuration getConfiguration()

setConfiguration

public void setConfiguration(Configuration configuration)

getMinMaxRoomPreference

public int[] getMinMaxRoomPreference()

getMinMaxTimePreference

public double[] getMinMaxTimePreference()

setOrd

public void setOrd(int ord)

getOrd

public int getOrd()

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Variable

getNote

public String getNote()

setNote

public void setNote(String note)