public class CourseRequest extends Request
Request.RequestContext, Request.RequestPriority
Modifier and Type | Field and Description |
---|---|
static boolean |
sSameTimePrecise |
sCacheValues
sMaxSize
Constructor and Description |
---|
CourseRequest(long id,
int priority,
boolean alternative,
Student student,
List<Course> courses,
boolean waitlist,
boolean critical,
Long timeStamp)
Constructor
|
CourseRequest(long id,
int priority,
boolean alternative,
Student student,
List<Course> courses,
boolean waitlist,
Long timeStamp)
Constructor
|
CourseRequest(long id,
int priority,
boolean alternative,
Student student,
List<Course> courses,
boolean waitlist,
Request.RequestPriority importance,
Long timeStamp)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addRequestGroup(RequestGroup group)
Add request group to this request.
|
void |
clearCache()
Clear cached min/max penalties and cached bound
|
void |
clearReservationCache()
Clear reservation information that was cached on this section
|
void |
clearRestrictionCache()
Clear restriction information that was cached on this request
|
List<Enrollment> |
computeEnrollments(Assignment<Request,Enrollment> assignment)
Return all possible enrollments.
|
List<Enrollment> |
computeRandomEnrollments(Assignment<Request,Enrollment> assignment,
int limitEachConfig)
Return a subset of all enrollments -- randomly select only up to
limitEachConfig enrollments of each config.
|
Enrollment |
createEnrollment(Assignment<Request,Enrollment> assignment,
Set<? extends SctAssignment> sections)
Create enrollment for the given list of sections.
|
Enrollment |
createEnrollment(Course course,
Set<? extends SctAssignment> sections,
Reservation reservation)
Create enrollment for the given list of sections.
|
Enrollment |
createEnrollment(Set<? extends SctAssignment> sections,
Reservation reservation)
Create enrollment for the given list of sections.
|
boolean |
equals(Object o) |
List<Enrollment> |
getAvaiableEnrollments(Assignment<Request,Enrollment> assignment)
Return all enrollments that are available
|
List<Enrollment> |
getAvaiableEnrollmentsSkipSameTime(Assignment<Request,Enrollment> assignment)
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(Assignment<Request,Enrollment> assignment)
Return all possible enrollments, but pick only the first section of
the sections with the same time (of each subpart,
Section
comparator is used). |
Enrollment |
getFixedValue() |
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) |
float |
getMinCredit()
Smallest credit provided by this request
|
double |
getMinPenalty()
Minimal penalty (minimum of
Offering.getMinPenalty() among
requested courses) |
String |
getName()
Request name: A for alternative, 1 + priority, (w) when wait-list, list of
course names
|
Set<RequestGroup> |
getRequestGroups()
Lists request groups of this request
|
Request.RequestPriority |
getRequestPriority()
Importance of the request.
|
Set<Choice> |
getRequiredChoices()
Required choices
|
List<Reservation> |
getReservations(Course course)
Get reservations for this course requests
|
List<Restriction> |
getRestrictions(Course course)
Get restrictions 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(Assignment<Request,Enrollment> assignment,
boolean availableOnly)
Return all enrollments of the first course that are selected (
isSelected(Section) is true) |
TreeSet<Reservation> |
getSortedReservations(Assignment<Request,Enrollment> assignment,
Course course)
Get reservations for this course requests ordered using
Reservation.compareTo(Assignment, Reservation) |
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 |
hasRestrictions(Course course)
Return true if there is a restriction for a course of this request
|
boolean |
hasSelection()
Return true if this request has any selection
|
boolean |
hasSelection(Section section)
Return true when the given section has a preference (i.e., there is a matching selection),
or when there is a section preference for a different configuration
|
boolean |
isAssigned(Assignment<Request,Enrollment> assignment)
Return true if request is assigned.
|
boolean |
isFixed() |
boolean |
isMPP()
Return true if this request can track MPP
|
boolean |
isNotAllowed(Course course,
Config config)
Return true when there are restrictions for a course of this course request and the given config does not meet any of them
|
boolean |
isNotAllowed(Course course,
Section section)
Return true when there are restrictions for a course of this course request and the given section does not meet any of them
|
boolean |
isNotAllowed(Enrollment e)
Return true when there are restrictions for a course of this course request and the given enrollment does not meet any of them
|
boolean |
isRequired(Section section)
Return true when the given section is required (i.e., its choice is among required choices, or there are no requirements)
|
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 |
removeRequestGroup(RequestGroup group)
Removed request group from this request.
|
void |
setCritical(boolean critical)
Deprecated.
|
void |
setFixedValue(Enrollment constant) |
void |
setRequestPriority(Request.RequestPriority priority) |
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() |
void |
variableAssigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment enrollment)
Assign given enrollment to this request.
|
void |
variableUnassigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment enrollment)
Unassign currently assigned enrollment from this request.
|
compareTo, createAssignmentContext, getId, getPriority, getStudent, getWeight, hashCode, isAlternative, isCritical, setPriority, setWeight, values
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModel
addContstraint, addVariableListener, assign, constraints, constraintVariables, getAssignment, getAssignment, getAssignments, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getIndex, getInitialAssignment, getLastIteration, getModel, getVariableListeners, hardConstraints, hasAssignment, hasAssignment, hasInitialAssignment, hasValues, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setAssignment, setBestAssignment, setExtra, setIndex, setInitialAssignment, setLastIteration, setValues, softConstraints, unassign, values
public static boolean sSameTimePrecise
public CourseRequest(long id, int priority, boolean alternative, Student student, List<Course> courses, boolean waitlist, boolean critical, 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)critical
- is the course request is critical for the student in order to move forward in their degreetimeStamp
- request time stamppublic CourseRequest(long id, int priority, boolean alternative, Student student, List<Course> courses, boolean waitlist, Request.RequestPriority importance, 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)importance
- request prioritytimeStamp
- request time stamppublic 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)timeStamp
- request time stamppublic List<Course> getCourses()
public Enrollment createEnrollment(Set<? extends SctAssignment> sections, Reservation reservation)
sections
- selected sectionsreservation
- selected reservationpublic Enrollment createEnrollment(Course course, Set<? extends SctAssignment> sections, Reservation reservation)
course
- selected coursesections
- selected sectionsreservation
- selected reservationpublic Enrollment createEnrollment(Assignment<Request,Enrollment> assignment, Set<? extends SctAssignment> sections)
assignment
- current assignment (to guess the reservation)sections
- selected sectionsprotected int getMaxDomainSize()
public List<Enrollment> computeEnrollments(Assignment<Request,Enrollment> assignment)
computeEnrollments
in class Request
assignment
- current assignmentpublic List<Enrollment> computeRandomEnrollments(Assignment<Request,Enrollment> assignment, int limitEachConfig)
assignment
- current assignmentlimitEachConfig
- maximal number of enrollments in each configurationpublic List<Enrollment> getAvaiableEnrollments(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic List<Enrollment> getSelectedEnrollments(Assignment<Request,Enrollment> assignment, boolean availableOnly)
isSelected(Section)
is true)assignment
- current assignmentavailableOnly
- pick only available sectionspublic List<Enrollment> getAvaiableEnrollmentsSkipSameTime(Assignment<Request,Enrollment> assignment)
Section
comparator is used)assignment
- current assignmentpublic List<Enrollment> getEnrollmentsSkipSameTime(Assignment<Request,Enrollment> assignment)
Section
comparator is used).assignment
- current assignmentpublic Set<Choice> getWaitlistedChoices()
public boolean isWaitlisted(Section section)
section
- given sectionpublic Set<Choice> getSelectedChoices()
public boolean isSelected(Section section)
section
- given sectionpublic boolean hasSelection(Section section)
section
- given sectionpublic Set<Choice> getRequiredChoices()
public boolean isRequired(Section section)
section
- given sectionpublic String getName()
getName
in class Variable<Request,Enrollment>
public boolean isWaitlist()
public void setWaitlist(boolean waitlist)
waitlist
- true if the request can be wait-listed@Deprecated public void setCritical(boolean critical)
critical
- true if the request is criticalpublic Long getTimeStamp()
public Course getCourse(long courseId)
courseId
- course offering idpublic Config getConfig(long configId)
configId
- instructional offering configuration unique idpublic Subpart getSubpart(long subpartId)
subpartId
- scheduling subpart unique idpublic Section getSection(long sectionId)
sectionId
- class unique idpublic double getMinPenalty()
Offering.getMinPenalty()
among
requested courses)public double getMaxPenalty()
Offering.getMaxPenalty()
among
requested courses)public void clearCache()
public double getBound()
public boolean isAssigned(Assignment<Request,Enrollment> assignment)
isAssigned
in class Request
assignment
- current assignmentpublic List<Reservation> getReservations(Course course)
course
- given coursepublic TreeSet<Reservation> getSortedReservations(Assignment<Request,Enrollment> assignment, Course course)
Reservation.compareTo(Assignment, Reservation)
course
- given coursepublic boolean hasReservations()
public void clearReservationCache()
public List<Restriction> getRestrictions(Course course)
course
- given coursepublic boolean hasRestrictions(Course course)
public boolean isNotAllowed(Course course, Config config)
public boolean isNotAllowed(Course course, Section section)
public boolean isNotAllowed(Enrollment e)
public void clearRestrictionCache()
public boolean isMPP()
public boolean hasSelection()
hasSelection
in class Request
public void addRequestGroup(RequestGroup group)
group
- request group to be addedpublic void removeRequestGroup(RequestGroup group)
group
- request group to be removedpublic Set<RequestGroup> getRequestGroups()
public void variableAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment enrollment)
Request
SctAssignment.assigned(Assignment, Enrollment)
on for all the assignments of the
enrollment.variableAssigned
in class Request
assignment
- current assignmentiteration
- current iterationenrollment
- assigned valuepublic void variableUnassigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment enrollment)
Request
SctAssignment.unassigned(Assignment, Enrollment)
on for all the
assignments of the current enrollment.variableUnassigned
in class Request
assignment
- current assignmentiteration
- current iterationenrollment
- unassigned valuepublic float getMinCredit()
Request
getMinCredit
in class Request
public Request.RequestPriority getRequestPriority()
Request
getRequestPriority
in class Request
public void setRequestPriority(Request.RequestPriority priority)
public boolean isFixed()
public Enrollment getFixedValue()
public void setFixedValue(Enrollment constant)