public class SuggestionsBranchAndBound extends Object
Modifier and Type | Class and Description |
---|---|
class |
SuggestionsBranchAndBound.EnrollmentSectionComparator
Enrollment comparator (used to sort enrollments in a domain).
|
class |
SuggestionsBranchAndBound.SectionAssignmentComparator
Section comparator.
|
class |
SuggestionsBranchAndBound.Suggestion
Suggestion
|
static interface |
SuggestionsBranchAndBound.SuggestionFilter
Suggestion filter.
|
Modifier and Type | Field and Description |
---|---|
protected MultiCriteriaBranchAndBoundSelection.SelectionComparator |
iComparator |
protected int |
iMatched |
protected double |
iMaxSectionsWithPenalty |
Constructor and Description |
---|
SuggestionsBranchAndBound(DataProperties properties,
Student student,
Assignment<Request,Enrollment> assignment,
Hashtable<CourseRequest,Set<Section>> requiredSections,
Set<FreeTimeRequest> requiredFreeTimes,
Hashtable<CourseRequest,Set<Section>> preferredSections,
Request selectedRequest,
Section selectedSection,
SuggestionsBranchAndBound.SuggestionFilter filter,
double maxSectionsWithPenalty)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
backtrack(ArrayList<Request> requests2resolve,
TreeSet<Request> altRequests2resolve,
int idx,
int depth,
boolean alt)
Main branch and bound rutine
|
protected boolean |
canContinue(ArrayList<Request> requests2resolve,
int idx,
int depth)
Termination criterion
|
protected boolean |
canContinueEvaluation()
Can continue evaluation of possible enrollments
|
boolean |
canLeaveUnassigned(Request request)
Can this request be left unassigned
|
protected boolean |
checkBound(ArrayList<Request> requests2resolve,
int idx,
int depth,
Enrollment value,
Set<Enrollment> conflicts)
Check bound
|
protected int |
compare(Assignment<Request,Enrollment> assignment,
SuggestionsBranchAndBound.Suggestion s1,
SuggestionsBranchAndBound.Suggestion s2)
Compare two suggestions
|
TreeSet<SuggestionsBranchAndBound.Suggestion> |
computeSuggestions()
Perform the search
|
int |
getNrMatched()
Number of possible enrollments of the selected request
|
int |
getNrSolutionsSeen()
Number of possible suggestions visited
|
long |
getTime()
Return search time
|
boolean |
isAllowed(Enrollment enrollment)
Check required sections
|
boolean |
isTimeoutReached()
Was time limit reached
|
protected List<Enrollment> |
values(Request request)
Domain of a request
|
protected MultiCriteriaBranchAndBoundSelection.SelectionComparator iComparator
protected int iMatched
protected double iMaxSectionsWithPenalty
public SuggestionsBranchAndBound(DataProperties properties, Student student, Assignment<Request,Enrollment> assignment, Hashtable<CourseRequest,Set<Section>> requiredSections, Set<FreeTimeRequest> requiredFreeTimes, Hashtable<CourseRequest,Set<Section>> preferredSections, Request selectedRequest, Section selectedSection, SuggestionsBranchAndBound.SuggestionFilter filter, double maxSectionsWithPenalty)
properties
- configurationstudent
- given studentassignment
- current assignmentrequiredSections
- required sectionsrequiredFreeTimes
- required free times (free time requests that must be assigned)preferredSections
- preferred sectionsselectedRequest
- selected requestselectedSection
- selected sectionfilter
- section filtermaxSectionsWithPenalty
- maximal number of sections that have a positive over-expectation penalty OverExpectedCriterion.getOverExpected(Assignment, Section, Request)
public long getTime()
public boolean isTimeoutReached()
public int getNrSolutionsSeen()
public TreeSet<SuggestionsBranchAndBound.Suggestion> computeSuggestions()
protected void backtrack(ArrayList<Request> requests2resolve, TreeSet<Request> altRequests2resolve, int idx, int depth, boolean alt)
requests2resolve
- remaining requests to assignaltRequests2resolve
- alternative requests to assignidx
- current depthdepth
- remaining depthalt
- can leave a request unassignedprotected List<Enrollment> values(Request request)
request
- given requestprotected boolean canContinue(ArrayList<Request> requests2resolve, int idx, int depth)
requests2resolve
- request to resolveidx
- current depthdepth
- remaining depthprotected boolean canContinueEvaluation()
protected boolean checkBound(ArrayList<Request> requests2resolve, int idx, int depth, Enrollment value, Set<Enrollment> conflicts)
requests2resolve
- requests to resolveidx
- current depthdepth
- remaining depthvalue
- enrollment in questionconflicts
- conflicting enrollmentspublic boolean isAllowed(Enrollment enrollment)
enrollment
- given enrollmentpublic boolean canLeaveUnassigned(Request request)
request
- given requestprotected int compare(Assignment<Request,Enrollment> assignment, SuggestionsBranchAndBound.Suggestion s1, SuggestionsBranchAndBound.Suggestion s2)
assignment
- current assignments1
- first suggestions2
- second suggestionpublic int getNrMatched()