public class DependentCourses extends GlobalConstraint<Request,Enrollment>
Course.getParent()
), the student cannot get the dependent
course without also having the parent course assigned.iConstraintListeners, iId
Constructor and Description |
---|
DependentCourses() |
Modifier and Type | Method and Description |
---|---|
boolean |
canLeaveUnassigned(Student student,
LinkedSections.EnrollmentAssignment assignment,
Request parentRequest)
A special check for the branch-and-bound routine (such as
BranchBoundSelection ) which
constructs a full schedule for a student. |
void |
computeConflicts(Assignment<Request,Enrollment> assignment,
Enrollment value,
Set<Enrollment> conflicts)
The only method which has to be implemented by any constraint.
|
boolean |
inConflict(Assignment<Request,Enrollment> assignment,
Enrollment value)
Conflict check.
|
boolean |
isPartialScheduleInConflict(Student student,
LinkedSections.EnrollmentAssignment assignment,
int index)
A special check for the branch-and-bound routine (such as
BranchBoundSelection ) which
constructs a full schedule for a student. |
addVariable, assigned, assignedVariables, countAssignedVariables, getName, removeVariable, toString, unassigned, variables
addConstraintListener, compareTo, computeConflictsNoForwardCheck, constraintListeners, countVariables, equals, getDescription, getId, getModel, hashCode, isConsistent, isHard, removeConstraintListener, setModel
public DependentCourses()
public void computeConflicts(Assignment<Request,Enrollment> assignment, Enrollment value, Set<Enrollment> conflicts)
Constraint
computeConflicts
in class Constraint<Request,Enrollment>
assignment
- current assignmentvalue
- value to be assigned to its variableconflicts
- resultant set of conflicting valuespublic boolean inConflict(Assignment<Request,Enrollment> assignment, Enrollment value)
inConflict
in class Constraint<Request,Enrollment>
assignment
- current assignmentvalue
- given valuepublic boolean isPartialScheduleInConflict(Student student, LinkedSections.EnrollmentAssignment assignment, int index)
BranchBoundSelection
) which
constructs a full schedule for a student.
There is a conflict when there is a dependent course assigned within the already constructed
schedule (up to the given index) and the already constructed schedule also contains the parent
course but it is not assigned.student
- a studentassignment
- current assigned up to the given indexindex
- index of the variable that is being assignedpublic boolean canLeaveUnassigned(Student student, LinkedSections.EnrollmentAssignment assignment, Request parentRequest)
BranchBoundSelection
) which
constructs a full schedule for a student.
The parent request cannot be left unassigned if it contains a parent course for any of the already
assigned dependent course.student
- a studentassignment
- current assigned up to the given indexparentRequest
- parent request (that is being checked if it can be left unassigned)