|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cpsolver.ifs.extension.Extension 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. The allowed distance is provided by method
getAllowedDistance(TimeLocation)
.
TimeLocation
,
Nested Class Summary | |
---|---|
class |
DistanceConflict.Conflict
A representation of a distance conflict |
Field Summary | |
---|---|
static boolean |
sDebug
Debug flag |
Constructor Summary | |
---|---|
DistanceConflict(Solver solver,
DataProperties properties)
Constructor. |
Method Summary | |
---|---|
void |
afterAssigned(long iteration,
Value value)
Called after a value is assigned to a variable. |
void |
afterUnassigned(long iteration,
Value value)
Called after a value is unassigned from a variable. |
HashSet |
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,
Value value)
Called when a value is assigned to a variable. |
double |
avg(double w1,
double w2)
Quadratic average of two weights. |
void |
beforeAssigned(long iteration,
Value value)
Called before a value is assigned to a variable. |
HashSet |
computeAllConflicts()
Compute a set of all distance conflicts ( DistanceConflict.Conflict objects). |
HashSet |
conflicts(Enrollment e1)
Return a set of distance conflicts ( DistanceConflict.Conflict objects) of a (course) enrollment. |
HashSet |
conflicts(Enrollment e1,
Enrollment e2)
Return a set of distance conflicts ( DistanceConflict.Conflict objects) between given (course) enrollments. |
double |
countTotalNrConflicts()
Compute the actual number of all distance conflicts. |
double |
getAllowedDistance(TimeLocation time)
Allowed distance for the course that follows the given time assignment. |
double |
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 solver)
Initialize extension |
double |
nrAllConflicts(Enrollment enrollment)
Total sum of all conflict of the given enrollment and other enrollments that are assignmed to the same student. |
double |
nrConflicts(Enrollment e1)
Return number of distance conflict of a (course) enrollment. |
double |
nrConflicts(Enrollment e1,
Enrollment e2)
Return number of distance conflicts that are between two enrollments. |
String |
toString()
|
void |
unassigned(long iteration,
Value 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 solver, DataProperties properties)
StudentSectioningModel.setDistanceConflict(DistanceConflict)
to
set the this instance to the model.
solver
- constraint solverproperties
- configurationMethod Detail |
---|
public boolean init(Solver solver)
init
in interface ModelListener
init
in class Extension
solver
- IFS solverpublic String toString()
toString
in class Object
public boolean inConflict(Section s1, Section s2)
s1
- a sections2
- a section
public double nrConflicts(Enrollment e1)
Request.getWeight()
).
e1
- an enrollment
public double nrConflicts(Enrollment e1, Enrollment e2)
avg(double, double)
) of the requests'
weight (see Request.getWeight()
).
e1
- an enrollmente2
- an enrollment
public HashSet conflicts(Enrollment e1)
DistanceConflict.Conflict
objects) of a (course) enrollment.
e1
- an enrollment
public HashSet conflicts(Enrollment e1, Enrollment e2)
DistanceConflict.Conflict
objects) between given (course) enrollments.
e1
- an enrollmente2
- an enrollment
public double getAllowedDistance(TimeLocation time)
time
- a time assignment of the first of two sections that are back-to-back
public double nrAllConflicts(Enrollment enrollment)
public HashSet 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, Value value)
getTotalNrConflicts()
.
public void unassigned(long iteration, Value value)
getTotalNrConflicts()
.
public double getTotalNrConflicts()
public double countTotalNrConflicts()
getTotalNrConflicts()
.
public HashSet computeAllConflicts()
DistanceConflict.Conflict
objects).
public double avg(double w1, double w2)
public void beforeAssigned(long iteration, Value value)
beforeAssigned
in interface ModelListener
beforeAssigned
in class Extension
iteration
- current iterationvalue
- value to be assignedpublic void afterAssigned(long iteration, Value value)
afterAssigned
in interface ModelListener
afterAssigned
in class Extension
iteration
- current iterationvalue
- value to be assignedpublic void afterUnassigned(long iteration, Value value)
afterUnassigned
in interface ModelListener
afterUnassigned
in class Extension
iteration
- current iterationvalue
- value to be unassigned
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |