public class TimeOverlapsCounter extends Extension<Request,Enrollment>
Assignment.isAllowOverlap()) can overlap. This class counts
how many overlapping slots there are so that this number can be minimized.
| Modifier and Type | Class and Description |
|---|---|
static class |
TimeOverlapsCounter.Conflict
A representation of a time overlapping conflict
|
| Modifier and Type | Field and Description |
|---|---|
static boolean |
sDebug
Debug flag
|
| Constructor and Description |
|---|
TimeOverlapsCounter(Solver<Request,Enrollment> solver,
DataProperties properties)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterAssigned(long iteration,
Enrollment value)
Called after a value is assigned to a variable.
|
void |
afterUnassigned(long iteration,
Enrollment value)
Called after a value is unassigned from a variable.
|
Set<TimeOverlapsCounter.Conflict> |
allConflicts(Enrollment enrollment)
The set of all conflicts (
TimeOverlapsCounter.Conflict objects) of the given
enrollment and other enrollments that are assigned to the same student. |
void |
assigned(long iteration,
Enrollment value)
Called when a value is assigned to a variable.
|
void |
beforeAssigned(long iteration,
Enrollment value)
Called before a value is assigned to a variable.
|
void |
checkTotalNrConflicts() |
Set<TimeOverlapsCounter.Conflict> |
computeAllConflicts()
Compute a set of all time overlapping conflicts (
TimeOverlapsCounter.Conflict objects). |
Set<TimeOverlapsCounter.Conflict> |
conflicts(Enrollment e1,
Enrollment e2)
Return a set of time overlapping conflicts (
TimeOverlapsCounter.Conflict objects) between
given (course) enrollments. |
int |
countTotalNrConflicts()
Compute the actual number of all time overlapping conflicts.
|
Set<TimeOverlapsCounter.Conflict> |
freeTimeConflicts(Enrollment enrollment)
Return a set of free time conflict of the given enrollment.
|
Set<TimeOverlapsCounter.Conflict> |
getAllConflicts()
Return a set of all time overlapping conflicts (
TimeOverlapsCounter.Conflict objects). |
int |
getTotalNrConflicts()
Actual number of all time overlapping conflicts
|
boolean |
inConflict(Assignment a1,
Assignment a2)
Return true if the given two assignments are overlapping.
|
boolean |
init(Solver<Request,Enrollment> solver)
Initialize extension
|
int |
nrAllConflicts(Enrollment enrollment)
Total sum of all conflict of the given enrollment and other enrollments
that are assigned to the same student.
|
int |
nrConflicts(Enrollment e1,
Enrollment e2)
Return number of time overlapping conflicts that are between two enrollments.
|
int |
nrFreeTimeConflicts(Enrollment enrollment)
Total sum of all free time conflict of the given enrollment.
|
int |
share(Assignment a1,
Assignment a2)
If the two sections are overlapping, return the number of slots of the overlap.
|
String |
toString() |
void |
unassigned(long iteration,
Enrollment value)
Called when a value is unassigned from a variable.
|
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, unregister, useValueExtra, useVariableExtra, variableAdded, variableRemovedpublic static boolean sDebug
public TimeOverlapsCounter(Solver<Request,Enrollment> solver, DataProperties properties)
StudentSectioningModel.setTimeOverlaps(TimeOverlapsCounter) to
set the this instance to the model.solver - constraint solverproperties - configurationpublic boolean init(Solver<Request,Enrollment> solver)
init in interface ModelListener<Request,Enrollment>init in class Extension<Request,Enrollment>solver - IFS solverpublic boolean inConflict(Assignment a1, Assignment a2)
a1 - an assignmenta2 - an assignmentpublic int share(Assignment a1, Assignment a2)
a1 - an assignmenta2 - an assignmentpublic int nrConflicts(Enrollment e1, Enrollment e2)
e1 - an enrollmente2 - an enrollmentpublic Set<TimeOverlapsCounter.Conflict> conflicts(Enrollment e1, Enrollment e2)
TimeOverlapsCounter.Conflict objects) between
given (course) enrollments.e1 - an enrollmente2 - an enrollmentpublic int nrAllConflicts(Enrollment enrollment)
public int nrFreeTimeConflicts(Enrollment enrollment)
public Set<TimeOverlapsCounter.Conflict> freeTimeConflicts(Enrollment enrollment)
public Set<TimeOverlapsCounter.Conflict> allConflicts(Enrollment enrollment)
TimeOverlapsCounter.Conflict objects) of the given
enrollment and other enrollments that are assigned to the same student.public void assigned(long iteration, Enrollment value)
getTotalNrConflicts().public void unassigned(long iteration, Enrollment value)
getTotalNrConflicts().public int getTotalNrConflicts()
public void checkTotalNrConflicts()
public int countTotalNrConflicts()
getTotalNrConflicts().public Set<TimeOverlapsCounter.Conflict> computeAllConflicts()
TimeOverlapsCounter.Conflict objects).public Set<TimeOverlapsCounter.Conflict> getAllConflicts()
TimeOverlapsCounter.Conflict objects).public void beforeAssigned(long iteration, Enrollment value)
beforeAssigned in interface ModelListener<Request,Enrollment>beforeAssigned in class Extension<Request,Enrollment>iteration - current iterationvalue - value to be assignedpublic void afterAssigned(long iteration, Enrollment value)
afterAssigned in interface ModelListener<Request,Enrollment>afterAssigned in class Extension<Request,Enrollment>iteration - current iterationvalue - value to be assignedpublic void afterUnassigned(long iteration, Enrollment value)
afterUnassigned in interface ModelListener<Request,Enrollment>afterUnassigned in class Extension<Request,Enrollment>iteration - current iterationvalue - value to be unassigned