|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.studentsct.StudentPreferencePenalties
public class StudentPreferencePenalties
An attempt to empirically test the case when students can choose their
sections (section times).
Each student has his/her own order of possible times of the week (selection
of a day and an hour starting 7:30, 8:30, etc.) -- this order is computed
using roulette wheel selection with the distribution of possible times
defined in sStudentRequestDistribution
.
A penalty for each section is computed proportionally based on this order
(and the number of slots that falls into each time frame), the existing
branch&bound selection is used to section each student one by one (in a
random order).
Usage:
for (Enumeration e=students.elements();e.hasMoreElements();) {
// take a student (one by one)
Student student = (Student)e.nextElement();
// compute and apply penalties using this class
new StudentPreferencePenalties().setPenalties(student);
// section a student
// for instance, BranchBoundSelection
can be used (with Neighbour.BranchAndBoundMinimizePenalty set to true)
Neighbour neighbour = new BranchBoundSelection(config).getSelection(student).select();
if (neighbour!=null) neighbour.assign(iteration++);
};
Field Summary | |
---|---|
static int |
sDistTypePreference
|
static int |
sDistTypePreferenceQuadratic
|
static int |
sDistTypePreferenceReverse
|
static int |
sDistTypeUniform
|
static int[][] |
sStudentRequestDistribution
|
Constructor Summary | |
---|---|
StudentPreferencePenalties(int disributionType)
Constructor. |
Method Summary | |
---|---|
static int |
day(int slot)
Return day index in sStudentRequestDistribution for the
given slot. |
double |
getMaxPenalty(Config config)
Maximal penalty of a config |
double |
getMaxPenalty(CourseRequest request)
Maximal penalty of a course request |
double |
getMaxPenalty(Offering offering)
Maximal penalty of an offering |
double |
getMaxPenalty(Request request)
Maximal penalty of a course request |
double |
getMaxPenalty(Subpart subpart)
Maximal penalty of a subpart |
double[] |
getMinMaxAvailableEnrollmentPenalty(CourseRequest request)
Minimal and maximal available enrollment penalty of a request |
double[] |
getMinMaxAvailableEnrollmentPenalty(Request request)
Minimal and maximal available enrollment penalty of a request |
double[] |
getMinMaxEnrollmentPenalty(CourseRequest request)
Minimal and maximal available enrollment penalty of a request |
double[] |
getMinMaxEnrollmentPenalty(Request request)
Minimal and maximal available enrollment penalty of a request |
double |
getMinPenalty(Config config)
Minimal penalty of a config |
double |
getMinPenalty(CourseRequest request)
Minimal penalty of a course request |
double |
getMinPenalty(Offering offering)
Minimal penalty of an offering |
double |
getMinPenalty(Request request)
Minimal penalty of a course request |
double |
getMinPenalty(Subpart subpart)
Minimal penalty of a subpart |
double |
getPenalty(Assignment assignment)
Return penalty of an assignment. |
double |
getPenalty(Enrollment enrollment)
Return penalty of an enrollment. |
double |
getPenalty(TimeLocation time)
Return penalty of the given time. |
static void |
setPenalties(Student student,
int distributionType)
Set the computed penalties to all sections of all requests of the given student |
static int |
time(int slot)
Return time index in sStudentRequestDistribution for the
given slot. |
String |
toString(int day,
int time)
Return time of the given day and time index of sStudentRequestDistribution . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int sDistTypeUniform
public static int sDistTypePreference
public static int sDistTypePreferenceQuadratic
public static int sDistTypePreferenceReverse
public static int[][] sStudentRequestDistribution
Constructor Detail |
---|
public StudentPreferencePenalties(int disributionType)
sStudentRequestDistribution
. The first time gets zero penalty, the second 1/nrTimes, the third
2/nrTimes etc. where nrTimes is the number of times in
sStudentRequestDistribution
.
Method Detail |
---|
public static int day(int slot)
sStudentRequestDistribution
for the
given slot.
public static int time(int slot)
sStudentRequestDistribution
for the
given slot.
public String toString(int day, int time)
sStudentRequestDistribution
.
public double getPenalty(TimeLocation time)
public double getPenalty(Assignment assignment)
Assignment.getTime()
) or zero if the time is null.
public double getPenalty(Enrollment enrollment)
Enrollment.getAssignments()
.
public double getMinPenalty(Request request)
public double getMinPenalty(CourseRequest request)
public double getMinPenalty(Offering offering)
public double getMinPenalty(Config config)
public double getMinPenalty(Subpart subpart)
public double getMaxPenalty(Request request)
public double getMaxPenalty(CourseRequest request)
public double getMaxPenalty(Offering offering)
public double getMaxPenalty(Config config)
public double getMaxPenalty(Subpart subpart)
public double[] getMinMaxAvailableEnrollmentPenalty(Request request)
public double[] getMinMaxAvailableEnrollmentPenalty(CourseRequest request)
public double[] getMinMaxEnrollmentPenalty(Request request)
public double[] getMinMaxEnrollmentPenalty(CourseRequest request)
public static void setPenalties(Student student, int distributionType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |