public class DistanceConflict.DistanceConflictContext extends Object implements AssignmentConstraintContext<Request,Enrollment>
Constructor and Description |
---|
DistanceConflictContext(Assignment<Request,Enrollment> assignment) |
DistanceConflictContext(DistanceConflict.DistanceConflictContext parent) |
Modifier and Type | Method and Description |
---|---|
void |
afterAssigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment value)
Called after a value is assigned to a variable.
|
void |
afterUnassigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment value)
Called after a value is unassigned from a variable.
|
void |
assigned(Assignment<Request,Enrollment> assignment,
Enrollment value)
Called when a value is assigned to a variable.
|
void |
beforeAssigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment value)
Called before a value is assigned to a variable.
|
Set<DistanceConflict.Conflict> |
getAllConflicts()
Return a set of all distance conflicts (
DistanceConflict.Conflict objects). |
int |
getTotalNrConflicts()
Actual number of all distance conflicts
|
int |
getTotalNrShortConflicts()
Actual number of all distance conflicts of students that need short distances
|
void |
checkAllConflicts(Assignment<Request,Enrollment> assignment)
Checks the counter counting all conflicts
|
int |
nrAllConflicts(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
Total sum of all conflict of the given enrollment and other enrollments
that are assigned to the same student.
|
void |
unassigned(Assignment<Request,Enrollment> assignment,
Enrollment value)
Called when a value is unassigned from a variable.
|
public DistanceConflictContext(Assignment<Request,Enrollment> assignment)
public DistanceConflictContext(DistanceConflict.DistanceConflictContext parent)
public void beforeAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
assignment
- current assignmentiteration
- current iterationvalue
- value to be assignedpublic void afterAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
assignment
- current assignmentiteration
- current iterationvalue
- value that was assignedpublic void afterUnassigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
assignment
- current assignmentiteration
- current iterationvalue
- value to be unassignedpublic void assigned(Assignment<Request,Enrollment> assignment, Enrollment value)
DistanceConflict.getTotalNrConflicts(Assignment)
.assigned
in interface AssignmentConstraintContext<Request,Enrollment>
assignment
- current assignment (with which this context is associated)value
- assigned valuepublic void unassigned(Assignment<Request,Enrollment> assignment, Enrollment value)
DistanceConflict.getTotalNrConflicts(Assignment)
.unassigned
in interface AssignmentConstraintContext<Request,Enrollment>
assignment
- current assignment (with which this context is associated)value
- unassigned valuepublic void checkAllConflicts(Assignment<Request,Enrollment> assignment)
assignment
- current assignmentpublic int getTotalNrConflicts()
public int getTotalNrShortConflicts()
public Set<DistanceConflict.Conflict> getAllConflicts()
DistanceConflict.Conflict
objects).public int nrAllConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
assignment
- current assignmentenrollment
- given enrollment