public class ExamRoom extends ConstraintWithContext<Exam,ExamPlacement,ExamRoom.ExamRoomContext>
Modifier and Type | Class and Description |
---|---|
class |
ExamRoom.ExamRoomContext |
iConstraintListeners, iId
sMaxSize
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 |
assigned(Assignment<Exam,ExamPlacement> assignment,
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(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
|
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,
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(Assignment<Exam,ExamPlacement> assignment,
long iteration,
ExamPlacement p)
An exam was unassigned, update room assignment table
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModel
addConstraintListener, addVariable, assignedVariables, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, isHard, removeConstraintListener, removeVariable, variables
public 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 double getDistanceInMeters(ExamRoom other)
DistanceMetric
other
- 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, 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 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)
HasAssignmentContext
assignment
- an assignment for which there needs to be an assignment contextCopyright © 2017 UniTime LLC. All Rights Reserved.