public class TeachingRequest extends Variable<TeachingRequest,TeachingAssignment>
Constructor and Description |
---|
TeachingRequest(long requestId,
int index,
Course course,
float load,
Collection<Section> sections) |
Modifier and Type | Method and Description |
---|---|
void |
addAttributePreference(Preference<Attribute> pref)
Add attribute preference
|
void |
addInstructorPreference(Preference<Instructor> pref)
Add instructor preference
|
double |
countBackToBacks(TeachingRequest request,
double diffRoomWeight,
double diffTypeWeight)
Average value of the back-to-backs between this request and the given one
|
boolean |
equals(Object o) |
PreferenceCombination |
getAttributePreference(Instructor instructor)
Compute attribute preference for the given instructor
|
int |
getAttributePreference(Instructor instructor,
Attribute.Type type)
Compute attribute preference for the given instructor and attribute type
|
List<Preference<Attribute>> |
getAttributePreferences()
Return attribute preferences for this request
|
Course |
getCourse()
Course of the request that was provided in the constructor
|
int |
getInstructorIndex()
Instructor index that was provided in the constructor
|
Preference<Instructor> |
getInstructorPreference(Instructor instructor)
Return instructor preference for the given instructor
|
List<Preference<Instructor>> |
getInstructorPreferences()
Return instructor preferences for this request
|
float |
getLoad()
Return teaching load of the request
|
String |
getName()
Variable's name -- for printing purposes
|
long |
getRequestId()
Teaching request id that was provided in the constructor
|
List<Section> |
getSections()
Sections of the request that was provided in the constructor
|
int |
hashCode() |
double |
nrSameLectures(TeachingRequest request)
Count the number of common sections that the given request share with this request
|
boolean |
overlaps(TeachingRequest request)
Check if this request overlaps with the given one
|
boolean |
sameCommon(TeachingRequest request)
Check if the given request fully share the common sections with this request
|
boolean |
sameCourse(TeachingRequest request)
Check if this request and the given request are of the same course
|
void |
setLoad(float load)
Set teaching load of the request
|
int |
share(TeachingRequest request)
Count the number of (allowed) overlapping time slots between this request and the given one
|
int |
share(TimeLocation time)
Count the number of overlapping time slots between this request and the given time
|
String |
toString() |
List<TeachingAssignment> |
values(Assignment<TeachingRequest,TeachingAssignment> assignment)
Variable's domain
|
void |
variableAssigned(Assignment<TeachingRequest,TeachingAssignment> assignment,
long iteration,
TeachingAssignment ta)
A value was assigned to this variable
|
void |
variableUnassigned(Assignment<TeachingRequest,TeachingAssignment> assignment,
long iteration,
TeachingAssignment ta)
A value was unassigned from this variable
|
addContstraint, addVariableListener, assign, compareTo, constraints, constraintVariables, getAssignment, getAssignment, getAssignments, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getId, getIndex, getInitialAssignment, getLastIteration, getModel, getVariableListeners, hardConstraints, hasAssignment, hasAssignment, hasInitialAssignment, hasValues, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setAssignment, setBestAssignment, setExtra, setIndex, setInitialAssignment, setLastIteration, setModel, setValues, softConstraints, unassign, values
public TeachingRequest(long requestId, int index, Course course, float load, Collection<Section> sections)
requestId
- teaching request idindex
- instructor index (if a class can be taught by multiple instructors, the index identifies the particular request)course
- courseload
- teaching loadsections
- list of sectionspublic long getRequestId()
public int getInstructorIndex()
public List<TeachingAssignment> values(Assignment<TeachingRequest,TeachingAssignment> assignment)
Variable
values
in class Variable<TeachingRequest,TeachingAssignment>
assignment
- current assignment (if the domain is dependent on the current assignment)public List<Preference<Attribute>> getAttributePreferences()
public void addAttributePreference(Preference<Attribute> pref)
pref
- attribute preferencepublic int getAttributePreference(Instructor instructor, Attribute.Type type)
instructor
- an instructortype
- an attribute typeAttribute.Type.isConjunctive()
and Attribute.Type.isRequired()
propertiespublic PreferenceCombination getAttributePreference(Instructor instructor)
instructor
- an instructorSumPreferenceCombination
for the preferences of each attribute type (using getAttributePreference(Instructor, org.cpsolver.instructor.model.Attribute.Type)
)public List<Preference<Instructor>> getInstructorPreferences()
public void addInstructorPreference(Preference<Instructor> pref)
pref
- instructor preferencepublic Preference<Instructor> getInstructorPreference(Instructor instructor)
instructor
- an instructorpublic Course getCourse()
public String getName()
Variable
getName
in class Variable<TeachingRequest,TeachingAssignment>
public List<Section> getSections()
public float getLoad()
public void setLoad(float load)
load
- teaching loadpublic String toString()
toString
in class Variable<TeachingRequest,TeachingAssignment>
public boolean sameCommon(TeachingRequest request)
request
- the other teaching requestpublic double nrSameLectures(TeachingRequest request)
request
- the other teaching requestpublic boolean sameCourse(TeachingRequest request)
request
- the other teaching requestpublic boolean overlaps(TeachingRequest request)
request
- the other teaching requestpublic int share(TeachingRequest request)
request
- the other teaching requestpublic int share(TimeLocation time)
time
- a timepublic double countBackToBacks(TeachingRequest request, double diffRoomWeight, double diffTypeWeight)
request
- the other teaching requestdiffRoomWeight
- different room penaltydiffTypeWeight
- different instructional type penaltySection.countBackToBacks(Collection, double, double)
between the two, common sections are ignoredpublic int hashCode()
hashCode
in class Variable<TeachingRequest,TeachingAssignment>
public boolean equals(Object o)
equals
in class Variable<TeachingRequest,TeachingAssignment>
public void variableAssigned(Assignment<TeachingRequest,TeachingAssignment> assignment, long iteration, TeachingAssignment ta)
Variable
variableAssigned
in class Variable<TeachingRequest,TeachingAssignment>
assignment
- current assignmentiteration
- current iterationta
- assigned valuepublic void variableUnassigned(Assignment<TeachingRequest,TeachingAssignment> assignment, long iteration, TeachingAssignment ta)
Variable
variableUnassigned
in class Variable<TeachingRequest,TeachingAssignment>
assignment
- current assignmentiteration
- current iterationta
- unassigned valueCopyright © 2016 UniTime LLC. All Rights Reserved.