public class BranchBoundSelection.Selection extends Object
Modifier and Type | Field and Description |
---|---|
protected Enrollment[] |
iAssignment
Current assignment
|
protected Enrollment[] |
iBestAssignment
Best assignment
|
protected double |
iBestValue
Best value
|
protected Assignment<Request,Enrollment> |
iCurrentAssignment
Current assignment
|
protected Student |
iStudent
Student
|
protected long |
iT0
Start time
|
protected long |
iT1
End time
|
protected boolean |
iTimeoutReached
Was timeout reached
|
protected ArrayList<OnlineSectioningCriterion.TimeToAvoid> |
iTimesToAvoid
Times to avoid (used when comparing enrollments)
|
protected HashMap<CourseRequest,List<Enrollment>> |
iValues
Value cache
|
Constructor and Description |
---|
Selection(Student student,
Assignment<Request,Enrollment> assignment)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
backTrack(int idx)
branch & bound search
|
boolean |
canAssign(Request request,
int idx)
True if the given request can be assigned
|
protected boolean |
canLeaveUnassigned(Request request)
Returns true if the given request can be left unassigned
|
Enrollment |
firstConflict(int idx,
Enrollment enrollment)
First conflicting enrollment
|
protected double |
getAssignmentPenalty(int i)
Assignment penalty
|
Enrollment[] |
getBestAssignment()
Best schedule
|
int |
getBestNrAssigned()
Number of requests assigned in the best schedule
|
double |
getBestValue()
Value of the best schedule
|
double |
getBound(int idx)
Bound for the current schedule
|
protected double |
getBound(Request r)
Return bound of a request
|
Set<DistanceConflict.Conflict> |
getDistanceConflicts(int idx)
Distance conflicts of idx-th assignment of the current
schedule
|
int |
getNrAssigned()
Number of assigned requests in the current schedule
|
int |
getNrAssignedBound(int idx)
Bound for the number of assigned requests in the current schedule
|
double |
getPenalty()
Penalty of the current schedule
|
double |
getPenaltyBound(int idx)
Penalty bound of the current schedule
|
Set<StudentQuality.Conflict> |
getStudentQualityConflicts(int idx) |
long |
getTime()
Time (in milliseconds) the branch & bound did run
|
Set<TimeOverlapsCounter.Conflict> |
getTimeOverlappingConflicts(int idx)
Time overlapping conflicts of idx-th assignment of the current
schedule
|
double |
getValue()
Value of the current schedule
|
protected double |
getWeight(Enrollment enrollment,
Set<DistanceConflict.Conflict> distanceConflicts,
Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts)
Deprecated.
|
protected double |
getWeight(Enrollment enrollment,
Set<StudentQuality.Conflict> conflicts) |
boolean |
inConflict(int idx,
Enrollment enrollment)
True if the enrollment is conflicting
|
boolean |
isTimeoutReached()
Was timeout reached
|
void |
saveBest()
Save the current schedule as the best
|
BranchBoundSelection.BranchBoundNeighbour |
select()
Execute branch & bound, return the best found schedule for the
selected student.
|
protected List<Enrollment> |
values(CourseRequest request)
Returns list of available enrollments for a course request
|
protected long iT0
protected long iT1
protected boolean iTimeoutReached
protected Enrollment[] iAssignment
protected Enrollment[] iBestAssignment
protected double iBestValue
protected HashMap<CourseRequest,List<Enrollment>> iValues
protected Assignment<Request,Enrollment> iCurrentAssignment
protected ArrayList<OnlineSectioningCriterion.TimeToAvoid> iTimesToAvoid
public Selection(Student student, Assignment<Request,Enrollment> assignment)
student
- selected studentassignment
- current assignmentpublic BranchBoundSelection.BranchBoundNeighbour select()
public boolean isTimeoutReached()
public long getTime()
public Enrollment[] getBestAssignment()
public double getBestValue()
public int getBestNrAssigned()
public int getNrAssignedBound(int idx)
idx
- index of the request that is being consideredpublic Set<DistanceConflict.Conflict> getDistanceConflicts(int idx)
idx
- index of the requestpublic Set<TimeOverlapsCounter.Conflict> getTimeOverlappingConflicts(int idx)
idx
- index of the requestpublic Set<StudentQuality.Conflict> getStudentQualityConflicts(int idx)
@Deprecated protected double getWeight(Enrollment enrollment, Set<DistanceConflict.Conflict> distanceConflicts, Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts)
StudentWeights.getWeight(Assignment, Enrollment, Set, Set)
, only count this side of distance conflicts and time overlaps.enrollment
- an enrollmentdistanceConflicts
- set of distance conflictstimeOverlappingConflicts
- set of time overlapping conflictsprotected double getWeight(Enrollment enrollment, Set<StudentQuality.Conflict> conflicts)
protected double getBound(Request r)
r
- a requestpublic double getBound(int idx)
idx
- index of the requestpublic double getValue()
protected double getAssignmentPenalty(int i)
i
- index of the requestpublic double getPenalty()
public double getPenaltyBound(int idx)
idx
- index of requestpublic void saveBest()
public boolean inConflict(int idx, Enrollment enrollment)
idx
- index of requestenrollment
- enrollment in questionpublic Enrollment firstConflict(int idx, Enrollment enrollment)
idx
- index of requestenrollment
- enrollment in questionpublic boolean canAssign(Request request, int idx)
request
- given requestidx
- index of requestpublic int getNrAssigned()
protected boolean canLeaveUnassigned(Request request)
request
- given requestprotected List<Enrollment> values(CourseRequest request)
request
- given requestpublic void backTrack(int idx)
idx
- index of request