|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscheduler.fair_qual.Fair_Qual
public class Fair_Qual
Fair_Qual contains methods to judge a schedule against preferences and determine the Fairness and Quality of the given schedule.
Field Summary | |
---|---|
private int |
current_index
The index being looked at by FairUI |
private float |
f_avg
Average fairness value. |
private double |
f_dev
Standard deviation of fairness values |
private int |
f_high
Highest fairness value |
private int |
f_low
Lowest fairness value |
private java.util.ArrayList<java.lang.Integer> |
fairness
Holds fairness values for the instructors in instructor_list |
private java.util.ArrayList<java.lang.Integer> |
hits
Holds the number of assigned classes and times for a given isntructor |
private java.util.ArrayList<Instructor> |
instructor_list
Contains all instructor's who have a fairness value computed |
private java.util.ArrayList<java.lang.Integer> |
quality
Holds quality values for the instructors in instructor_list |
private Schedule |
schedule
Each instructor's schedule |
Constructor Summary | |
---|---|
Fair_Qual()
Sets all variables and attempts to fill instructor_list with the current schedule (if any). |
|
Fair_Qual(Schedule cur_schedule)
Sets all variables and sets canned data for testing purposes |
Method Summary | |
---|---|
private double |
calculateDeviation()
calculates standard deviation |
void |
clearLists()
Helper function to empty all current lists |
private void |
generateFairness()
Calculates the fairness and associated statistics (avg,low,high,etc) for all instructors with a generated schedule. |
private void |
generateFairnessStats()
generates associated statistics for overall data, such as highest, lowest, or average fairness. |
void |
generateQuality()
generateQuality will calculate the fairness and associated statistics (avg,low,high,etc) for all instructors with a generated schedule. |
float |
getAvg()
returns the average fairness value |
int |
getCurrentFairness()
returns the fairness value at the current_index |
Instructor |
getCurrentInstructor()
returns the instructor at the current_index |
int |
getCurrentQuality()
returns the quality value at the current_index |
double |
getDev()
returns the standard deviation of stored fairness values |
int |
getFairness(int index)
returns the fairness value at a given index |
static int |
getGenerosity(Instructor inst,
java.util.LinkedList<Course> courses)
Takes in an isntructor and sums up the values of all of their course and time preferences. |
int |
getHigh()
returns the highest fairness value |
int |
getIndex()
returns the current index being viewed by the UI |
Instructor |
getInstructor(int index)
returns the instructor at a given index |
int |
getLow()
returns the lowest fairness value |
double |
getLowerBound()
Calculates lower bound, any fairness value lower than the lower bound is statistically considered to be an outlier. |
int |
getQuality(int index)
returns the quality value at a given index |
Schedule |
getSchedule()
returns the schedule |
java.util.ArrayList<java.lang.Integer> |
getScheduleItemIndices(int index)
returns all the instructor's schedule item indices |
int |
getSize()
returns the number of instructor's stored |
double |
getUpperBound()
Calculates upper bound, any fairness value higher than the upper bound is statistically considered to be an outlier. |
private void |
initSettings()
Variable declarations |
boolean |
setFairness(Instructor instructor,
int new_fairness)
setFairness will modify the fairness value of a given schedule and set it to the new_fairness value. |
boolean |
setIndex(int index)
sets the index being viewed by the UI |
boolean |
setQuality(Instructor instructor,
int new_quality)
setQuality will modify the quality value of a given schedule and set it to the new_quality value. |
void |
update(java.util.Observable obs,
java.lang.Object obj)
Updates the lists when it's observable targets change |
private void |
updateLists()
Synchronizes lists with the updated schedule |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList<Instructor> instructor_list
private java.util.ArrayList<java.lang.Integer> fairness
private java.util.ArrayList<java.lang.Integer> quality
private java.util.ArrayList<java.lang.Integer> hits
private float f_avg
private double f_dev
private int f_low
private int f_high
private int current_index
private Schedule schedule
Constructor Detail |
---|
public Fair_Qual()
public Fair_Qual(Schedule cur_schedule)
cur_schedule
- current list of all generated schedulesMethod Detail |
---|
private void initSettings()
public void update(java.util.Observable obs, java.lang.Object obj)
update
in interface java.util.Observer
obs
- Object observedobj
- I don't knowprivate void updateLists()
private void generateFairness()
"fairness_value" represents the fairness, and has a range from 1-10. a fairness_value of 1 means the schedule for the schedule is most fair, while 10 is the least fair.
pre: schedule.getInstructorList().size() >= 0
post:
forall(stored_schedules)
stored_schedules[i].instructor.fairness = sum(10 - each time/course preference
assigned in instructor's schedule) /
(total assignments)
private void generateFairnessStats()
private double calculateDeviation()
pre: fairness.size() > 1
post: dev = standardDeviation(ofAllStoredFairnessValues)
public void generateQuality()
"quality_value" represents the quality, and has a range from 1-10. a quality_value of 1 means the schedule for the schedule is of the most quality, while 10 is the least quality.
pre: schedule.getInstructorList().size()
post:
forall(stored_schedules)
stored_schedules[i].instructor.quality = (1 / (sum of all quality violations))*10
public boolean setFairness(Instructor instructor, int new_fairness) throws Instructor.NullUserIDException
pre:
(to_modify != NULL) && (new_fairness > 0 && new_fairness < 11)
post:
return (to_modify.fairness = new_fairness)
to_modify
- the schedule being modified.new_fairness
- the value to set the fairness as.
Instructor.NullUserIDException
public boolean setQuality(Instructor instructor, int new_quality) throws Instructor.NullUserIDException
pre:
(to_modify != NULL) && (new_quality > 0 && new_quality < 11)
post:
return (to_modify.quality = new_quality)
to_modify
- the schedule being modified.new_
- quality the value to set the quality as.
Instructor.NullUserIDException
public static int getGenerosity(Instructor inst, java.util.LinkedList<Course> courses)
pre:
inst != null;
post:
forall(preferences) { generosity += preference.desire; }
inst
- the instructor to determine generosity forcourses
- classes with specified preferences
public java.util.ArrayList<java.lang.Integer> getScheduleItemIndices(int index)
public float getAvg()
public int getLow()
public int getHigh()
public int getIndex()
public int getSize()
public boolean setIndex(int index)
public Instructor getInstructor(int index)
public Instructor getCurrentInstructor()
public int getFairness(int index)
public int getCurrentFairness()
public int getQuality(int index)
public int getCurrentQuality()
public Schedule getSchedule()
public double getDev()
public double getUpperBound()
public double getLowerBound()
public void clearLists()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |