|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.extension.Extension<Request,Enrollment>
net.sf.cpsolver.studentsct.extension.TimeOverlapsCounter
public class TimeOverlapsCounter
This extension computes time overlaps. Only sections that allow overlaps
(see Assignment.isAllowOverlap()
) can overlap. This class counts
how many overlapping slots there are so that this number can be minimized.
Nested Class Summary | |
---|---|
static class |
TimeOverlapsCounter.Conflict
A representation of a time overlapping conflict |
Field Summary | |
---|---|
static boolean |
sDebug
Debug flag |
Constructor Summary | |
---|---|
TimeOverlapsCounter(Solver<Request,Enrollment> solver,
DataProperties properties)
Constructor. |
Method Summary | |
---|---|
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. |
Methods inherited from class net.sf.cpsolver.ifs.extension.Extension |
---|
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, unregister, useValueExtra, useVariableExtra, variableAdded, variableRemoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean sDebug
Constructor Detail |
---|
public TimeOverlapsCounter(Solver<Request,Enrollment> solver, DataProperties properties)
StudentSectioningModel.setTimeOverlaps(TimeOverlapsCounter)
to
set the this instance to the model.
solver
- constraint solverproperties
- configurationMethod Detail |
---|
public boolean init(Solver<Request,Enrollment> solver)
init
in interface ModelListener<Request,Enrollment>
init
in class Extension<Request,Enrollment>
solver
- IFS solverpublic String toString()
toString
in class Object
public boolean inConflict(Assignment a1, Assignment a2)
a1
- an assignmenta2
- an assignment
public int share(Assignment a1, Assignment a2)
a1
- an assignmenta2
- an assignment
public int nrConflicts(Enrollment e1, Enrollment e2)
e1
- an enrollmente2
- an enrollment
public Set<TimeOverlapsCounter.Conflict> conflicts(Enrollment e1, Enrollment e2)
TimeOverlapsCounter.Conflict
objects) between
given (course) enrollments.
e1
- an enrollmente2
- an enrollment
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |