|
||||||||||
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.DistanceConflict
public class DistanceConflict
This extension computes student distant conflicts. Two sections that are
attended by the same student are considered in a distance conflict if they
are back-to-back taught in locations that are two far away. This means that
the (walking) distance in minutes between the two classes are longer than
the break time of the earlier class. See DistanceMetric
for more details.
TimeLocation
,
Nested Class Summary | |
---|---|
static class |
DistanceConflict.Conflict
A representation of a distance conflict |
Field Summary | |
---|---|
static boolean |
sDebug
Debug flag |
Constructor Summary | |
---|---|
DistanceConflict(DistanceMetric metrics,
DataProperties properties)
Alternative constructor (for online student sectioning) |
|
DistanceConflict(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<DistanceConflict.Conflict> |
allConflicts(Enrollment enrollment)
The set of all conflicts ( DistanceConflict.Conflict objects) of the given
enrollment and other enrollments that are assignmed 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 |
checkAllConflicts()
Checks the counter counting all conflicts |
Set<DistanceConflict.Conflict> |
computeAllConflicts()
Compute a set of all distance conflicts ( DistanceConflict.Conflict objects). |
Set<DistanceConflict.Conflict> |
conflicts(Enrollment e1)
Return a set of distance conflicts ( DistanceConflict.Conflict objects) of a
(course) enrollment. |
Set<DistanceConflict.Conflict> |
conflicts(Enrollment e1,
Enrollment e2)
Return a set of distance conflicts ( DistanceConflict.Conflict objects) between
given (course) enrollments. |
int |
countTotalNrConflicts()
Compute the actual number of all distance conflicts. |
Set<DistanceConflict.Conflict> |
getAllConflicts()
Return a set of all distance conflicts ( DistanceConflict.Conflict objects). |
protected int |
getDistanceInMinutes(Placement p1,
Placement p2)
|
protected int |
getDistanceInMinutes(RoomLocation r1,
RoomLocation r2)
|
DistanceMetric |
getDistanceMetric()
|
int |
getTotalNrConflicts()
Actual number of all distance conflicts |
boolean |
inConflict(Section s1,
Section s2)
Return true if the given two sections are in distance conflict. |
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 assignmed to the same student. |
int |
nrConflicts(Enrollment e1)
Return number of distance conflict of a (course) enrollment. |
int |
nrConflicts(Enrollment e1,
Enrollment e2)
Return number of distance conflicts that are between two enrollments. |
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 |
Methods inherited from interface net.sf.cpsolver.ifs.model.ModelListener |
---|
beforeUnassigned, constraintAdded, constraintRemoved, variableAdded, variableRemoved |
Field Detail |
---|
public static boolean sDebug
Constructor Detail |
---|
public DistanceConflict(Solver<Request,Enrollment> solver, DataProperties properties)
StudentSectioningModel.setDistanceConflict(DistanceConflict)
to
set the this instance to the model.
solver
- constraint solverproperties
- configurationpublic DistanceConflict(DistanceMetric metrics, DataProperties properties)
metrics
- distance metricsproperties
- 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 DistanceMetric getDistanceMetric()
protected int getDistanceInMinutes(RoomLocation r1, RoomLocation r2)
protected int getDistanceInMinutes(Placement p1, Placement p2)
public boolean inConflict(Section s1, Section s2)
s1
- a sections2
- a section
public int nrConflicts(Enrollment e1)
e1
- an enrollment
public int nrConflicts(Enrollment e1, Enrollment e2)
e1
- an enrollmente2
- an enrollment
public Set<DistanceConflict.Conflict> conflicts(Enrollment e1)
DistanceConflict.Conflict
objects) of a
(course) enrollment.
e1
- an enrollment
public Set<DistanceConflict.Conflict> conflicts(Enrollment e1, Enrollment e2)
DistanceConflict.Conflict
objects) between
given (course) enrollments.
e1
- an enrollmente2
- an enrollment
public int nrAllConflicts(Enrollment enrollment)
public Set<DistanceConflict.Conflict> allConflicts(Enrollment enrollment)
DistanceConflict.Conflict
objects) of the given
enrollment and other enrollments that are assignmed to the same student.
public void assigned(long iteration, Enrollment value)
getTotalNrConflicts()
.
public void unassigned(long iteration, Enrollment value)
getTotalNrConflicts()
.
public void checkAllConflicts()
public int getTotalNrConflicts()
public int countTotalNrConflicts()
getTotalNrConflicts()
.
public Set<DistanceConflict.Conflict> computeAllConflicts()
DistanceConflict.Conflict
objects).
public Set<DistanceConflict.Conflict> getAllConflicts()
DistanceConflict.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 |