public class StudentQuality extends ExtensionWithContext<Request,Enrollment,StudentQuality.StudentQualityContext> implements ModelListener<Request,Enrollment>, CanInheritContext<Request,Enrollment,StudentQuality.StudentQualityContext>, InfoProvider<Request,Enrollment>
TimeOverlapsCounter
and DistanceConflict
extensions.
Besides of time and distance conflicts, it also counts cases when a student
has a lunch break conflict, travel time during the day, it can prefer
or discourage student class back-to-back and cases when a student has more than
a given number of hours between the first and the last class on a day.
See StudentQuality.Type
for more details.
Modifier and Type | Class and Description |
---|---|
class |
StudentQuality.Conflict
A representation of a time overlapping conflict
|
static class |
StudentQuality.Context
Context holding parameters and distance cache.
|
static class |
StudentQuality.FreeTimes
Free times of a student
|
static class |
StudentQuality.Nothing
Empty iterator
|
static class |
StudentQuality.Online
Online (or not-online) classes of an enrollment
|
static interface |
StudentQuality.Quality
Schedule quality interface
|
static class |
StudentQuality.SingleTimeIterable
Early/late time
|
class |
StudentQuality.StudentQualityContext
Assignment context
|
static class |
StudentQuality.Type
Measured student qualities
|
static class |
StudentQuality.Unavailabilities
Unavailabilities of a student
|
static class |
StudentQuality.WeightType
Weighting types
|
sMaxSize
Constructor and Description |
---|
StudentQuality(DistanceMetric metrics,
DataProperties properties)
Constructor
|
StudentQuality(Solver<Request,Enrollment> solver,
DataProperties properties)
Constructor
|
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
|
Set<StudentQuality.Conflict> |
allConflicts(Assignment<Request,Enrollment> assignment,
Enrollment enrollment)
All conflicts of the any type for the enrollment (including conflicts with other enrollments of the student)
|
void |
beforeAssigned(Assignment<Request,Enrollment> assignment,
long iteration,
Enrollment value)
Called before a value is assigned to a variable
|
void |
checkTotalPenalty(Assignment<Request,Enrollment> assignment)
Re-check total penalization for the given assignment
|
void |
checkTotalPenalty(StudentQuality.Type type,
Assignment<Request,Enrollment> assignment)
Re-check total penalization for the given assignment and conflict type
|
Set<StudentQuality.Conflict> |
conflicts(Enrollment e1)
Conflicts of any type between classes of a single enrollment (or with free times, unavailabilities, etc.)
|
Set<StudentQuality.Conflict> |
conflicts(Enrollment e1,
Enrollment e2)
Conflicts of any type between two enrollments of a student.
|
Set<StudentQuality.Conflict> |
conflicts(StudentQuality.Type type,
Enrollment e1)
Conflicts of the given type between classes of a single enrollment (or with free times, unavailabilities, etc.)
|
Set<StudentQuality.Conflict> |
conflicts(StudentQuality.Type type,
Enrollment e1,
Enrollment e2)
Conflicss of the given type between two enrollments of a student.
|
StudentQuality.StudentQualityContext |
createAssignmentContext(Assignment<Request,Enrollment> assignment)
Create a new assignment context for the given assignment.
|
Set<StudentQuality.Conflict> |
getAllConflicts(StudentQuality.Type type,
Assignment<Request,Enrollment> assignment)
All conflicts of the given type for the given assignment
|
DistanceMetric |
getDistanceMetric()
Current distance metric
|
void |
getInfo(Assignment<Request,Enrollment> assignment,
Map<String,String> info)
Adds some information into the table with information about the solution
|
void |
getInfo(Assignment<Request,Enrollment> assignment,
Map<String,String> info,
Collection<Request> variables)
Adds some information into the table with information about the solution,
only consider variables from the given set
|
StudentQuality.Context |
getStudentQualityContext()
Student quality context
|
int |
getTotalPenalty(Assignment<Request,Enrollment> assignment,
StudentQuality.Type... types)
Total penalisation of given types
|
int |
getTotalPenalty(StudentQuality.Type type,
Assignment<Request,Enrollment> assignment)
Total penalisation of given type
|
boolean |
hasDistanceConflict(Student student,
Section s1,
Section s2) |
StudentQuality.StudentQualityContext |
inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
StudentQuality.StudentQualityContext parentContext)
Create a new assignment context for the given assignment.
|
boolean |
isApplicable(StudentQuality.Type type,
Student student,
Request r1,
Request r2)
Check whether the given type is applicable for the student and the two requests.
|
boolean |
isDebug()
Is debugging enabled
|
int |
penalty(StudentQuality.Type type,
Enrollment e1)
Penalty of given type between classes of a single enrollment (or with free times, unavailabilities, etc.)
|
int |
penalty(StudentQuality.Type type,
Enrollment e1,
Enrollment e2)
Penalisation of the given type between two enrollments of a student.
|
String |
toString(Assignment<Request,Enrollment> assignment) |
getAssignmentContextReference, getContext, getContext, init, setAssignmentContextReference, unregister
beforeUnassigned, constraintAdded, constraintRemoved, getModel, getProperties, getSolver, isRegistered, register, variableAdded, variableRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
beforeUnassigned, constraintAdded, constraintRemoved, init, variableAdded, variableRemoved
public StudentQuality(Solver<Request,Enrollment> solver, DataProperties properties)
solver
- student scheduling solverproperties
- solver configurationpublic StudentQuality(DistanceMetric metrics, DataProperties properties)
metrics
- distance metricproperties
- solver configurationpublic DistanceMetric getDistanceMetric()
public boolean isDebug()
public StudentQuality.Context getStudentQualityContext()
public int penalty(StudentQuality.Type type, Enrollment e1, Enrollment e2)
public Set<StudentQuality.Conflict> conflicts(StudentQuality.Type type, Enrollment e1, Enrollment e2)
public Set<StudentQuality.Conflict> conflicts(Enrollment e1, Enrollment e2)
public Set<StudentQuality.Conflict> conflicts(StudentQuality.Type type, Enrollment e1)
public Set<StudentQuality.Conflict> conflicts(Enrollment e1)
public int penalty(StudentQuality.Type type, Enrollment e1)
public boolean isApplicable(StudentQuality.Type type, Student student, Request r1, Request r2)
public int getTotalPenalty(StudentQuality.Type type, Assignment<Request,Enrollment> assignment)
public int getTotalPenalty(Assignment<Request,Enrollment> assignment, StudentQuality.Type... types)
public void checkTotalPenalty(Assignment<Request,Enrollment> assignment)
public void checkTotalPenalty(StudentQuality.Type type, Assignment<Request,Enrollment> assignment)
public Set<StudentQuality.Conflict> getAllConflicts(StudentQuality.Type type, Assignment<Request,Enrollment> assignment)
public Set<StudentQuality.Conflict> allConflicts(Assignment<Request,Enrollment> assignment, Enrollment enrollment)
public void beforeAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
Extension
beforeAssigned
in interface ModelListener<Request,Enrollment>
beforeAssigned
in class Extension<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationvalue
- value to be assignedpublic void afterAssigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
Extension
afterAssigned
in interface ModelListener<Request,Enrollment>
afterAssigned
in class Extension<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationvalue
- value to be assignedpublic void afterUnassigned(Assignment<Request,Enrollment> assignment, long iteration, Enrollment value)
Extension
afterUnassigned
in interface ModelListener<Request,Enrollment>
afterUnassigned
in class Extension<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationvalue
- value to be unassignedpublic StudentQuality.StudentQualityContext createAssignmentContext(Assignment<Request,Enrollment> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Request,Enrollment,StudentQuality.StudentQualityContext>
assignment
- an assignment for which there needs to be an assignment contextpublic StudentQuality.StudentQualityContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment, StudentQuality.StudentQualityContext parentContext)
CanInheritContext
inheritAssignmentContext
in interface CanInheritContext<Request,Enrollment,StudentQuality.StudentQualityContext>
assignment
- an assignment for which there needs to be an assignment contextparentContext
- context of the parent assignmentpublic void getInfo(Assignment<Request,Enrollment> assignment, Map<String,String> info)
InfoProvider
getInfo
in interface InfoProvider<Request,Enrollment>
assignment
- current assignmentinfo
- info tablepublic void getInfo(Assignment<Request,Enrollment> assignment, Map<String,String> info, Collection<Request> variables)
InfoProvider
getInfo
in interface InfoProvider<Request,Enrollment>
assignment
- current assignmentinfo
- info tablevariables
- sub-problempublic String toString(Assignment<Request,Enrollment> assignment)
public boolean hasDistanceConflict(Student student, Section s1, Section s2)