public class CourseRequest extends Request
Modifier and Type | Field and Description |
---|---|
static boolean |
sSameTimePrecise |
sCacheValues
Constructor and Description |
---|
CourseRequest(long id,
int priority,
boolean alternative,
Student student,
List<Course> courses,
boolean waitlist,
Long timeStamp)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear cached min/max penalties and cached bound
|
void |
clearReservationCache()
Clear reservation information that was cached on this section
|
List<Enrollment> |
computeEnrollments()
Return all possible enrollments.
|
List<Enrollment> |
computeRandomEnrollments(int limitEachConfig)
Return a subset of all enrollments -- randomly select only up to
limitEachConfig enrollments of each config.
|
Enrollment |
createEnrollment(Set<? extends Assignment> sections)
Create enrollment for the given list of sections.
|
Enrollment |
createEnrollment(Set<? extends Assignment> sections,
Reservation reservation)
Create enrollment for the given list of sections.
|
boolean |
equals(Object o) |
List<Enrollment> |
getAvaiableEnrollments()
Return all enrollments that are available
|
List<Enrollment> |
getAvaiableEnrollmentsSkipSameTime()
Return all enrollments that are available, pick only the first section of
the sections with the same time (of each subpart,
Section
comparator is used) |
double |
getBound()
Estimated bound for this request -- it estimates the smallest value among
all possible enrollments
|
Config |
getConfig(long configId)
Return configuration of the requested courses with the given id
|
Course |
getCourse(long courseId)
Return course of the requested courses with the given id
|
List<Course> |
getCourses()
List of requested courses (in the correct order -- first is the requested
course, second is the first alternative, etc.)
|
List<Enrollment> |
getEnrollmentsSkipSameTime()
Return all possible enrollments.
|
protected int |
getMaxDomainSize()
Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit.
|
double |
getMaxPenalty()
Maximal penalty (maximum of
Offering.getMaxPenalty() among
requested courses) |
double |
getMinPenalty()
Minimal penalty (minimum of
Offering.getMinPenalty() among
requested courses) |
String |
getName()
Request name: A for alternative, 1 + priority, (w) when waitlist, list of
course names
|
List<Reservation> |
getReservations(Course course)
Get reservations for this course requests
|
Section |
getSection(long sectionId)
Return section of the requested courses with the given id
|
Set<Choice> |
getSelectedChoices()
Selected choices
|
List<Enrollment> |
getSelectedEnrollments(boolean availableOnly)
Return all enrollments that are selected (
isSelected(Section) is true) |
Subpart |
getSubpart(long subpartId)
Return subpart of the requested courses with the given id
|
Long |
getTimeStamp()
Time stamp of the request
|
Set<Choice> |
getWaitlistedChoices()
Wait-listed choices
|
boolean |
hasReservations()
Return true if there is a reservation for a course of this request
|
boolean |
isAssigned()
Return true if request is assigned.
|
boolean |
isSelected(Section section)
Return true when the given section is selected (i.e., its choice is among
selected choices)
|
boolean |
isWaitlist()
True if the student can be put on a wait-list (no alternative course
request will be given instead)
|
boolean |
isWaitlisted(Section section)
Return true when the given section is wait-listed (i.e., its choice is
among wait-listed choices)
|
void |
setWaitlist(boolean waitlist)
True if the student can be put on a wait-list (no alternative course
request will be given instead)
|
String |
toString() |
assign, compareTo, getId, getPriority, getStudent, getWeight, hashCode, isAlternative, setPriority, setWeight, unassign, values
addContstraint, addVariableListener, constraints, constraintVariables, countAssignments, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getVariableListeners, hardConstraints, hasAssignment, hasInitialAssignment, hasValues, lastAssignmentIteration, lastUnassignmentIteration, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints
public static boolean sSameTimePrecise
public CourseRequest(long id, int priority, boolean alternative, Student student, List<Course> courses, boolean waitlist, Long timeStamp)
id
- request unique idpriority
- request priorityalternative
- true if the request is alternative (alternative request can be
assigned instead of a non-alternative course requests, if it
is left unassigned)student
- appropriate studentcourses
- list of requested courses (in the correct order -- first is
the requested course, second is the first alternative, etc.)waitlist
- time stamp of the request if the student can be put on a wait-list (no alternative
course request will be given instead)public List<Course> getCourses()
public Enrollment createEnrollment(Set<? extends Assignment> sections, Reservation reservation)
public Enrollment createEnrollment(Set<? extends Assignment> sections)
protected int getMaxDomainSize()
public List<Enrollment> computeEnrollments()
computeEnrollments
in class Request
public List<Enrollment> computeRandomEnrollments(int limitEachConfig)
public List<Enrollment> getAvaiableEnrollments()
public List<Enrollment> getSelectedEnrollments(boolean availableOnly)
isSelected(Section)
is true)availableOnly
- pick only available sectionspublic List<Enrollment> getAvaiableEnrollmentsSkipSameTime()
Section
comparator is used)public List<Enrollment> getEnrollmentsSkipSameTime()
public Set<Choice> getWaitlistedChoices()
public boolean isWaitlisted(Section section)
public Set<Choice> getSelectedChoices()
public boolean isSelected(Section section)
public String getName()
getName
in class Variable<Request,Enrollment>
public boolean isWaitlist()
public void setWaitlist(boolean waitlist)
public Long getTimeStamp()
public Course getCourse(long courseId)
public Config getConfig(long configId)
public Subpart getSubpart(long subpartId)
public Section getSection(long sectionId)
public double getMinPenalty()
Offering.getMinPenalty()
among
requested courses)public double getMaxPenalty()
Offering.getMaxPenalty()
among
requested courses)public void clearCache()
public double getBound()
public boolean isAssigned()
isAssigned
in class Request
public List<Reservation> getReservations(Course course)
public boolean hasReservations()
public void clearReservationCache()