public class SameInstructorConstraint extends ConstraintWithContext<TeachingRequest.Variable,TeachingAssignment,SameInstructorConstraint.Context>
| Modifier and Type | Class and Description |
|---|---|
class |
SameInstructorConstraint.Context
Same Instructor Constraint Context.
|
iConstraintListenerssMaxSize| Constructor and Description |
|---|
SameInstructorConstraint(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.
|
SameInstructorConstraint.Context |
createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
Create a new assignment context for the given assignment.
|
Long |
getConstraintId()
Constraint id that was provided 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?
|
boolean |
isSatisfiedPair(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment a1,
TeachingAssignment a2)
Does a pair of teaching assignments satisfy this constraint?
|
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 SameInstructorConstraint(Long id, String name, String preference)
id - constraint idname - constrain (link) namepreference - preference (R for required, P for prohibited, 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 boolean isSatisfiedPair(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment a1, TeachingAssignment a2)
assignment - current assignmenta1 - first teaching assignmenta2 - second teaching assignmentpublic 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 SameInstructorConstraint.Context createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
HasAssignmentContextassignment - an assignment for which there needs to be an assignment context