net.sf.cpsolver.coursett.model
Class TimetableModel

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Model
      extended by net.sf.cpsolver.ifs.constant.ConstantModel
          extended by net.sf.cpsolver.coursett.model.TimetableModel

public class TimetableModel
extends ConstantModel

Timetable model.

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
 
Fields inherited from class net.sf.cpsolver.ifs.model.Model
iAssignedVariables, iPerturbVariables, iUnassignedVariables, sPercentageFormat, sTimeFormat
 
Constructor Summary
TimetableModel(DataProperties properties)
           
 
Method Summary
 void addConstraint(Constraint constraint)
          Adds a constraint to the model
 void addStudent(Student student)
           
 void addVariable(Variable variable)
          Adds a variable to the model
 void afterAssigned(long iteration, Value value)
          When a value is assigned to a variable -- update gloval preferences
 void afterUnassigned(long iteration, Value value)
          When a value is unassigned from a variable -- update gloval preferences
 int bestCommitedStudentConflicts()
           
 int bestDepartmentSpreadPenalty()
          Overall departmental spread penalty of the best solution ever found
 long bestGlobalGroupConstraintPreference()
          Overall group constraint preference of the best solution ever found
 long bestGlobalRoomPreference()
          Overall room preference of the best solution ever found
 double bestGlobalTimePreference()
          Overall time preference of the best solution ever found
 long bestHardStudentConflicts()
          Overall number of student conflicts between single section classes of the best solution ever found
 long bestInstructorDistancePreference()
          Overall instructor distance preference of the best solution ever found
 int bestSpreadPenalty()
           
 int bestTooBigRooms()
          Overall number of too big rooms of the best solution ever found
 long bestUselessSlots()
          Overall number of useless slots of the best solution ever found
 long bestViolatedStudentConflicts()
          Overall number of student conflicts of the best solution ever found
 int countCommitedStudentConflicts()
           
 long countHardStudentConflicts()
           
 long countStudentDistanceConflicts()
           
 int countTooBigRooms()
          Overall number of too big rooms (rooms with more than 3/2 seats than needed)
 long countViolatedStudentConflicts()
          Number of student conflicts
 Set getAllStudents()
           
 Hashtable getBounds()
           
 long getBrokenTimePatterns()
          Overall number of useless time slots
 Vector getClassLimitConstraints()
           
 int getCommitedStudentConflicts()
           
 Counter getCommittedStudentConflictsCounter()
           
 Vector getDepartmentSpreadConstraints()
          The list of all departmental spread constraints
 int getDepartmentSpreadPenalty()
          Overall departmental spread penalty
 long getGlobalGroupConstraintPreference()
          Overall group constraint preference
 Counter getGlobalGroupConstraintPreferenceCounter()
          Overall group constraint preference
 long getGlobalRoomPreference()
          Overall room preference
 double getGlobalTimePreference()
          Overall time preference
 Vector getGroupConstraints()
          The list of all group constraints
 long getHardStudentConflicts()
          Overall hard student conflicts (student conflict between single section classes)
 Hashtable getInfo()
          Global info
 Hashtable getInfo(Vector variables)
          Returns information about the current solution.
 Vector getInstructorConstraints()
          The list of all instructor constraints
 double getInstructorDiscouragedLimit()
           
 long getInstructorDistancePreference()
          Overall instructor distance (back-to-back) preference
 double getInstructorNoPreferenceLimit()
           
 double getInstructorProhibitedLimit()
           
 long getInstructorWorstDistancePreference()
          The worst instructor distance (back-to-back) preference
 Vector getJenrlConstraints()
          The list of all jenrl constraints
static String getMem()
          Returns amount of allocated memory.
 PerturbationsCounter getPerturbationsCounter()
           
 DataProperties getProperties()
           
 Vector getRoomConstraints()
          The list of all room constraints
 Vector getSpreadConstraints()
           
 int getSpreadPenalty()
          Overall spread penalty
 long getStudentDistanceConflicts()
          Overall number of student conflicts caused by distancies (back-to-back classes are too far)
 double getStudentDistanceLimit()
           
 double getStudentDistanceLimit75min()
           
 TimetableComparator getTimetableComparator()
           
 double getTotalValue()
          Max capacity for too big rooms (3/2 of the number of students)
 double getTotalValue(Vector variables)
          Value of the current solution.
 long getUselessHalfHours()
          Overall number of useless time slots
 long getUselessSlots()
          Overall number of useless time slots
 Counter getViolatedDistanceStudentConflictsCounter()
           
 Counter getViolatedHardStudentConflictsCounter()
           
 long getViolatedStudentConflicts()
          Number of student conflicts
 Counter getViolatedStudentConflictsCounter()
          Number of student conflicts
 int getYear()
           
 boolean init(Solver solver)
          Model initialization
 void removeConstraint(Constraint constraint)
          Removes a constraint from the model
 void removeStudent(Student student)
           
 void removeVariable(Variable variable)
          Removes a variable from the model
 void saveBest()
          Save the current assignment as the best ever found assignment
 void setYear(int year)
           
 void switchStudents()
          Student final sectioning (switching students between sections of the same class in order to minimize overall number of student conflicts)
 String toString()
           
 
Methods inherited from class net.sf.cpsolver.ifs.constant.ConstantModel
beforeAssigned, beforeUnassigned, constantVariables, hasConstantVariables, isConstant
 
Methods inherited from class net.sf.cpsolver.ifs.model.Model
addGlobalConstraint, addModelListener, assignedVariables, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getExtendedInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, globalConstraints, inConflict, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeGlobalConstraint, removeModelListener, restoreBest, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimetableModel

public TimetableModel(DataProperties properties)
Method Detail

getInstructorNoPreferenceLimit

public double getInstructorNoPreferenceLimit()

getInstructorDiscouragedLimit

public double getInstructorDiscouragedLimit()

getInstructorProhibitedLimit

public double getInstructorProhibitedLimit()

getStudentDistanceLimit

public double getStudentDistanceLimit()

getStudentDistanceLimit75min

public double getStudentDistanceLimit75min()

init

public boolean init(Solver solver)
Description copied from class: Model
Model initialization

Overrides:
init in class Model

addVariable

public void addVariable(Variable variable)
Description copied from class: ConstantModel
Adds a variable to the model

Overrides:
addVariable in class ConstantModel

removeVariable

public void removeVariable(Variable variable)
Description copied from class: ConstantModel
Removes a variable from the model

Overrides:
removeVariable in class ConstantModel

getProperties

public DataProperties getProperties()

getGlobalRoomPreference

public long getGlobalRoomPreference()
Overall room preference


getGlobalTimePreference

public double getGlobalTimePreference()
Overall time preference


getViolatedStudentConflicts

public long getViolatedStudentConflicts()
Number of student conflicts


countViolatedStudentConflicts

public long countViolatedStudentConflicts()
Number of student conflicts


getViolatedStudentConflictsCounter

public Counter getViolatedStudentConflictsCounter()
Number of student conflicts


getViolatedHardStudentConflictsCounter

public Counter getViolatedHardStudentConflictsCounter()

getViolatedDistanceStudentConflictsCounter

public Counter getViolatedDistanceStudentConflictsCounter()

getGlobalGroupConstraintPreference

public long getGlobalGroupConstraintPreference()
Overall group constraint preference


getGlobalGroupConstraintPreferenceCounter

public Counter getGlobalGroupConstraintPreferenceCounter()
Overall group constraint preference


getInstructorDistancePreference

public long getInstructorDistancePreference()
Overall instructor distance (back-to-back) preference


getInstructorWorstDistancePreference

public long getInstructorWorstDistancePreference()
The worst instructor distance (back-to-back) preference


getUselessSlots

public long getUselessSlots()
Overall number of useless time slots


getUselessHalfHours

public long getUselessHalfHours()
Overall number of useless time slots


getBrokenTimePatterns

public long getBrokenTimePatterns()
Overall number of useless time slots


getStudentDistanceConflicts

public long getStudentDistanceConflicts()
Overall number of student conflicts caused by distancies (back-to-back classes are too far)


countStudentDistanceConflicts

public long countStudentDistanceConflicts()

getHardStudentConflicts

public long getHardStudentConflicts()
Overall hard student conflicts (student conflict between single section classes)


countHardStudentConflicts

public long countHardStudentConflicts()

getCommittedStudentConflictsCounter

public Counter getCommittedStudentConflictsCounter()

getCommitedStudentConflicts

public int getCommitedStudentConflicts()

countCommitedStudentConflicts

public int countCommitedStudentConflicts()

