net.sf.cpsolver.exam.model
Class ExamModel

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Model
      extended by net.sf.cpsolver.exam.model.ExamModel

public class ExamModel
extends Model

Examination timetabling model. Exams Exam are modeled as variables, rooms ExamRoom and students ExamStudent as constraints. Assignment of an exam to time (modeled as non-overlapping periods ExamPeriod) and space (set of rooms) is modeled using values ExamPlacement. In order to be able to model individual period and room preferences, period and room assignments are wrapped with ExamPeriodPlacement and ExamRoomPlacement classes respectively. Moreover, additional distribution constraint ExamDistributionConstraint can be defined in the model.

The objective function consists of the following criteria:

Version:
ExamTT 1.1 (Examination Timetabling)
Copyright (C) 2008 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, sDoubleFormat, sPercentageFormat, sTimeFormat
 
Constructor Summary
ExamModel(DataProperties properties)
          Constructor
 
Method Summary
protected  void addDistributionPenalty(int inc)
          To be called by soft ExamDistributionConstraint when satisfaction changes.
 ExamPeriod addPeriod(Long id, String day, String time, int length, int penalty)
          Add a period
 void afterAssigned(long iteration, Value value)
          Called after a value is assigned to its variable, optimization criteria are updated
 void beforeUnassigned(long iteration, Value value)
          Called before a value is unassigned from its variable, optimization criteria are updated
 double getBackToBackConflictWeight()
          Back-to-back student conflict weight (can be set by problem property Exams.BackToBackConflictWeight, or in the input xml file, property backToBackConflictWeight)
 int getBackToBackDistance()
          Back-to-back distance (used in ExamPlacement.getNrDistanceBackToBackConflicts(), can be set by problem property Exams.BackToBackDistance, or in the input xml file, property backToBackDistance)
 double getDirectConflictWeight()
          Direct student conflict weight (can be set by problem property Exams.DirectConflictWeight, or in the input xml file, property directConflictWeight)
 double getDistanceBackToBackConflictWeight()
          Distance back-to-back student conflict weight (can be set by problem property Exams.DistanceBackToBackConflictWeight, or in the input xml file, property distanceBackToBackConflictWeight)
 Vector getDistributionConstraints()
          Distribution constraints
 int getDistributionPenalty(boolean precise)
          Return total distribution penalty, i.e., the sum of ExamDistributionConstraint.getWeight() of all violated soft distribution constraints.
 double getDistributionWeight()
          A weight of violated distribution soft constraints (see ExamDistributionConstraint, can be set by problem property Exams.RoomDistributionWeight, or in the input xml file, property roomDistributionWeight)
 int getExamRotationPenalty(boolean precise)
          Return total exam rotation penalty, i.e., the sum of ExamPlacement.getRotationPenalty() of all assigned placements.
 double getExamRotationWeight()
          A weight for exam rotation penalty (used in ExamPlacement.getRotationPenalty() can be set by problem property Exams.RotationWeight, or in the input xml file, property examRotationWeight)
 Hashtable getExtendedInfo()
          Extended info table
 Hashtable getInfo()
          Info table
 double getInstructorBackToBackConflictWeight()
          Back-to-back instructor conflict weight (can be set by problem property Exams.InstructorBackToBackConflictWeight, or in the input xml file, property instructorBackToBackConflictWeight)
 double getInstructorDirectConflictWeight()
          Direct instructor conflict weight (can be set by problem property Exams.InstructorDirectConflictWeight, or in the input xml file, property instructorDirectConflictWeight)
 double getInstructorDistanceBackToBackConflictWeight()
          Distance back-to-back instructor conflict weight (can be set by problem property Exams.InstructorDistanceBackToBackConflictWeight, or in the input xml file, property instructorDistanceBackToBackConflictWeight)
 double getInstructorMoreThanTwoADayWeight()
          More than two exams a day instructor conflict weight (can be set by problem property Exams.InstructorMoreThanTwoADayWeight, or in the input xml file, property instructorMoreThanTwoADayWeight)
 Vector getInstructors()
          Problem instructors
 int getLargePenalty(boolean precise)
          Return total front load penalty, i.e., the sum of ExamPlacement.getLargePenalty() of all assigned placements.
 double getLargePeriod()
          Period index (number of periods multiplied by this number) for front load criteria for large exams Can by set by problem property Exams.LargePeriod, or in the input xml file, property largePeriod)
 int getLargeSize()
          An exam is considered large, if its size is greater or equal to this large size.
 double getLargeWeight()
          Weight of front load criteria, i.e., a weight for assigning a large exam after large period Can by set by problem property Exams.LargeWeight, or in the input xml file, property largeWeight)
 int getMaxRooms()
          Default maximum number of rooms (can be set by problem property Exams.MaxRooms, or in the input xml file, property maxRooms)
 double getMoreThanTwoADayWeight()
          More than two exams a day student conflict weight (can be set by problem property Exams.MoreThanTwoADayWeight, or in the input xml file, property moreThanTwoADayWeight)
 int getNrBackToBackConflicts(boolean precise)
          Return number of back-to-back student conflicts, i.e., the total number of cases where a student is enrolled into two exams that are scheduled at consecutive periods.
 int getNrDays()
          Number of days
 int getNrDirectConflicts(boolean precise)
          Return number of direct student conflicts, i.e., the total number of cases where a student is enrolled into two exams that are scheduled at the same period.
 int getNrDistanceBackToBackConflicts(boolean precise)
          Return number of distance back-to-back student conflicts, i.e., the total number of back-to-back student conflicts where the two exam take place in rooms that are too far a part (i.e., ExamPlacement.getDistance(ExamPlacement) is greater than getBackToBackDistance()).
 int getNrInstructorBackToBackConflicts(boolean precise)
          Return number of back-to-back instructor conflicts, i.e., the total number of cases where an instructor is enrolled into two exams that are scheduled at consecutive periods.
 int getNrInstructorDirectConflicts(boolean precise)
          Return number of direct instructor conflicts, i.e., the total number of cases where an instructor is enrolled into two exams that are scheduled at the same period.
 int getNrInstructorDistanceBackToBackConflicts(boolean precise)
          Return number of distance back-to-back instructor conflicts, i.e., the total number of back-to-back instructor conflicts where the two exam take place in rooms that are too far a part (i.e., ExamPlacement.getDistance(ExamPlacement) is greater than getBackToBackDistance()).
 int getNrInstructorMoreThanTwoADayConflicts(boolean precise)
          Return number of more than two exams a day instructor conflicts, i.e., the total number of cases where an instructor is enrolled into three exams that are scheduled at the same day (i.e., ExamPeriod.getDay() is the same).
 int getNrMoreThanTwoADayConflicts(boolean precise)
          Return number of more than two exams a day student conflicts, i.e., the total number of cases where a student is enrolled into three exams that are scheduled at the same day (i.e., ExamPeriod.getDay() is the same).
 int getNrPeriods()
          Number of periods
 double getNrRoomSplits(boolean precise)
          Count exam placements with a room split.
 ExamPeriod getPeriod(Long id)
          Period of given unique id
 int getPeriodIndexPenalty(boolean precise)
          Return total period index of all assigned placements.
 double getPeriodIndexWeight()
          A weight for period index, can be set by problem property Exams.PeriodIndexWeight, or in the input xml file, property periodWeight)
 int getPeriodPenalty(boolean precise)
          Return total period penalty, i.e., the sum of ExamPlacement.getPeriodPenalty() of all assigned placements.
 Vector getPeriods()
          List of periods, use addPeriod(Long, String, String, int, int) to add a period
 int getPeriodSizePenalty(boolean precise)
          Return total period size penalty, i.e., the sum of ExamPlacement.getPeriodPenalty() multiplied by Exam.getSize() of all assigned placements.
 double getPeriodSizeWeight()
          A weight for period penalty (used in ExamPlacement.getPeriodPenalty() multiplied by examination size Exam.getSize(), can be set by problem property Exams.PeriodSizeWeight, or in the input xml file, property periodWeight)
 double getPeriodWeight()
          A weight for period penalty (used in ExamPlacement.getPeriodPenalty(), can be set by problem property Exams.PeriodWeight, or in the input xml file, property periodWeight)
 int getPerturbationPenalty(boolean precise)
          Return total perturbation penalty, i.e., the sum of ExamPlacement.getPerturbationPenalty() of all assigned placements.
 double getPerturbationWeight()
          A weight of perturbations (see ExamPlacement.getPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a place different from the initial one.
 DataProperties getProperties()
          Problem properties
 int getRoomPenalty(boolean precise)
          Return total room (weight) penalty, i.e., the sum of ExamPlacement.getRoomPenalty() of all assigned placements.
 int getRoomPerturbationPenalty(boolean precise)
          Return total room perturbation penalty, i.e., the sum of ExamPlacement.getRoomPerturbationPenalty() of all assigned placements.
 double getRoomPerturbationWeight()
          A weight of room perturbations (see ExamPlacement.getRoomPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a room different from the initial one.
 Vector getRooms()
          Problem rooms
 int getRoomSizePenalty(boolean precise)
          Return total room size penalty, i.e., the sum of ExamPlacement.getRoomSizePenalty() of all assigned placements.
 double getRoomSizeWeight()
          A weight for room size penalty (used in ExamPlacement.getRoomSizePenalty(), can be set by problem property Exams.RoomSizeWeight, or in the input xml file, property roomSizeWeight)
 double getRoomSplitDistancePenalty(boolean precise)
          Return total room split distance penalty, i.e., the sum of ExamPlacement.getRoomSplitDistancePenalty() of all assigned placements.
 double getRoomSplitDistanceWeight()
          A weight for distance between two or more rooms into which an exam is split.
 int getRoomSplitPenalty(boolean precise)
          Return total room split penalty, i.e., the sum of ExamPlacement.getRoomSplitPenalty() of all assigned placements.
 double getRoomSplitWeight()
          A weight for room split penalty (used in ExamPlacement.getRoomSplitPenalty(), can be set by problem property Exams.RoomSplitWeight, or in the input xml file, property roomSplitWeight)
 double getRoomWeight()
          A weight for room penalty weight (used in ExamPlacement.getRoomPenalty(), can be set by problem property Exams.RoomPreferenceWeight, or in the input xml file, property roomPreferenceWeight)
 Vector getStudents()
          Problem students
 double[] getTotalMultiValue()
          Return weighted individual objective criteria.
 double getTotalValue()
          Objective function.
 void init()
          Initialization of the model
 boolean isDayBreakBackToBack()
          True when back-to-back student conflict is to be encountered when a student is enrolled into an exam that is on the last period of one day and another exam that is on the first period of the consecutive day.
 boolean isMPP()
           
 boolean load(org.dom4j.Document document)
          Load model (including its solution) from XML.
 boolean load(org.dom4j.Document document, Callback saveBest)
          Load model (including its solution) from XML.
 org.dom4j.Document save()
          Save model (including its solution) into XML.
 void setBackToBackConflictWeight(double backToBackConflictWeight)
          Back-to-back student conflict weight (can be set by problem property Exams.BackToBackConflictWeight, or in the input xml file, property backToBackConflictWeight)
 void setBackToBackDistance(int backToBackDistance)
          Back-to-back distance (used in ExamPlacement.getNrDistanceBackToBackConflicts(), can be set by problem property Exams.BackToBackDistance, or in the input xml file, property backToBackDistance)
 void setDayBreakBackToBack(boolean dayBreakBackToBack)
          True when back-to-back student conflict is to be encountered when a student is enrolled into an exam that is on the last period of one day and another exam that is on the first period of the consecutive day.
 void setDirectConflictWeight(double directConflictWeight)
          Direct student conflict weight (can be set by problem property Exams.DirectConflictWeight, or in the input xml file, property directConflictWeight)
 void setDistanceBackToBackConflictWeight(double distanceBackToBackConflictWeight)
          Distance back-to-back student conflict weight (can be set by problem property Exams.DistanceBackToBackConflictWeight, or in the input xml file, property distanceBackToBackConflictWeight)
 void setDistributionWeight(double distributionWeight)
          A weight of violated distribution soft constraints (see ExamDistributionConstraint, can be set by problem property Exams.RoomDistributionWeight, or in the input xml file, property roomDistributionWeight)
 void setExamRotationWeight(double examRotationWeight)
          A weight for period penalty (used in ExamPlacement.getRotationPenalty(), can be set by problem property Exams.RotationWeight, or in the input xml file, property examRotationWeight)
 void setInstructorBackToBackConflictWeight(double backToBackConflictWeight)
          Back-to-back instructor conflict weight (can be set by problem property Exams.InstructorBackToBackConflictWeight, or in the input xml file, property instructorBackToBackConflictWeight)
 void setInstructorDirectConflictWeight(double directConflictWeight)
          Direct instructor conflict weight (can be set by problem property Exams.InstructorDirectConflictWeight, or in the input xml file, property instructorDirectConflictWeight)
 void setInstructorDistanceBackToBackConflictWeight(double distanceBackToBackConflictWeight)
          Distance back-to-back instructor conflict weight (can be set by problem property Exams.InstructorDistanceBackToBackConflictWeight, or in the input xml file, property instructorDistanceBackToBackConflictWeight)
 void setInstructorMoreThanTwoADayWeight(double moreThanTwoADayWeight)
          More than two exams a day instructor conflict weight (can be set by problem property Exams.InstructorMoreThanTwoADayWeight, or in the input xml file, property instructorMoreThanTwoADayWeight)
 void setLargePeriod(double largePeriod)
          Period index (number of periods multiplied by this number) for front load criteria for large exams Can by set by problem property Exams.LargePeriod, or in the input xml file, property largePeriod)
 void setLargeSize(int largeSize)
          An exam is considered large, if its size is greater or equal to this large size.
 void setLargeWeight(double largeWeight)
          Weight of front load criteria, i.e., a weight for assigning a large exam after large period Can by set by problem property Exams.LargeWeight, or in the input xml file, property largeWeight)
 void setMaxRooms(int maxRooms)
          Default maximum number of rooms (can be set by problem property Exams.MaxRooms, or in the input xml file, property maxRooms)
 void setMoreThanTwoADayWeight(double moreThanTwoADayWeight)
          More than two exams a day student conflict weight (can be set by problem property Exams.MoreThanTwoADayWeight, or in the input xml file, property moreThanTwoADayWeight)
 void setPeriodIndexWeight(double periodIndexWeight)
          A weight for period index, can be set by problem property Exams.PeriodIndexWeight, or in the input xml file, property periodWeight)
 void setPeriodSizeWeight(double periodSizeWeight)
          A weight for period penalty (used in ExamPlacement.getPeriodPenalty() multiplied by examination size Exam.getSize(), can be set by problem property Exams.PeriodSizeWeight, or in the input xml file, property periodWeight)
 void setPeriodWeight(double periodWeight)
          A weight for period penalty (used in ExamPlacement.getPeriodPenalty(), can be set by problem property Exams.PeriodWeight, or in the input xml file, property periodWeight)
 void setPerturbationWeight(double perturbationWeight)
          A weight of perturbations (see ExamPlacement.getPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a place different from the initial one.
 void setRoomPerturbationWeight(double perturbationWeight)
          A weight of room perturbations (see ExamPlacement.getRoomPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a room different from the initial one.
 void setRoomSizeWeight(double roomSizeWeight)
          A weight for room size penalty (used in ExamPlacement.getRoomSizePenalty(), can be set by problem property Exams.RoomSizeWeight, or in the input xml file, property roomSizeWeight)
 void setRoomSplitDistanceWeight(double roomSplitDistanceWeight)
          A weight for distance between two or more rooms into which an exam is split.
 void setRoomSplitWeight(double roomSplitWeight)
          A weight for room split penalty (used in ExamPlacement.getRoomSplitPenalty(), can be set by problem property Exams.RoomSplitWeight, or in the input xml file, property roomSplitWeight)
 void setRoomWeight(double roomWeight)
          A weight for room penalty weight (used in ExamPlacement.getRoomPenalty(), can be set by problem property Exams.RoomWeight, or in the input xml file, property roomWeight)
 String toString()
          String representation -- returns a list of values of objective criteria
 
Methods inherited from class net.sf.cpsolver.ifs.model.Model
addConstraint, addGlobalConstraint, addModelListener, addVariable, afterUnassigned, assignedVariables, beforeAssigned, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, globalConstraints, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeConstraint, removeGlobalConstraint, removeModelListener, removeVariable, restoreBest, saveBest, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExamModel

public ExamModel(DataProperties properties)
Constructor

Parameters:
properties - problem properties
Method Detail

init

public void init()
Initialization of the model


getMaxRooms

public int getMaxRooms()
Default maximum number of rooms (can be set by problem property Exams.MaxRooms, or in the input xml file, property maxRooms)


setMaxRooms

public void setMaxRooms(int maxRooms)
Default maximum number of rooms (can be set by problem property Exams.MaxRooms, or in the input xml file, property maxRooms)


addPeriod

public ExamPeriod addPeriod(Long id,
                            String day,
                            String time,
                            int length,
                            int penalty)
Add a period

Parameters:
id - period unique identifier
day - day (e.g., 07/12/10)
time - (e.g., 8:00am-10:00am)
length - length of period in minutes
penalty - period penalty

getNrDays

public int getNrDays()
Number of days


getNrPeriods

public int getNrPeriods()
Number of periods


getPeriods

public Vector getPeriods()
List of periods, use addPeriod(Long, String, String, int, int) to add a period

Returns:
list of ExamPeriod

getPeriod

public ExamPeriod getPeriod(Long id)
Period of given unique id


getDirectConflictWeight

public double getDirectConflictWeight()
Direct student conflict weight (can be set by problem property Exams.DirectConflictWeight, or in the input xml file, property directConflictWeight)


setDirectConflictWeight

public void setDirectConflictWeight(double directConflictWeight)
Direct student conflict weight (can be set by problem property Exams.DirectConflictWeight, or in the input xml file, property directConflictWeight)


getBackToBackConflictWeight

public double getBackToBackConflictWeight()
Back-to-back student conflict weight (can be set by problem property Exams.BackToBackConflictWeight, or in the input xml file, property backToBackConflictWeight)


setBackToBackConflictWeight

public void setBackToBackConflictWeight(double backToBackConflictWeight)
Back-to-back student conflict weight (can be set by problem property Exams.BackToBackConflictWeight, or in the input xml file, property backToBackConflictWeight)


getDistanceBackToBackConflictWeight

public double getDistanceBackToBackConflictWeight()
Distance back-to-back student conflict weight (can be set by problem property Exams.DistanceBackToBackConflictWeight, or in the input xml file, property distanceBackToBackConflictWeight)


setDistanceBackToBackConflictWeight

public void setDistanceBackToBackConflictWeight(double distanceBackToBackConflictWeight)
Distance back-to-back student conflict weight (can be set by problem property Exams.DistanceBackToBackConflictWeight, or in the input xml file, property distanceBackToBackConflictWeight)


getMoreThanTwoADayWeight

public double getMoreThanTwoADayWeight()
More than two exams a day student conflict weight (can be set by problem property Exams.MoreThanTwoADayWeight, or in the input xml file, property moreThanTwoADayWeight)


setMoreThanTwoADayWeight

public void setMoreThanTwoADayWeight(double moreThanTwoADayWeight)
More than two exams a day student conflict weight (can be set by problem property Exams.MoreThanTwoADayWeight, or in the input xml file, property moreThanTwoADayWeight)


getInstructorDirectConflictWeight

public double getInstructorDirectConflictWeight()
Direct instructor conflict weight (can be set by problem property Exams.InstructorDirectConflictWeight, or in the input xml file, property instructorDirectConflictWeight)


setInstructorDirectConflictWeight

public void setInstructorDirectConflictWeight(double directConflictWeight)
Direct instructor conflict weight (can be set by problem property Exams.InstructorDirectConflictWeight, or in the input xml file, property instructorDirectConflictWeight)


getInstructorBackToBackConflictWeight

public double getInstructorBackToBackConflictWeight()
Back-to-back instructor conflict weight (can be set by problem property Exams.InstructorBackToBackConflictWeight, or in the input xml file, property instructorBackToBackConflictWeight)


setInstructorBackToBackConflictWeight

public void setInstructorBackToBackConflictWeight(double backToBackConflictWeight)
Back-to-back instructor conflict weight (can be set by problem property Exams.InstructorBackToBackConflictWeight, or in the input xml file, property instructorBackToBackConflictWeight)


getInstructorDistanceBackToBackConflictWeight

public double getInstructorDistanceBackToBackConflictWeight()
Distance back-to-back instructor conflict weight (can be set by problem property Exams.InstructorDistanceBackToBackConflictWeight, or in the input xml file, property instructorDistanceBackToBackConflictWeight)


setInstructorDistanceBackToBackConflictWeight

public void setInstructorDistanceBackToBackConflictWeight(double distanceBackToBackConflictWeight)
Distance back-to-back instructor conflict weight (can be set by problem property Exams.InstructorDistanceBackToBackConflictWeight, or in the input xml file, property instructorDistanceBackToBackConflictWeight)


getInstructorMoreThanTwoADayWeight

public double getInstructorMoreThanTwoADayWeight()
More than two exams a day instructor conflict weight (can be set by problem property Exams.InstructorMoreThanTwoADayWeight, or in the input xml file, property instructorMoreThanTwoADayWeight)


setInstructorMoreThanTwoADayWeight

public void setInstructorMoreThanTwoADayWeight(double moreThanTwoADayWeight)
More than two exams a day instructor conflict weight (can be set by problem property Exams.InstructorMoreThanTwoADayWeight, or in the input xml file, property instructorMoreThanTwoADayWeight)


isDayBreakBackToBack

public boolean isDayBreakBackToBack()
True when back-to-back student conflict is to be encountered when a student is enrolled into an exam that is on the last period of one day and another exam that is on the first period of the consecutive day. It can be set by problem property Exams.IsDayBreakBackToBack, or in the input xml file, property isDayBreakBackToBack)


setDayBreakBackToBack

public void setDayBreakBackToBack(boolean dayBreakBackToBack)
True when back-to-back student conflict is to be encountered when a student is enrolled into an exam that is on the last period of one day and another exam that is on the first period of the consecutive day. It can be set by problem property Exams.IsDayBreakBackToBack, or in the input xml file, property isDayBreakBackToBack)


