public class ExamModel extends Model<Exam,ExamPlacement>
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. PeriodPenalty
of all assigned exams, weighted by
Exams.PeriodWeight).
RoomSizePenalty
of all assigned exams, weighted by
Exams.RoomSizeWeight).
RoomSplitPenalty
of all assigned exams, weighted
by Exams.RoomSplitWeight).
RoomPenalty
of all assigned exams, weighted by
Exams.RoomWeight).
ExamDistributionConstraint.getWeight()
of all soft distribution
constraints that are not satisfied, i.e.,
ExamDistributionConstraint.isSatisfied()
= false; weighted by
Exams.DistributionWeight).
iAssignedVariables, iPerturbVariables, iUnassignedVariables, sDoubleFormat, sPercentageFormat, sTimeFormat
Constructor and Description |
---|
ExamModel(DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
ExamPeriod |
addPeriod(Long id,
String day,
String time,
int length,
int penalty)
Add a period
|
void |
afterAssigned(long iteration,
ExamPlacement placement)
Called after a value is assigned to its variable, optimization criteria
are updated
|
void |
beforeUnassigned(long iteration,
ExamPlacement placement)
Called before a value is unassigned from its variable, optimization
criteria are updated
|
double |
getBackToBackDistance()
Back-to-back distance, can be set by
problem property Exams.BackToBackDistance, or in the input xml file,
property backToBackDistance)
|
DistanceMetric |
getDistanceMetric() |
List<ExamDistributionConstraint> |
getDistributionConstraints()
Distribution constraints
|
Map<String,String> |
getExtendedInfo()
Extended info table
|
List<ExamInstructor> |
getInstructors()
Problem instructors
|
int |
getMaxRooms()
Default maximum number of rooms (can be set by problem property
Exams.MaxRooms, or in the input xml file, property maxRooms)
|
int |
getNrDays()
Number of days
|
int |
getNrPeriods()
Number of periods
|
ExamPeriod |
getPeriod(Long id)
Period of given unique id
|
List<ExamPeriod> |
getPeriods()
List of periods, use
addPeriod(Long, String, String, int, int) to add a
period |
DataProperties |
getProperties()
Problem properties
|
List<ExamRoom> |
getRooms()
Problem rooms
|
ExamRoomSharing |
getRoomSharing()
Return examination room sharing model
|
List<ExamStudent> |
getStudents()
Problem students
|
double[] |
getTotalMultiValue()
Return weighted individual objective criteria.
|
double |
getTotalValue()
Objective function.
|
boolean |
hasRoomSharing()
True if there is an examination sharing model
|
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 |
load(Document document)
Load model (including its solution) from XML.
|
boolean |
load(Document document,
Callback saveBest)
Load model (including its solution) from XML.
|
Document |
save()
Save model (including its solution) into XML.
|
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 |
setRoomSharing(ExamRoomSharing sharing)
Set examination sharing model
|
String |
toString()
String representation -- returns a list of values of objective criteria
|
addConstraint, addCriterion, addGlobalConstraint, addModelListener, addVariable, afterUnassigned, assignedVariables, beforeAssigned, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getCriteria, getCriterion, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, globalConstraints, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, removeVariable, restoreBest, restoreBest, saveBest, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue, weaken
public ExamModel(DataProperties properties)
properties
- problem propertiespublic DistanceMetric getDistanceMetric()
public boolean hasRoomSharing()
public ExamRoomSharing getRoomSharing()
public void setRoomSharing(ExamRoomSharing sharing)
public void init()
public int getMaxRooms()
public void setMaxRooms(int maxRooms)
public ExamPeriod addPeriod(Long id, String day, String time, int length, int penalty)
id
- period unique identifierday
- day (e.g., 07/12/10)time
- (e.g., 8:00am-10:00am)length
- length of period in minutespenalty
- period penaltypublic int getNrDays()
public int getNrPeriods()
public List<ExamPeriod> getPeriods()
addPeriod(Long, String, String, int, int)
to add a
periodExamPeriod
public ExamPeriod getPeriod(Long id)
public boolean isDayBreakBackToBack()
public double getBackToBackDistance()
public void beforeUnassigned(long iteration, ExamPlacement placement)
beforeUnassigned
in class Model<Exam,ExamPlacement>
public void afterAssigned(long iteration, ExamPlacement placement)
afterAssigned
in class Model<Exam,ExamPlacement>
public double getTotalValue()
getTotalValue
in class Model<Exam,ExamPlacement>
public double[] getTotalMultiValue()
public String toString()
toString
in class Model<Exam,ExamPlacement>
public Map<String,String> getExtendedInfo()
getExtendedInfo
in class Model<Exam,ExamPlacement>
public DataProperties getProperties()
public List<ExamStudent> getStudents()
ExamStudent
public List<ExamInstructor> getInstructors()
ExamInstructor
public List<ExamDistributionConstraint> getDistributionConstraints()
ExamDistributionConstraint