|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.model.Variable<Request,Enrollment>
net.sf.cpsolver.studentsct.model.Request
public abstract class Request
Representation of a request of a student for a course(s) or a free time. This
can be either CourseRequest
or FreeTimeRequest
. Each request
contains id, priority, weight, and a student. A request can be also marked as
alternative.
For each student, all non-alternative requests should be satisfied (an
enrollment is assigned to a request). If not, an alternative request can be
assigned instead of a non-alternative course request. In the case when only
one of two requests can be assigned, the one with the lowest priority is
preferred.
Field Summary | |
---|---|
static boolean |
sCacheValues
True means that method values() will cache its results. |
Fields inherited from class net.sf.cpsolver.ifs.model.Variable |
---|
iValue |
Constructor Summary | |
---|---|
Request(long id,
int priority,
boolean alternative,
Student student)
Constructor |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean sCacheValues
values()
will cache its results.
Constructor Detail |
---|
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 belongsMethod Detail |
---|
public 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>
public boolean equals(Object o)
equals
in class Variable<Request,Enrollment>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |