public class CourseLimit extends GlobalConstraint<Request,Enrollment>
Request.getWeight()
) enrolled into a course is below
the course's limit (see Course.getLimit()
).
Parameter | Type | Comment |
---|---|---|
CourseLimit.PreferDummyStudents | Boolean |
If true, requests of dummy (last-like) students are preferred to be selected as conflicting. |
iConstraintListeners, iId
Constructor and Description |
---|
CourseLimit(DataProperties cfg)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
computeConflicts(Assignment<Request,Enrollment> assignment,
Enrollment enrollment,
Set<Enrollment> conflicts)
A given enrollment is conflicting, if the course's enrollment
(computed by
getEnrollmentWeight(Assignment, Course, Request) )
exceeds the limit. |
static double |
getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
Course course,
Request request)
Enrollment weight of a course if the given request is assigned.
|
boolean |
inConflict(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
A given enrollment is conflicting, if the course's enrollment (computed by
getEnrollmentWeight(Assignment, Course, Request) ) exceeds the
limit. |
String |
toString() |
addVariable, assigned, assignedVariables, countAssignedVariables, removeVariable, unassigned, variables
addConstraintListener, compareTo, computeConflictsNoForwardCheck, constraintListeners, countVariables, equals, getDescription, getId, getModel, getName, hashCode, isConsistent, isHard, removeConstraintListener, setModel
public CourseLimit(DataProperties cfg)
cfg
- solver configurationpublic static double getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Course course, Request request)
assignment
- current assignmentcourse
- a course that is of concernrequest
- a request of a student to be assigned containing the given
sectionpublic void computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment, Set<Enrollment> conflicts)
getEnrollmentWeight(Assignment, Course, Request)
)
exceeds the limit. computeConflicts
in class Constraint<Request,Enrollment>
enrollment
- Enrollment
that is being consideredconflicts
- all computed conflicting requests are added into this setassignment
- current assignmentpublic boolean inConflict(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
getEnrollmentWeight(Assignment, Course, Request)
) exceeds the
limit.inConflict
in class Constraint<Request,Enrollment>
enrollment
- Enrollment
that is being consideredassignment
- current assignment