getPeriodWeight

public double getPeriodWeight()
A weight for period penalty (used in ExamPlacement.getPeriodPenalty(), can be set by problem property Exams.PeriodWeight, or in the input xml file, property periodWeight)


setPeriodWeight

public void setPeriodWeight(double periodWeight)
A weight for period penalty (used in ExamPlacement.getPeriodPenalty(), can be set by problem property Exams.PeriodWeight, or in the input xml file, property periodWeight)


getPeriodSizeWeight

public double getPeriodSizeWeight()
A weight for period penalty (used in ExamPlacement.getPeriodPenalty() multiplied by examination size Exam.getSize(), can be set by problem property Exams.PeriodSizeWeight, or in the input xml file, property periodWeight)


setPeriodSizeWeight

public void setPeriodSizeWeight(double periodSizeWeight)
A weight for period penalty (used in ExamPlacement.getPeriodPenalty() multiplied by examination size Exam.getSize(), can be set by problem property Exams.PeriodSizeWeight, or in the input xml file, property periodWeight)


getPeriodIndexWeight

public double getPeriodIndexWeight()
A weight for period index, can be set by problem property Exams.PeriodIndexWeight, or in the input xml file, property periodWeight)


setPeriodIndexWeight

public void setPeriodIndexWeight(double periodIndexWeight)
A weight for period index, can be set by problem property Exams.PeriodIndexWeight, or in the input xml file, property periodWeight)


getExamRotationWeight

public double getExamRotationWeight()
A weight for exam rotation penalty (used in ExamPlacement.getRotationPenalty() can be set by problem property Exams.RotationWeight, or in the input xml file, property examRotationWeight)


setExamRotationWeight

public void setExamRotationWeight(double examRotationWeight)
A weight for period penalty (used in ExamPlacement.getRotationPenalty(), can be set by problem property Exams.RotationWeight, or in the input xml file, property examRotationWeight)


getRoomSizeWeight

public double getRoomSizeWeight()
A weight for room size penalty (used in ExamPlacement.getRoomSizePenalty(), can be set by problem property Exams.RoomSizeWeight, or in the input xml file, property roomSizeWeight)


setRoomSizeWeight

public void setRoomSizeWeight(double roomSizeWeight)
A weight for room size penalty (used in ExamPlacement.getRoomSizePenalty(), can be set by problem property Exams.RoomSizeWeight, or in the input xml file, property roomSizeWeight)


getRoomWeight

public double getRoomWeight()
A weight for room penalty weight (used in ExamPlacement.getRoomPenalty(), can be set by problem property Exams.RoomPreferenceWeight, or in the input xml file, property roomPreferenceWeight)


setRoomWeight

public void setRoomWeight(double roomWeight)
A weight for room penalty weight (used in ExamPlacement.getRoomPenalty(), can be set by problem property Exams.RoomWeight, or in the input xml file, property roomWeight)


getRoomSplitWeight

public double getRoomSplitWeight()
A weight for room split penalty (used in ExamPlacement.getRoomSplitPenalty(), can be set by problem property Exams.RoomSplitWeight, or in the input xml file, property roomSplitWeight)


setRoomSplitWeight

public void setRoomSplitWeight(double roomSplitWeight)
A weight for room split penalty (used in ExamPlacement.getRoomSplitPenalty(), can be set by problem property Exams.RoomSplitWeight, or in the input xml file, property roomSplitWeight)


getBackToBackDistance

public int getBackToBackDistance()
Back-to-back distance (used in ExamPlacement.getNrDistanceBackToBackConflicts(), can be set by problem property Exams.BackToBackDistance, or in the input xml file, property backToBackDistance)


setBackToBackDistance

public void setBackToBackDistance(int backToBackDistance)
Back-to-back distance (used in ExamPlacement.getNrDistanceBackToBackConflicts(), can be set by problem property Exams.BackToBackDistance, or in the input xml file, property backToBackDistance)


getDistributionWeight

public double getDistributionWeight()
A weight of violated distribution soft constraints (see ExamDistributionConstraint, can be set by problem property Exams.RoomDistributionWeight, or in the input xml file, property roomDistributionWeight)


setDistributionWeight

public void setDistributionWeight(double distributionWeight)
A weight of violated distribution soft constraints (see ExamDistributionConstraint, can be set by problem property Exams.RoomDistributionWeight, or in the input xml file, property roomDistributionWeight)


getPerturbationWeight

public double getPerturbationWeight()
A weight of perturbations (see ExamPlacement.getPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a place different from the initial one. Can by set by problem property Exams.PerturbationWeight, or in the input xml file, property perturbationWeight)


setPerturbationWeight

public void setPerturbationWeight(double perturbationWeight)
A weight of perturbations (see ExamPlacement.getPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a place different from the initial one. Can by set by problem property Exams.PerturbationWeight, or in the input xml file, property perturbationWeight)


getRoomPerturbationWeight

public double getRoomPerturbationWeight()
A weight of room perturbations (see ExamPlacement.getRoomPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a room different from the initial one. Can by set by problem property Exams.RoomPerturbationWeight, or in the input xml file, property perturbationWeight)


setRoomPerturbationWeight

public void setRoomPerturbationWeight(double perturbationWeight)
A weight of room perturbations (see ExamPlacement.getRoomPerturbationPenalty()), i.e., a penalty for an assignment of an exam to a room different from the initial one. Can by set by problem property Exams.RoomPerturbationWeight, or in the input xml file, property perturbationWeight)


getRoomSplitDistanceWeight

public double getRoomSplitDistanceWeight()
A weight for distance between two or more rooms into which an exam is split. Can by set by problem property Exams.RoomSplitDistanceWeight, or in the input xml file, property roomSplitDistanceWeight)


