public class ExamRoom extends ConstraintWithContext<Exam,ExamPlacement,ExamRoom.ExamRoomContext>
| Modifier and Type | Class and Description |
|---|---|
class |
ExamRoom.ExamRoomContext |
iConstraintListeners, iIdsMaxSize| Constructor and Description |
|---|
ExamRoom(ExamModel model,
long id,
String name,
int size,
int altSize,
Double coordX,
Double coordY)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPartition(ExamRoom room)
Add partition of this room.
|
void |
assigned(Assignment<Exam,ExamPlacement> assignment,
long iteration,
ExamPlacement p)
An exam was assigned, update room assignment table
|
static boolean |
checkParents(Collection<ExamRoomPlacement> roomsSoFar,
ExamRoomPlacement room)
Check that the room and its parent are not used at the same time
|
int |
compareTo(Constraint<Exam,ExamPlacement> o)
Compare two rooms (by unique id)
|
void |
computeConflicts(Assignment<Exam,ExamPlacement> assignment,
Exam exam,
ExamPeriod period,
Set<ExamPlacement> conflicts)
Compute conflicts if the given exam is assigned in this room and the given period
|
void |
computeConflicts(Assignment<Exam,ExamPlacement> assignment,
ExamPlacement p,
Set<ExamPlacement> conflicts)
Compute conflicts between the given assignment of an exam and all the
current assignments (of this room)
|
ExamRoom.ExamRoomContext |
createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)
Create a new assignment context for the given assignment.
|
boolean |
equals(Object o)
Checks two rooms for equality
|
int |
getAltSize()
Alternating seating capacity (to be used when
Exam.hasAltSeating() is true) |
Double |
getCoordX()
X coordinate
|
Double |
getCoordY()
Y coordinate
|
double |
getDistanceInMeters(ExamRoom other)
Distance between two rooms.
|
String |
getName()
Room name
|
ExamRoom |
getParentRoom()
If this room is a partition of some other room, returns the parent room (which is partitioned).
|
List<ExamRoom> |
getPartitions()
If this room is partitioned into multiple rooms, return room partitions
|
int |
getPenalty(ExamPeriod period)
Return room penalty for given period
|
int |
getPenalty(int period) |
List<ExamPlacement> |
getPlacements(Assignment<Exam,ExamPlacement> assignment,
ExamPeriod period)
Exams placed at the given period
|
ExamRoomSharing |
getRoomSharing() |
int |
getSize()
Normal seating capacity (to be used when
Exam.hasAltSeating() is
false) |
int |
hashCode()
Hash code
|
boolean |
hasName()
Room name
|
boolean |
inConflict(Assignment<Exam,ExamPlacement> assignment,
Exam exam,
ExamPeriod period)
Check for conflicts if the given exam is assigned in this room and the given period
|
boolean |
inConflict(Assignment<Exam,ExamPlacement> assignment,
ExamPlacement p)
Checks whether there is a conflict between the given assignment of an
exam and all the current assignments (of this room)
|
boolean |
isAvailable()
True if the room is available during at least one period,
|
boolean |
isAvailable(ExamPeriod period)
True if the room is available (for examination timetabling) during the
given period
|
boolean |
isAvailable(int period) |
boolean |
isConsistent(ExamPlacement p1,
ExamPlacement p2)
False if the given two assignments are using this room at the same period
|
boolean |
isHard()
Returns true if the constraint is hard.
|
void |
setAvailable(ExamPeriod period,
boolean available)
Set whether the room is available (for examination timetabling) during
the given period
|
void |
setAvailable(int period,
boolean available) |
void |
setHard(boolean hard) |
void |
setPenalty(ExamPeriod period,
int penalty)
Set room penalty for given period
|
void |
setPenalty(int period,
int penalty) |
String |
toString()
Room unique id
|
void |
unassigned(Assignment<Exam,ExamPlacement> assignment,
long iteration,
ExamPlacement p)
An exam was unassigned, update room assignment table
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModeladdConstraintListener, addVariable, assignedVariables, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, removeConstraintListener, removeVariable, variablespublic ExamRoom(ExamModel model, long id, String name, int size, int altSize, Double coordX, Double coordY)
model - examination timetabling modelid - unique idname - room namesize - room (normal) seating capacityaltSize - room alternating seating capacity (to be used when
Exam.hasAltSeating() is true)coordX - x coordinatecoordY - y coordinatepublic void setHard(boolean hard)
public boolean isHard()
ConstraintisHard in class Constraint<Exam,ExamPlacement>public double getDistanceInMeters(ExamRoom other)
DistanceMetricother - another roompublic int getSize()
Exam.hasAltSeating() is
false)public int getAltSize()
Exam.hasAltSeating() is true)public List<ExamPlacement> getPlacements(Assignment<Exam,ExamPlacement> assignment, ExamPeriod period)
assignment - current assignmentperiod - a periodpublic boolean isAvailable(ExamPeriod period)
period - a periodpublic boolean isAvailable(int period)
public boolean isAvailable()
public void setAvailable(ExamPeriod period, boolean available)
period - a periodavailable - true if an exam can be scheduled into this room at the given
period, false if otherwisepublic void setAvailable(int period, boolean available)
public int getPenalty(ExamPeriod period)
period - given periodpublic int getPenalty(int period)
public void setPenalty(ExamPeriod period, int penalty)
period - given periodpenalty - penalty for the given periodpublic void setPenalty(int period, int penalty)
public ExamRoomSharing getRoomSharing()
public void computeConflicts(Assignment<Exam,ExamPlacement> assignment, Exam exam, ExamPeriod period, Set<ExamPlacement> conflicts)
public boolean inConflict(Assignment<Exam,ExamPlacement> assignment, Exam exam, ExamPeriod period)
public void computeConflicts(Assignment<Exam,ExamPlacement> assignment, ExamPlacement p, Set<ExamPlacement> conflicts)
computeConflicts in class Constraint<Exam,ExamPlacement>assignment - current assignmentp - value to be assigned to its variableconflicts - resultant set of conflicting valuespublic boolean inConflict(Assignment<Exam,ExamPlacement> assignment, ExamPlacement p)
inConflict in class Constraint<Exam,ExamPlacement>assignment - current assignmentp - given valuepublic boolean isConsistent(ExamPlacement p1, ExamPlacement p2)
isConsistent in class Constraint<Exam,ExamPlacement>p1 - a valuep2 - a valuepublic void assigned(Assignment<Exam,ExamPlacement> assignment, long iteration, ExamPlacement p)
assigned in class ConstraintWithContext<Exam,ExamPlacement,ExamRoom.ExamRoomContext>assignment - current assignmentiteration - current iterationp - assigned valuepublic void unassigned(Assignment<Exam,ExamPlacement> assignment, long iteration, ExamPlacement p)
unassigned in class ConstraintWithContext<Exam,ExamPlacement,ExamRoom.ExamRoomContext>assignment - current assignmentiteration - current iterationp - unassigned valuepublic boolean equals(Object o)
equals in class Constraint<Exam,ExamPlacement>public int hashCode()
hashCode in class Constraint<Exam,ExamPlacement>public String getName()
getName in class Constraint<Exam,ExamPlacement>public boolean hasName()
public void addPartition(ExamRoom room)
room - room partitionpublic ExamRoom getParentRoom()
public List<ExamRoom> getPartitions()
public int compareTo(Constraint<Exam,ExamPlacement> o)
compareTo in interface Comparable<Constraint<Exam,ExamPlacement>>compareTo in class Constraint<Exam,ExamPlacement>public ExamRoom.ExamRoomContext createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)
HasAssignmentContextassignment - an assignment for which there needs to be an assignment contextpublic static boolean checkParents(Collection<ExamRoomPlacement> roomsSoFar, ExamRoomPlacement room)