public abstract class Request extends VariableWithContext<Request,Enrollment,Request.RequestContext>
CourseRequest
or FreeTimeRequest
. Each request
contains id, priority, weight, and a student. A request can be also marked as
alternative. Modifier and Type | Class and Description |
---|---|
class |
Request.RequestContext |
static class |
Request.RequestPriority
Importance of the request for the student to progress towards his/her degree.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
sCacheValues
True means that method
Variable.values() will cache its results. |
sMaxSize
Constructor and Description |
---|
Request(long id,
int priority,
boolean alternative,
Student student)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Request r)
Compare to requests, non-alternative requests go first, otherwise use
priority (a request with lower priority goes first)
|
abstract List<Enrollment> |
computeEnrollments(Assignment<Request,Enrollment> assignment)
Compute available enrollments
|
Request.RequestContext |
createAssignmentContext(Assignment<Request,Enrollment> assignment)
Create a new assignment context for the given assignment.
|
boolean |
equals(Object o) |
abstract double |
getBound()
Get bound, i.e., the value of the best possible enrollment
|
long |
getId()
Request id
|
abstract float |
getMinCredit()
Smallest credit provided by this request
|
int |
getPriority()
Request priority -- if there is a choice, request with lower priority is
more preferred to be assigned
|
abstract Request.RequestPriority |
getRequestPriority()
Importance of the request.
|
Student |
getStudent()
Student to which this request belongs
|
double |
getWeight()
Request weight, set by default to 1.0, defines the amount of space which
will be taken in the section by this request.
|
int |
hashCode() |
boolean |
hasSelection()
Return true if this request has any selection
|
boolean |
isAlternative()
True, if the request is alternative (alternative request can be assigned
instead of a non-alternative course requests, if it is left unassigned)
|
boolean |
isAssigned(Assignment<Request,Enrollment> assignment)
Return true if request is assigned.
|
boolean |
isCritical()
Deprecated.
|
boolean |
isMPP()
Return true if this request can track MPP
|
void |
setPriority(int priority)
Set request priority
|
void |
setWeight(double weight)
Set request weight.
|
List<Enrollment> |
values(Assignment<Request,Enrollment> assignment)
Domain of this variable -- list of available enrollments.
|
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.
|
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModel
addContstraint, addVariableListener, assign, constraints, constraintVariables, getAssignment, getAssignment, getAssignments, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getIndex, getInitialAssignment, getLastIteration, getModel, getName, getVariableListeners, hardConstraints, hasAssignment, hasAssignment, hasInitialAssignment, hasValues, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setAssignment, setBestAssignment, setExtra, setIndex, setInitialAssignment, setLastIteration, setValues, softConstraints, toString, unassign, values
public static boolean sCacheValues
Variable.values()
will cache its results.public Request(long id, int priority, boolean alternative, Student student)
id
- course/free time request unique idpriority
- request priority -- if there is a choice, request with lower
priority is more preferred to be assignedalternative
- true if the request is alternative (alternative request can be
assigned instead of a non-alternative course requests, if it
is left unassigned)student
- student to which this request belongspublic long getId()
getId
in class Variable<Request,Enrollment>
public int getPriority()
public void setPriority(int priority)
priority
- request prioritypublic boolean isAlternative()
public Student getStudent()
public int compareTo(Request r)
compareTo
in interface Comparable<Request>
compareTo
in class Variable<Request,Enrollment>
public abstract List<Enrollment> computeEnrollments(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic List<Enrollment> values(Assignment<Request,Enrollment> assignment)
computeEnrollments(Assignment)
is used.values
in class Variable<Request,Enrollment>
assignment
- current assignment (if the domain is dependent on the current assignment)public void variableAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment enrollment)
SctAssignment.assigned(Assignment, Enrollment)
on for all the assignments of the
enrollment.variableAssigned
in class Variable<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationenrollment
- assigned valuepublic void variableUnassigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment enrollment)
SctAssignment.unassigned(Assignment, Enrollment)
on for all the
assignments of the current enrollment.variableUnassigned
in class Variable<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationenrollment
- unassigned valuepublic abstract double getBound()
public double getWeight()
public void setWeight(double weight)
weight
- request weightpublic boolean isAssigned(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic int hashCode()
hashCode
in class Variable<Request,Enrollment>
public Request.RequestContext createAssignmentContext(Assignment<Request,Enrollment> assignment)
HasAssignmentContext
assignment
- an assignment for which there needs to be an assignment contextpublic boolean isMPP()
public boolean hasSelection()
public abstract float getMinCredit()
@Deprecated public boolean isCritical()
public abstract Request.RequestPriority getRequestPriority()