public class SectionLimit extends GlobalConstraint<Request,Enrollment>
Request.getWeight()
) enrolled into a section is below
the section's limit (see Section.getLimit()
).
Parameter | Type | Comment |
---|---|---|
SectionLimit.PreferDummyStudents | Boolean |
If true, requests of dummy (last-like) students are preferred to be selected as conflicting. |
iConstraintListeners, iId
Constructor and Description |
---|
SectionLimit(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 there is a section which limit
(computed by
getEnrollmentWeight(Assignment, Section, Request) )
exceeds the section limit. |
static double |
getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
Section section,
Request request)
Enrollment weight of a section if the given request is assigned.
|
static double |
getUnreservedSpace(Assignment<Request,Enrollment> assignment,
Section section,
Request request)
Remaining unreserved space in a section if the given request is assigned.
|
boolean |
inConflict(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
A given enrollment is conflicting, if there is a section which
limit(computed by
getEnrollmentWeight(Assignment, Section, Request) ) exceeds the
section 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 SectionLimit(DataProperties cfg)
cfg
- solver configurationpublic static double getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Section section, Request request)
assignment
- current assignmentsection
- a section that is of concernrequest
- a request of a student to be assigned containing the given
sectionpublic static double getUnreservedSpace(Assignment<Request,Enrollment> assignment, Section section, Request request)
assignment
- current assignmentsection
- a section 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, Section, Request)
)
exceeds the section 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, Section, Request)
) exceeds the
section limit.inConflict
in class Constraint<Request,Enrollment>
enrollment
- Enrollment
that is being consideredassignment
- current assignment