setRoomSplitDistanceWeight

public void setRoomSplitDistanceWeight(double roomSplitDistanceWeight)
A weight for distance between two or more rooms into which an exam is split. Can by set by problem property Exams.RoomSplitDistanceWeight, or in the input xml file, property roomSplitDistanceWeight)


getLargeSize

public int getLargeSize()
An exam is considered large, if its size is greater or equal to this large size. Value -1 means all exams are small. Can by set by problem property Exams.LargeSize, or in the input xml file, property largeSize)


setLargeSize

public void setLargeSize(int largeSize)
An exam is considered large, if its size is greater or equal to this large size. Value -1 means all exams are small. Can by set by problem property Exams.LargeSize, or in the input xml file, property largeSize)


getLargePeriod

public double getLargePeriod()
Period index (number of periods multiplied by this number) for front load criteria for large exams Can by set by problem property Exams.LargePeriod, or in the input xml file, property largePeriod)


setLargePeriod

public void setLargePeriod(double largePeriod)
Period index (number of periods multiplied by this number) for front load criteria for large exams Can by set by problem property Exams.LargePeriod, or in the input xml file, property largePeriod)


getLargeWeight

public double getLargeWeight()
Weight of front load criteria, i.e., a weight for assigning a large exam after large period Can by set by problem property Exams.LargeWeight, or in the input xml file, property largeWeight)


setLargeWeight

public void setLargeWeight(double largeWeight)
Weight of front load criteria, i.e., a weight for assigning a large exam after large period Can by set by problem property Exams.LargeWeight, or in the input xml file, property largeWeight)


beforeUnassigned

public void beforeUnassigned(long iteration,
                             Value value)
Called before a value is unassigned from its variable, optimization criteria are updated

Overrides:
beforeUnassigned in class Model

afterAssigned

public void afterAssigned(long iteration,
                          Value value)
Called after a value is assigned to its variable, optimization criteria are updated

Overrides:
afterAssigned in class Model

getTotalValue

public double getTotalValue()
Objective function. The objective function consists of the following criteria:

Overrides:
getTotalValue in class Model
Returns:
weighted sum of objective criteria

getTotalMultiValue

public double[] getTotalMultiValue()
Return weighted individual objective criteria. The objective function consists of the following criteria:

Returns:
an array of weighted objective criteria

toString

public String toString()
String representation -- returns a list of values of objective criteria

Overrides:
toString in class Model

getNrDirectConflicts

public int getNrDirectConflicts(boolean precise)
Return number of direct student conflicts, i.e., the total number of cases where a student is enrolled into two exams that are scheduled at the same period.

Parameters:
precise - if false, the cached value is used
Returns:
number of direct student conflicts

getNrBackToBackConflicts

public int getNrBackToBackConflicts(boolean precise)
Return number of back-to-back student conflicts, i.e., the total number of cases where a student is enrolled into two exams that are scheduled at consecutive periods. If isDayBreakBackToBack() is false, the last period of one day and the first period of the following day are not considered as consecutive periods.

Parameters:
precise - if false, the cached value is used
Returns:
number of back-to-back student conflicts

getNrDistanceBackToBackConflicts

public int getNrDistanceBackToBackConflicts(boolean precise)
Return number of distance back-to-back student conflicts, i.e., the total number of back-to-back student conflicts where the two exam take place in rooms that are too far a part (i.e., ExamPlacement.getDistance(ExamPlacement) is greater than getBackToBackDistance()).

Parameters:
precise - if false, the cached value is used
Returns:
number of distance back-to-back student conflicts

getNrMoreThanTwoADayConflicts

public int getNrMoreThanTwoADayConflicts(boolean precise)
Return number of more than two exams a day student conflicts, i.e., the total number of cases where a student is enrolled into three exams that are scheduled at the same day (i.e., ExamPeriod.getDay() is the same).

Parameters:
precise - if false, the cached value is used
Returns:
number of more than two exams a day student conflicts

getNrInstructorDirectConflicts

public int getNrInstructorDirectConflicts(boolean precise)
Return number of direct instructor conflicts, i.e., the total number of cases where an instructor is enrolled into two exams that are scheduled at the same period.

Parameters:
precise - if false, the cached value is used
Returns:
number of direct instructor conflicts

getNrInstructorBackToBackConflicts

public int getNrInstructorBackToBackConflicts(boolean precise)
Return number of back-to-back instructor conflicts, i.e., the total number of cases where an instructor is enrolled into two exams that are scheduled at consecutive periods. If isDayBreakBackToBack() is false, the last period of one day and the first period of the following day are not considered as consecutive periods.

Parameters:
precise - if false, the cached value is used
Returns:
number of back-to-back instructor conflicts

getNrInstructorDistanceBackToBackConflicts

public int getNrInstructorDistanceBackToBackConflicts(boolean precise)
Return number of distance back-to-back instructor conflicts, i.e., the total number of back-to-back instructor conflicts where the two exam take place in rooms that are too far a part (i.e., ExamPlacement.getDistance(ExamPlacement) is greater than getBackToBackDistance()).

Parameters:
precise - if false, the cached value is used
Returns:
number of distance back-to-back student conflicts

getNrInstructorMoreThanTwoADayConflicts

public int getNrInstructorMoreThanTwoADayConflicts(boolean precise)
Return number of more than two exams a day instructor conflicts, i.e., the total number of cases where an instructor is enrolled into three exams that are scheduled at the same day (i.e., ExamPeriod.getDay() is the same).

Parameters:
precise - if false, the cached value is used
Returns:
number of more than two exams a day student conflicts

getRoomSizePenalty

public int getRoomSizePenalty(boolean precise)
Return total room size penalty, i.e., the sum of ExamPlacement.getRoomSizePenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total room size penalty

getRoomSplitPenalty

public int getRoomSplitPenalty(boolean precise)
Return total room split penalty, i.e., the sum of ExamPlacement.getRoomSplitPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total room split penalty

getPeriodPenalty

public int getPeriodPenalty(boolean precise)
Return total period penalty, i.e., the sum of ExamPlacement.getPeriodPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getPeriodIndexPenalty

public int getPeriodIndexPenalty(boolean precise)
Return total period index of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getPeriodSizePenalty

public int getPeriodSizePenalty(boolean precise)
Return total period size penalty, i.e., the sum of ExamPlacement.getPeriodPenalty() multiplied by Exam.getSize() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getExamRotationPenalty

public int getExamRotationPenalty(boolean precise)
Return total exam rotation penalty, i.e., the sum of ExamPlacement.getRotationPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getRoomPenalty

public int getRoomPenalty(boolean precise)
Return total room (weight) penalty, i.e., the sum of ExamPlacement.getRoomPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total room penalty

getDistributionPenalty

public int getDistributionPenalty(boolean precise)
Return total distribution penalty, i.e., the sum of ExamDistributionConstraint.getWeight() of all violated soft distribution constraints.

Parameters:
precise - if false, the cached value is used
Returns:
total distribution penalty

getRoomSplitDistancePenalty

public double getRoomSplitDistancePenalty(boolean precise)
Return total room split distance penalty, i.e., the sum of ExamPlacement.getRoomSplitDistancePenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total room split distance penalty

getNrRoomSplits

public double getNrRoomSplits(boolean precise)
Count exam placements with a room split.

Parameters:
precise - if false, the cached value is used
Returns:
total number of exams that are assigned into two or more rooms

addDistributionPenalty

protected void addDistributionPenalty(int inc)
To be called by soft ExamDistributionConstraint when satisfaction changes.


getPerturbationPenalty

public int getPerturbationPenalty(boolean precise)
Return total perturbation penalty, i.e., the sum of ExamPlacement.getPerturbationPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getRoomPerturbationPenalty

public int getRoomPerturbationPenalty(boolean precise)
Return total room perturbation penalty, i.e., the sum of ExamPlacement.getRoomPerturbationPenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total room period penalty

getLargePenalty

public int getLargePenalty(boolean precise)
Return total front load penalty, i.e., the sum of ExamPlacement.getLargePenalty() of all assigned placements.

Parameters:
precise - if false, the cached value is used
Returns:
total period penalty

getInfo

public Hashtable getInfo()
Info table

Overrides:
getInfo in class Model

getExtendedInfo

public Hashtable getExtendedInfo()
Extended info table

Overrides:
getExtendedInfo in class Model

getProperties

public DataProperties getProperties()
Problem properties


getRooms

public Vector getRooms()
Problem rooms

Returns:
list of ExamRoom

getStudents

public Vector getStudents()
Problem students

Returns:
list of ExamStudent

getInstructors

public Vector getInstructors()
Problem instructors

Returns:
list of ExamInstructor

getDistributionConstraints

public Vector getDistributionConstraints()
Distribution constraints

Returns:
list of ExamDistributionConstraint

save

public org.dom4j.Document save()
Save model (including its solution) into XML.


load

public boolean load(org.dom4j.Document document)
Load model (including its solution) from XML.


load

public boolean load(org.dom4j.Document document,
                    Callback saveBest)
Load model (including its solution) from XML.


isMPP

public boolean isMPP()