public class ExamRoom extends Constraint<Exam,ExamPlacement>
iAssignedVariables, iConstraintListeners, iId
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 |
afterAssigned(long iteration,
ExamPlacement p)
An exam was assigned, update room assignment table
|
void |
afterUnassigned(long iteration,
ExamPlacement p)
An exam was unassigned, update room assignment table
|
void |
assigned(long iteration,
ExamPlacement p)
An exam was assigned, update room assignment table
|
int |
compareTo(Constraint<Exam,ExamPlacement> o)
Compare two rooms (by unique id)
|
void |
computeConflicts(ExamPlacement p,
Set<ExamPlacement> conflicts)
Compute conflicts between the given assignment of an exam and all the
current assignments (of this room)
|
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
|
int |
getPenalty(ExamPeriod period)
Return room penalty for given period
|
int |
getPenalty(int period) |
ExamPlacement |
getPlacement(ExamPeriod period)
Deprecated.
If room sharing is allowed, this method only returns first exam. Use
getPlacements(ExamPeriod) instead. |
List<ExamPlacement> |
getPlacements(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(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
|
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 |
setPenalty(ExamPeriod period,
int penalty)
Set room penalty for given period
|
void |
setPenalty(int period,
int penalty) |
String |
toString()
Room unique id
|
void |
unassigned(long iteration,
ExamPlacement p)
An exam was unassigned, update room assignment table
|
addConstraintListener, addVariable, assignedVariables, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, isHard, removeConstraintListener, removeVariable, setModel, variables
public ExamRoom(ExamModel model, long id, String name, int size, int altSize, Double coordX, Double coordY)
model
- examination timetabling modelid
- unique idsize
- room (normal) seating capacityaltSize
- room alternating seating capacity (to be used when
Exam.hasAltSeating()
is true)coordX
- x coordinatecoordY
- y coordinatepublic double getDistanceInMeters(ExamRoom other)
DistanceMetric
other
- another roompublic int getSize()
Exam.hasAltSeating()
is
false)public int getAltSize()
Exam.hasAltSeating()
is true)@Deprecated public ExamPlacement getPlacement(ExamPeriod period)
getPlacements(ExamPeriod)
instead.period
- a periodpublic List<ExamPlacement> getPlacements(ExamPeriod period)
period
- 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)
public int getPenalty(int period)
public void setPenalty(ExamPeriod period, int penalty)
public void setPenalty(int period, int penalty)
public ExamRoomSharing getRoomSharing()
public void computeConflicts(ExamPlacement p, Set<ExamPlacement> conflicts)
computeConflicts
in class Constraint<Exam,ExamPlacement>
p
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic boolean inConflict(ExamPlacement p)
inConflict
in class Constraint<Exam,ExamPlacement>
public boolean isConsistent(ExamPlacement p1, ExamPlacement p2)
isConsistent
in class Constraint<Exam,ExamPlacement>
public void assigned(long iteration, ExamPlacement p)
assigned
in class Constraint<Exam,ExamPlacement>
public void afterAssigned(long iteration, ExamPlacement p)
public void unassigned(long iteration, ExamPlacement p)
unassigned
in class Constraint<Exam,ExamPlacement>
public void afterUnassigned(long iteration, ExamPlacement p)
public 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 int compareTo(Constraint<Exam,ExamPlacement> o)
compareTo
in interface Comparable<Constraint<Exam,ExamPlacement>>
compareTo
in class Constraint<Exam,ExamPlacement>