public abstract class Request extends Variable<Request,Enrollment>
CourseRequest
or FreeTimeRequest
. Each request
contains id, priority, weight, and a student. A request can be also marked as
alternative. Modifier and Type | Field and Description |
---|---|
static boolean |
sCacheValues
True means that method
values() will cache its results. |
Constructor and Description |
---|
Request(long id,
int priority,
boolean alternative,
Student student)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
assign(long iteration,
Enrollment enrollment)
Assign given enrollment to this request.
|
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()
Compute available enrollments
|
boolean |
equals(Object o) |
abstract double |
getBound()
Get bound, i.e., the value of the best possible enrollment
|
long |
getId()
Request id
|
int |
getPriority()
Request priority -- if there is a choice, request with lower priority is
more preferred to be assigned
|
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 |
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()
Return true if request is assigned.
|
void |
setPriority(int priority)
Set request priority
|
void |
setWeight(double weight)
Set request weight.
|
void |
unassign(long iteration)
Unassign currently assigned enrollment from this request.
|
List<Enrollment> |
values()
Domain of this variable -- list of available enrollments.
|
addContstraint, addVariableListener, constraints, constraintVariables, countAssignments, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getName, getVariableListeners, hardConstraints, hasAssignment, hasInitialAssignment, hasValues, lastAssignmentIteration, lastUnassignmentIteration, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints, toString
public static boolean sCacheValues
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)
public 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()
public List<Enrollment> values()
computeEnrollments()
is used.values
in class Variable<Request,Enrollment>
public void assign(long iteration, Enrollment enrollment)
Assignment.assigned(Enrollment)
on for all the assignments of the
enrollment.assign
in class Variable<Request,Enrollment>
iteration
- current iterationenrollment
- the value to be assignedpublic void unassign(long iteration)
Assignment.unassigned(Enrollment)
on for all the
assignments of the current enrollment.unassign
in class Variable<Request,Enrollment>
iteration
- current iterationpublic abstract double getBound()
public double getWeight()
public void setWeight(double weight)
public boolean isAssigned()
public int hashCode()
hashCode
in class Variable<Request,Enrollment>