public class SameLinkConstraint extends ConstraintWithContext<TeachingRequest.Variable,TeachingAssignment,SameLinkConstraint.Context>
SameInstructorConstraint, but it is possible to assign multiple instructors
to the teaching requests of the same link. It is, however, prohibited (or discouraged) for an instructor to teach
have teaching requests than the ones of the link. In prohibited / discouraged variant, each request must / should get
a different instructor.| Modifier and Type | Class and Description |
|---|---|
class |
SameLinkConstraint.Context
Same Link Constraint Context.
|
iConstraintListenerssMaxSize| Constructor and Description |
|---|
SameLinkConstraint(Long id,
String name,
String preference)
Constructor
|
| 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.
|
SameLinkConstraint.Context |
createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
Create a new assignment context for the given assignment.
|
Long |
getConstraintId()
Constraint id that was given in the constructor.
|
int |
getCurrentPreference(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
Current constraint preference (if soft)
|
int |
getCurrentPreference(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value)
Current constraint preference (if soft)
|
String |
getName()
Constraint's name -- for printing purposes
|
int |
getPreference()
Constraint preference that was provided in the constructor
|
boolean |
isHard()
Returns true if the constraint is hard.
|
boolean |
isProhibited()
Is prohibited?
|
boolean |
isRequired()
Is required?
|
String |
toString() |
assigned, getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, setModel, unassignedaddConstraintListener, addVariable, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, inConflict, isConsistent, removeConstraintListener, removeVariable, variablespublic SameLinkConstraint(Long id, String name, String preference)
id - constraint idname - link namepreference - constraint preference (R for required, etc.)public Long getConstraintId()
public String getName()
ConstraintgetName in class Constraint<TeachingRequest.Variable,TeachingAssignment>public boolean isRequired()
public boolean isProhibited()
public int getPreference()
public boolean isHard()
ConstraintisHard in class Constraint<TeachingRequest.Variable,TeachingAssignment>public void computeConflicts(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value, Set<TeachingAssignment> conflicts)
ConstraintcomputeConflicts in class Constraint<TeachingRequest.Variable,TeachingAssignment>assignment - current assignmentvalue - value to be assigned to its variableconflicts - resultant set of conflicting valuespublic int getCurrentPreference(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value)
assignment - current assignmentvalue - proposed changepublic int getCurrentPreference(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
assignment - current assignmentpublic SameLinkConstraint.Context createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
HasAssignmentContextassignment - an assignment for which there needs to be an assignment context