afterAssigned

public void afterAssigned(long iteration,
                          Value value)
When a value is assigned to a variable -- update gloval preferences

Overrides:
afterAssigned in class ConstantModel

afterUnassigned

public void afterUnassigned(long iteration,
                            Value value)
When a value is unassigned from a variable -- update gloval preferences

Overrides:
afterUnassigned in class ConstantModel

switchStudents

public void switchStudents()
Student final sectioning (switching students between sections of the same class in order to minimize overall number of student conflicts)


toString

public String toString()
Overrides:
toString in class Model

countTooBigRooms

public int countTooBigRooms()
Overall number of too big rooms (rooms with more than 3/2 seats than needed)


getDepartmentSpreadPenalty

public int getDepartmentSpreadPenalty()
Overall departmental spread penalty


getSpreadPenalty

public int getSpreadPenalty()
Overall spread penalty


getBounds

public Hashtable getBounds()

getInfo

public Hashtable getInfo()
Global info

Overrides:
getInfo in class Model

getInfo

public Hashtable getInfo(Vector variables)
Description copied from class: Model
Returns information about the current solution. Information from all model listeners and constraints is also included. Only variables from the given set are considered.

Overrides:
getInfo in class Model

bestTooBigRooms

public int bestTooBigRooms()
Overall number of too big rooms of the best solution ever found


bestUselessSlots

public long bestUselessSlots()
Overall number of useless slots of the best solution ever found


bestGlobalTimePreference

public double bestGlobalTimePreference()
Overall time preference of the best solution ever found


bestGlobalRoomPreference

public long bestGlobalRoomPreference()
Overall room preference of the best solution ever found


bestGlobalGroupConstraintPreference

public long bestGlobalGroupConstraintPreference()
Overall group constraint preference of the best solution ever found


bestViolatedStudentConflicts

public long bestViolatedStudentConflicts()
Overall number of student conflicts of the best solution ever found


bestHardStudentConflicts

public long bestHardStudentConflicts()
Overall number of student conflicts between single section classes of the best solution ever found


bestInstructorDistancePreference

public long bestInstructorDistancePreference()
Overall instructor distance preference of the best solution ever found


bestDepartmentSpreadPenalty

public int bestDepartmentSpreadPenalty()
Overall departmental spread penalty of the best solution ever found


bestSpreadPenalty

public int bestSpreadPenalty()

bestCommitedStudentConflicts

public int bestCommitedStudentConflicts()

saveBest

public void saveBest()
Description copied from class: Model
Save the current assignment as the best ever found assignment

Overrides:
saveBest in class Model

addConstraint

public void addConstraint(Constraint constraint)
Description copied from class: Model
Adds a constraint to the model

Overrides:
addConstraint in class Model

removeConstraint

public void removeConstraint(Constraint constraint)
Description copied from class: Model
Removes a constraint from the model

Overrides:
removeConstraint in class Model

getInstructorConstraints

public Vector getInstructorConstraints()
The list of all instructor constraints


getGroupConstraints

public Vector getGroupConstraints()
The list of all group constraints


getJenrlConstraints

public Vector getJenrlConstraints()
The list of all jenrl constraints


getRoomConstraints

public Vector getRoomConstraints()
The list of all room constraints


getDepartmentSpreadConstraints

public Vector getDepartmentSpreadConstraints()
The list of all departmental spread constraints


getSpreadConstraints

public Vector getSpreadConstraints()

getClassLimitConstraints

public Vector getClassLimitConstraints()

getTotalValue

public double getTotalValue()
Max capacity for too big rooms (3/2 of the number of students)

Overrides:
getTotalValue in class Model

getTotalValue

public double getTotalValue(Vector variables)
Description copied from class: Model
Value of the current solution. It is the sum of all assigned values, i.e., Value.toDouble(). Only variables from the given set are considered.

Overrides:
getTotalValue in class Model

getYear

public int getYear()

setYear

public void setYear(int year)

getTimetableComparator

public TimetableComparator getTimetableComparator()

getPerturbationsCounter

public PerturbationsCounter getPerturbationsCounter()

getAllStudents

public Set getAllStudents()

addStudent

public void addStudent(Student student)

removeStudent

public void removeStudent(Student student)

getMem

public static String getMem()
Returns amount of allocated memory.

Returns:
amount of allocated memory to be written in the log