public class GroupConstraint extends GlobalConstraint<TeachingRequest.Variable,TeachingAssignment>
GroupConstraint.ConstraintType
for the list, and the appropriate GroupConstraint.ConstraintType
or FlexibleConstraint
constraint for their description.
Because the instructor - class assignments are dynamic, the constraints are implemented by a single group constraint.Modifier and Type | Class and Description |
---|---|
static class |
GroupConstraint.Block
Block of sections that go one after the other without any gap.
|
static interface |
GroupConstraint.Check
Group constraint check interface
|
static interface |
GroupConstraint.ConstraintCreator<P>
Factory class for group constraints with parameters
|
static class |
GroupConstraint.ConstraintType
Distribution types and their implementation
|
static interface |
GroupConstraint.ConstraintTypeInterface
Interface for a distribution constraint type, including its implementation
|
static class |
GroupConstraint.Distribution
Wrapper class representing one distribution preference set on an instructor.
|
static class |
GroupConstraint.PairCheck
Group constraint check interface for constraints that can be computed on individual class pairs.
|
static class |
GroupConstraint.ParametrizedConstraintType<P>
Distribution constraint with parameters.
|
static class |
GroupConstraint.SimpleCheck
Simplified group constraint check interface for constraints that can be computed on individual class pairs.
|
static class |
GroupConstraint.SimpleTimeCheck
Simplified group constraint check interface for time-only constraints that can be computed on individual class pairs.
|
iConstraintListeners, iId
Constructor and Description |
---|
GroupConstraint() |
Modifier and Type | Method and Description |
---|---|
void |
computeConflicts(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value,
Set<TeachingAssignment> conflicts)
The only method which has to be implemented by any constraint.
|
protected static List<GroupConstraint.Block> |
getBlocks(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
Instructor instructor,
int dayCode,
Set<TeachingAssignment> conflicts,
TeachingRequest.Variable variable,
TeachingAssignment value,
BitSet week,
int maxBreakBetweenBTB)
Return blocks for an instructor, meeting the provided parameters.
|
static GroupConstraint.ConstraintTypeInterface |
getConstraintType(String reference,
String name)
Create a constraint type from the provided reference.
|
String |
getName()
Constraint's name -- for printing purposes
|
protected static Set<org.cpsolver.instructor.constraints.GroupConstraint.TeachingAssignmentSection> |
getRelevantPlacements(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
Instructor instructor,
int dayCode,
Set<TeachingAssignment> conflicts,
TeachingRequest.Variable variable,
TeachingAssignment value,
BitSet week)
Return teaching assignment + section combinations for the given instructor, considering the selected value and the provided conflicts.
|
protected static boolean |
isCorectDayAndWeek(TeachingAssignment value,
int dayCode,
BitSet week)
Check if the given assignment has a section on the given days of the week and weeks.
|
protected static boolean |
isCorectDayOfWeek(TeachingAssignment value,
int dayCode)
Check if the given assignment has a section on the given days of the week.
|
protected static List<GroupConstraint.Block> |
mergeToBlocks(Collection<org.cpsolver.instructor.constraints.GroupConstraint.TeachingAssignmentSection> sorted,
int maxBreakBetweenBTB)
Merge sorted teaching assignment + section combinations into block.
|
protected static boolean |
shareWeeksAndDay(TimeLocation t,
BitSet week,
int dayCode)
Returns true if the time overlaps with the provided week date pattern and days of the week.
|
String |
toString() |
addVariable, assigned, assignedVariables, countAssignedVariables, removeVariable, unassigned, variables
addConstraintListener, compareTo, computeConflictsNoForwardCheck, constraintListeners, countVariables, equals, getDescription, getId, getModel, hashCode, inConflict, isConsistent, isHard, removeConstraintListener, setModel
public GroupConstraint()
public void computeConflicts(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value, Set<TeachingAssignment> conflicts)
Constraint
computeConflicts
in class Constraint<TeachingRequest.Variable,TeachingAssignment>
assignment
- current assignmentvalue
- value to be assigned to its variableconflicts
- resultant set of conflicting valuespublic String getName()
Constraint
getName
in class Constraint<TeachingRequest.Variable,TeachingAssignment>
public static GroupConstraint.ConstraintTypeInterface getConstraintType(String reference, String name)
protected static boolean shareWeeksAndDay(TimeLocation t, BitSet week, int dayCode)
protected static Set<org.cpsolver.instructor.constraints.GroupConstraint.TeachingAssignmentSection> getRelevantPlacements(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, Instructor instructor, int dayCode, Set<TeachingAssignment> conflicts, TeachingRequest.Variable variable, TeachingAssignment value, BitSet week)
protected static List<GroupConstraint.Block> mergeToBlocks(Collection<org.cpsolver.instructor.constraints.GroupConstraint.TeachingAssignmentSection> sorted, int maxBreakBetweenBTB)
protected static List<GroupConstraint.Block> getBlocks(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, Instructor instructor, int dayCode, Set<TeachingAssignment> conflicts, TeachingRequest.Variable variable, TeachingAssignment value, BitSet week, int maxBreakBetweenBTB)
GroupConstraint#getRelevantPlacements(Assignment, Instructor, int, Set, Variable, TeachingAssignment, BitSet)
and mergeToBlocks(Collection, int)
.protected static boolean isCorectDayOfWeek(TeachingAssignment value, int dayCode)
protected static boolean isCorectDayAndWeek(TeachingAssignment value, int dayCode, BitSet week)