public class Instructor extends AbstractClassWithContext<TeachingRequest.Variable,TeachingAssignment,Instructor.Context> implements CanInheritContext<TeachingRequest.Variable,TeachingAssignment,Instructor.Context>
Modifier and Type | Class and Description |
---|---|
class |
Instructor.Context
Instructor Constraint Context.
|
sMaxSize
Constructor and Description |
---|
Instructor(long id,
String externalId,
String name,
int preference,
float maxLoad)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute attribute)
Add instructor attribute
|
void |
addCoursePreference(Preference<Course> pref)
Add course preference
|
GroupConstraint.Distribution |
addDistribution(String reference,
String preference,
String name)
Add a distribution preference, returns null if there is no match.
|
void |
addTimePreference(Preference<TimeLocation> pref)
Add instructor time preference
|
boolean |
canTeach(TeachingRequest request)
Check if this instructor can teach the given request.
|
double |
countBackToBacks(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value,
double diffRoomWeight,
double diffTypeWeight)
Compute number of back-to-back assignments (weighted by the preference) of the given teaching assignment and the other assignments of the instructor
|
double |
countSameDays(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value,
double diffRoomWeight,
double diffTypeWeight)
Compute number of same days assignments (weighted by the preference) of the given teaching assignment and the other assignments of the instructor
|
double |
countSameRooms(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value,
double diffTypeWeight)
Compute number of same room assignments (weighted by the preference) of the given teaching assignment and the other assignments of the instructor
|
Instructor.Context |
createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
Create a new assignment context for the given assignment.
|
double |
differentLectures(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value)
Compute different common sections of the given teaching assignment and the other assignments of the instructor
|
boolean |
equals(Object o) |
List<Attribute> |
getAttributes()
Return instructor attributes
|
Set<Attribute> |
getAttributes(Attribute.Type type)
Return instructor attributes of given type
|
String |
getAvailable()
Instructor unavailability string generated from prohibited time preferences
|
int |
getBackToBackPreference()
Return back-to-back preference (only soft preference can be set at the moment)
|
Preference<Course> |
getCoursePreference(Course course)
Return preference for the given course
|
List<Preference<Course>> |
getCoursePreferences()
Return course preferences
|
List<GroupConstraint.Distribution> |
getDistributions()
Return all distribution preferences for an instructor
|
String |
getExternalId()
Instructor external Id that was provided in the constructor
|
long |
getInstructorId()
Instructor unique id that was provided in the constructor
|
float |
getMaxLoad()
Maximal load
|
InstructorSchedulingModel |
getModel()
Get the model.
|
String |
getName()
Instructor name that was provided in the constructor
|
int |
getPreference()
Return teaching preference
|
int |
getSameDaysPreference()
Return same-days preference (only soft preference can be set at the moment)
|
int |
getSameRoomPreference()
Return same-room preference (only soft preference can be set at the moment)
|
PreferenceCombination |
getTimePreference(TeachingRequest request)
Compute time preference for a given teaching request.
|
PreferenceCombination |
getTimePreference(TimeLocation time)
Compute time preference for a given time.
|
List<Preference<TimeLocation>> |
getTimePreferences()
Return instructor preferences
|
boolean |
hasDistributions()
Check if the instructor has any distributions
|
boolean |
hasExternalId()
Has instructor external id?
|
int |
hashCode() |
boolean |
hasName()
Has instructor name?
|
Instructor.Context |
inheritAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
Instructor.Context parentContext)
Create a new assignment context for the given assignment.
|
boolean |
isBackToBackDiscouraged()
Is back-to-back discouraged?
|
boolean |
isBackToBackPreferred()
Is back-to-back preferred?
|
boolean |
isSameDaysDiscouraged()
Is same-days discouraged?
|
boolean |
isSameDaysPreferred()
Is same-days preferred?
|
boolean |
isSameRoomDiscouraged()
Is same-room discouraged?
|
boolean |
isSameRoomPreferred()
Is same-room preferred?
|
void |
setBackToBackPreference(int backToBackPreference)
Set back-to-back preference (only soft preference can be set at the moment)
|
void |
setModel(InstructorSchedulingModel model)
Set current model
|
void |
setPreference(int preference)
Set teaching preference
|
void |
setSameDaysPreference(int sameDaysPreference)
Set same-days preference (only soft preference can be set at the moment)
|
void |
setSameRoomPreference(int sameRoomPreference)
Set same-room preference (only soft preference can be set at the moment)
|
int |
share(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
TeachingAssignment value)
Compute time overlaps with instructor availability and other teaching assignments of the instructor
|
int |
share(TeachingRequest request)
Compute time overlaps with instructor availability
|
String |
toString() |
getAssignmentContextReference, getContext, getContext, setAssignmentContextReference
public Instructor(long id, String externalId, String name, int preference, float maxLoad)
id
- instructor unique idexternalId
- instructor external idname
- instructor namepreference
- teaching preferencemaxLoad
- maximal teaching loadpublic InstructorSchedulingModel getModel()
AbstractClassWithContext
getModel
in class AbstractClassWithContext<TeachingRequest.Variable,TeachingAssignment,Instructor.Context>
public void setModel(InstructorSchedulingModel model)
model
- instructional scheduling modelpublic long getInstructorId()
public boolean hasExternalId()
public String getExternalId()
public boolean hasName()
public String getName()
public void setBackToBackPreference(int backToBackPreference)
backToBackPreference
- back-to-back preference (e.g., -1 for preferred, 1 for discouraged)public int getBackToBackPreference()
public boolean isBackToBackPreferred()
public boolean isBackToBackDiscouraged()
public void setSameDaysPreference(int sameDaysPreference)
sameDaysPreference
- same-days preference (e.g., -1 for preferred, 1 for discouraged)public int getSameDaysPreference()
public boolean isSameDaysPreferred()
public boolean isSameDaysDiscouraged()
public void setSameRoomPreference(int sameRoomPreference)
sameRoomPreference
- same-room preference (e.g., -1 for preferred, 1 for discouraged)public int getSameRoomPreference()
public boolean isSameRoomPreferred()
public boolean isSameRoomDiscouraged()
public String getAvailable()
public List<Attribute> getAttributes()
public void addAttribute(Attribute attribute)
attribute
- instructor attributepublic Set<Attribute> getAttributes(Attribute.Type type)
type
- attribute typepublic List<Preference<TimeLocation>> getTimePreferences()
public void addTimePreference(Preference<TimeLocation> pref)
pref
- instructor time preferencepublic PreferenceCombination getTimePreference(TimeLocation time)
MinMaxPreferenceCombination
for all time preferences that are overlapping with the given time.time
- given timepublic PreferenceCombination getTimePreference(TeachingRequest request)
MinMaxPreferenceCombination
for all time preferences that are overlapping with the given teaching request.
When a section that allows for overlaps (see Section.isAllowOverlap()
) overlap with a prohibited time preference, this is only counted as strongly discouraged.request
- teaching request that is being consideredpublic List<Preference<Course>> getCoursePreferences()
public void addCoursePreference(Preference<Course> pref)
pref
- instructor course preferencepublic Preference<Course> getCoursePreference(Course course)
course
- course that is being consideredpublic int getPreference()
public void setPreference(int preference)
preference
- teaching preference of this instructorpublic float getMaxLoad()
public boolean canTeach(TeachingRequest request)
request
- teaching request that is being consideredpublic int share(TeachingRequest request)
request
- teaching request that is being consideredpublic int share(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value)
assignment
- current assignmentvalue
- teaching assignment that is being consideredpublic double differentLectures(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value)
assignment
- current assignmentvalue
- teaching assignment that is being consideredTeachingRequest.nrSameLectures(TeachingRequest)
between the given and the other existing assignments of the instructorpublic double countBackToBacks(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value, double diffRoomWeight, double diffTypeWeight)
assignment
- current assignmentvalue
- teaching assignment that is being considereddiffRoomWeight
- different room penaltydiffTypeWeight
- different instructional type penaltyTeachingRequest.countBackToBacks(TeachingRequest, double, double)
public double countSameDays(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value, double diffRoomWeight, double diffTypeWeight)
assignment
- current assignmentvalue
- teaching assignment that is being considereddiffRoomWeight
- different room penaltydiffTypeWeight
- different instructional type penaltyTeachingRequest.countSameDays(TeachingRequest, double, double)
public double countSameRooms(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value, double diffTypeWeight)
assignment
- current assignmentvalue
- teaching assignment that is being considereddiffTypeWeight
- different instructional type penaltyTeachingRequest.countSameRooms(TeachingRequest, double)
public Instructor.Context createAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<TeachingRequest.Variable,TeachingAssignment,Instructor.Context>
assignment
- an assignment for which there needs to be an assignment contextpublic Instructor.Context inheritAssignmentContext(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, Instructor.Context parentContext)
CanInheritContext
inheritAssignmentContext
in interface CanInheritContext<TeachingRequest.Variable,TeachingAssignment,Instructor.Context>
assignment
- an assignment for which there needs to be an assignment contextparentContext
- context of the parent assignmentpublic boolean hasDistributions()
public GroupConstraint.Distribution addDistribution(String reference, String preference, String name)
public List<GroupConstraint.Distribution> getDistributions()