net.sf.cpsolver.coursett.model
Class Lecture

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

public class Lecture
extends Variable<Lecture,Placement>
implements ConstantVariable

Lecture (variable).

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
 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, List<TimeLocation> timeLocations, List<RoomLocation> roomLocations, int nrRooms, Placement initialPlacement, int minClassLimit, int maxClassLimit, double room2limitRatio)
          Constructor
Lecture(Long id, Long solverGroupId, String name)
           
 
Method Summary
 Set<JenrlConstraint> 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<Lecture,Placement> constraint)
          Adds a constraint.
 void addStudent(Student student)
          Add an enrolled student
 boolean allowBreakHard()
           
 boolean areStudentConflictsHard(Lecture other)
           
 boolean canShareRoom()
           
 boolean canShareRoom(Lecture other)
           
 Set<GroupConstraint> canShareRoomConstraints()
           
 int classLimit()
           
 int classLimit(Placement assignment, Set<Placement> conflicts)
           
 void clearIgnoreStudentConflictsWithCache()
           
 void clearValueCache()
           
 int compareTo(Lecture o)
           
 List<Placement> computeValues(boolean allowBreakHard)
          Domain -- all combinations of room and time locations
 List<Lecture> conflictLectures(Student student)
          Lectures different from this one, where it is student conflict of the given student between this and the lecture
 Set<Student> conflictStudents()
          List of students of this class which are in conflict with any other assignment
 Set<Student> conflictStudents(Placement value)
          List of students of this class in conflict with the given assignment
 int countCommittedStudentConflicts(Placement value)
           
 int countCommittedStudentConflictsOfTheSameProblem(Placement value)
           
 int countDistanceStudentConflicts(Placement value)
           
 int countDistanceStudentConflictsOfTheSameProblem(Placement value)
           
 int countHardStudentConflicts(Placement value)
           
 int countHardStudentConflictsOfTheSameProblem(Placement value)
           
 int countInitialStudentConflicts()
          Number of student conflicts caused by the initial assignment of this lecture
 int countStudentConflicts(Placement value)
          Number of student conflicts caused by the given assignment of this lecture
 int countStudentConflictsOfTheSameProblem(Placement value)
           
 boolean equals(Object o)
           
 int getBestRoomPreference()
          Best room preference of this lecture
 double getBestTimePreference()
           
 Lecture getChild(Student student, Long subpartId)
           
 List<Lecture> getChildren(Long subpartId)
           
 Set<Long> getChildrenSubpartIds()
           
 Long getClassId()
          Class id
 ClassLimitConstraint getClassLimitConstraint()
           
 int getCommitedConflicts(Placement placement)
           
 Configuration getConfiguration()
           
 Long getDepartment()
          Controlling Course Offering Department
 DepartmentSpreadConstraint getDeptSpreadConstraint()
          Departmental spreading constraint
 Set<FlexibleConstraint> getFlexibleGroupConstraints()
           
 long getId()
          Class id
 Map<Lecture,Long> getInitialStudentConflicts()
          Table of student conflicts caused by the initial assignment of this lecture in format (another lecture, number)
 List<InstructorConstraint> getInstructorConstraints()
          Instructor constraint
 String getInstructorName()
           
 List<String> 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<SpreadConstraint> getSpreadConstraints()
           
 int getSpreadPenalty()
           
 String getValuesString()
           
 Set<Constraint<Lecture,Placement>> getWeakeningConstraints()
           
 Set<GroupConstraint> groupConstraints()
           
 Set<GroupConstraint> hardGroupSoftConstraints()
           
 boolean hasAnyChildren()
           
 boolean hasChildren(Long subpartId)
           
 int hashCode()
           
 boolean hasParent()
           
 boolean hasStudent(Student student)
          Returns true if the given student is enrolled
 Set<Student> 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 isToIgnoreStudentConflictsWith(Lecture other)
          Returns true if there is IgnoreStudentConflictsConstraint between the two lectures.
 boolean isValid(Placement placement)
           
 JenrlConstraint jenrlConstraint(Lecture another)
          All JENRL constraints of this lecture
 List<JenrlConstraint> jenrlConstraints()
           
 int maxAchievableClassLimit()
           
 int maxClassLimit()
           
 int maxRoomSize()
           
 int maxRoomUse()
           
 int minClassLimit()
           
 int minRoomSize()
           
 int minRoomUse()
           
 int nrRoomLocations()
           
 int nrTimeLocations()
           
 int nrValues()
           
 int nrValues(List<RoomLocation> rooms)
           
 int nrValues(RoomLocation room)
           
 int nrValues(TimeLocation time)
           
 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<Lecture,Placement> constraint)
          Removes a constraint.
 void removeStudent(Student student)
           
 List<RoomLocation> roomLocations()
          All room locations
 double roomToLimitRatio()
           
 Set<Student> sameStudents(Lecture lecture)
          List of students enrolled in this class as well as in the given class
 List<Lecture> sameStudentsLectures()
           
 List<Lecture> 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(List<Lecture> sameSubpartLectures)
          Set of lectures of the same class (only section is different)
 void setScheduler(Long scheduler)
          Scheduler (Managing Department)
 Set<Student> students()
          List of enrolled students
 List<TimeLocation> timeLocations()
          All time locations
 String toString()
           
 List<Placement> values()
          All values
 
Methods inherited from class net.sf.cpsolver.ifs.model.Variable
addVariableListener, assign, 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, unassign
 
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,
               List<TimeLocation> timeLocations,
               List<RoomLocation> 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<JenrlConstraint> 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<Lecture,Placement>

getId

public long getId()
Class id

Overrides:
getId in class Variable<Lecture,Placement>

getInstructorNames

public List<String> getInstructorNames()
Instructor name


getInstructorName

public String getInstructorName()

students

public Set<Student> 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(List<Lecture> sameSubpartLectures)
Set of lectures of the same class (only section is different)


sameSubpartLectures

public List<Lecture> sameSubpartLectures()
Set of lectures of the same class (only section is different)


sameStudents

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


conflictStudents

public Set<Student> conflictStudents(Placement value)
List of students of this class in conflict with the given assignment


conflictStudents

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


conflictLectures

public List<Lecture> 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 List<Placement> computeValues(boolean allowBreakHard)
Domain -- all combinations of room and time locations


clearValueCache

public void clearValueCache()

values

public List<Placement> values()
All values

Overrides:
values in class Variable<Lecture,Placement>

equals

public boolean equals(Object o)
Overrides:
equals in class Variable<Lecture,Placement>

getBestTimePreference

public double getBestTimePreference()

getBestRoomPreference

public int getBestRoomPreference()
Best room preference of this lecture


countStudentConflicts

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


countStudentConflictsOfTheSameProblem

public int countStudentConflictsOfTheSameProblem(Placement value)

countHardStudentConflicts

public int countHardStudentConflicts(Placement value)

countCommittedStudentConflictsOfTheSameProblem

public int countCommittedStudentConflictsOfTheSameProblem(Placement value)

countCommittedStudentConflicts

public int countCommittedStudentConflicts(Placement value)

countHardStudentConflictsOfTheSameProblem

public int countHardStudentConflictsOfTheSameProblem(Placement value)

countDistanceStudentConflicts

public int countDistanceStudentConflicts(Placement value)

countDistanceStudentConflictsOfTheSameProblem

public int countDistanceStudentConflictsOfTheSameProblem(Placement value)

countInitialStudentConflicts

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


getInitialStudentConflicts

public Map<Lecture,Long> getInitialStudentConflicts()
Table of student conflicts caused by the initial assignment of this lecture in format (another lecture, number)


initialStudentConflicts

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


addContstraint

public void addContstraint(Constraint<Lecture,Placement> 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<Lecture,Placement>
Parameters:
constraint - added constraint

removeContstraint

public void removeContstraint(Constraint<Lecture,Placement> 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<Lecture,Placement>
Parameters:
constraint - added constraint

jenrlConstraint

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


jenrlConstraints

public List<JenrlConstraint> jenrlConstraints()

minClassLimit

public int minClassLimit()

maxClassLimit

public int maxClassLimit()

maxAchievableClassLimit

public int maxAchievableClassLimit()

classLimit

public int classLimit()

classLimit

public int classLimit(Placement assignment,
                      Set<Placement> conflicts)

roomToLimitRatio

public double roomToLimitRatio()

minRoomUse

public int minRoomUse()

maxRoomUse

public int maxRoomUse()

toString

public String toString()
Overrides:
toString in class Variable<Lecture,Placement>

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 List<InstructorConstraint> getInstructorConstraints()
Instructor constraint


getClassLimitConstraint

public ClassLimitConstraint getClassLimitConstraint()

getSpreadConstraints

public Set<SpreadConstraint> getSpreadConstraints()

getFlexibleGroupConstraints

public Set<FlexibleConstraint> getFlexibleGroupConstraints()

getWeakeningConstraints

public Set<Constraint<Lecture,Placement>> getWeakeningConstraints()

roomLocations

public List<RoomLocation> roomLocations()
All room locations


timeLocations

public List<TimeLocation> 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(List<RoomLocation> 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 List<Lecture> getChildren(Long subpartId)

getChildrenSubpartIds

public Set<Long> getChildrenSubpartIds()

isSingleSection

public boolean isSingleSection()

sameStudentsLectures

public List<Lecture> sameStudentsLectures()

getChild

public Lecture getChild(Student student,
                        Long subpartId)

getCommitedConflicts

public int getCommitedConflicts(Placement placement)

hardGroupSoftConstraints

public Set<GroupConstraint> hardGroupSoftConstraints()

groupConstraints

public Set<GroupConstraint> groupConstraints()

minRoomSize

public int minRoomSize()

maxRoomSize

public int maxRoomSize()

canShareRoom

public boolean canShareRoom()

canShareRoom

public boolean canShareRoom(Lecture other)

canShareRoomConstraints

public Set<GroupConstraint> 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<Lecture,Placement>

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(Lecture o)
Specified by:
compareTo in interface Comparable<Lecture>
Overrides:
compareTo in class Variable<Lecture,Placement>

getNote

public String getNote()

setNote

public void setNote(String note)

areStudentConflictsHard

public boolean areStudentConflictsHard(Lecture other)

clearIgnoreStudentConflictsWithCache

public void clearIgnoreStudentConflictsWithCache()

isToIgnoreStudentConflictsWith

public boolean isToIgnoreStudentConflictsWith(Lecture other)
Returns true if there is IgnoreStudentConflictsConstraint between the two lectures.