public class SwapStudentSelection extends Object implements NeighbourSelection<Request,Enrollment>, ProblemStudentsProvider, InfoProvider<Request,Enrollment>, SolverListener<Request,Enrollment>
Student.canAssign(Assignment, Request)
) a randomly selected sub-domain is
visited. For every such enrollment, a set of conflicting enrollments is
computed and a possible student that can get an alternative enrollment is
identified (if there is any). For each such move a value (the cost of moving
the problematic student somewhere else) is computed and the best possible
move is selected at the end. If there is no such move, a set of problematic
students is identified, i.e., the students whose enrollments are preventing
this student to get a request. ProblemStudentsProvider
interface. Parameter | Type | Comment |
---|---|---|
Neighbour.SwapStudentsTimeout | Integer |
Timeout for each neighbour selection (in milliseconds). |
Neighbour.SwapStudentsMaxValues | Integer |
Limit for the number of considered values for each course request (see
CourseRequest.computeRandomEnrollments(Assignment, int) ). |
Modifier and Type | Class and Description |
---|---|
class |
SwapStudentSelection.Selection
This class looks for a possible swap move for the given student
|
static class |
SwapStudentSelection.SwapStudentNeighbour
Neighbour that contains the swap
|
Modifier and Type | Field and Description |
---|---|
protected long |
iNbrIterations |
protected long |
iNbrNoSolution |
protected long |
iNbrTimeoutReached |
protected StudentOrder |
iOrder |
protected long |
iTotalTime |
static boolean |
sDebug |
Constructor and Description |
---|
SwapStudentSelection(DataProperties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addStudent(Student student) |
static Enrollment |
bestSwap(Assignment<Request,Enrollment> assignment,
Enrollment conflict,
Enrollment enrl,
Set<Student> problematicStudents)
Identify the best swap for the given student
|
void |
getInfo(Assignment<Request,Enrollment> assignment,
Map<String,String> info)
Adds some information into the table with information about the solution
|
void |
getInfo(Assignment<Request,Enrollment> assignment,
Map<String,String> info,
Collection<Request> variables)
Adds some information into the table with information about the solution,
only consider variables from the given set
|
Set<Student> |
getProblemStudents()
List of problematic students
|
SwapStudentSelection.Selection |
getSelection(Assignment<Request,Enrollment> assignment,
Student student)
Selection subclass for a student
|
void |
init(Solver<Request,Enrollment> solver)
Initialization
|
void |
neighbourFailed(Assignment<Request,Enrollment> assignment,
long iteration,
Neighbour<Request,Enrollment> neighbour)
Called when
ParallelSolver failed to assign the given neighbour |
boolean |
neighbourSelected(Assignment<Request,Enrollment> assignment,
long iteration,
Neighbour<Request,Enrollment> neighbour)
A neighbour was selected
|
protected Student |
nextStudent() |
Neighbour<Request,Enrollment> |
selectNeighbour(Solution<Request,Enrollment> solution)
For each student that does not have a complete schedule, try to find a
request and a student that can be moved out of an enrollment so that the
selected student can be assigned to the selected request.
|
boolean |
valueSelected(Assignment<Request,Enrollment> assignment,
long iteration,
Request variable,
Enrollment value)
A value was selected
|
boolean |
variableSelected(Assignment<Request,Enrollment> assignment,
long iteration,
Request variable)
A variable was selected
|
public static boolean sDebug
protected StudentOrder iOrder
protected long iNbrIterations
protected long iTotalTime
protected long iNbrTimeoutReached
protected long iNbrNoSolution
public SwapStudentSelection(DataProperties properties)
properties
- configurationpublic void init(Solver<Request,Enrollment> solver)
init
in interface NeighbourSelection<Request,Enrollment>
solver
- current solverprotected Student nextStudent()
public void addStudent(Student student)
public Neighbour<Request,Enrollment> selectNeighbour(Solution<Request,Enrollment> solution)
selectNeighbour
in interface NeighbourSelection<Request,Enrollment>
solution
- given solutionpublic Set<Student> getProblemStudents()
getProblemStudents
in interface ProblemStudentsProvider
public SwapStudentSelection.Selection getSelection(Assignment<Request,Enrollment> assignment, Student student)
assignment
- current assignmentstudent
- selected studentpublic static Enrollment bestSwap(Assignment<Request,Enrollment> assignment, Enrollment conflict, Enrollment enrl, Set<Student> problematicStudents)
assignment
- current assignmentconflict
- conflicting enrollmentenrl
- enrollment that is visited (to be assigned to the given
student)problematicStudents
- the current set of problematic studentspublic void getInfo(Assignment<Request,Enrollment> assignment, Map<String,String> info)
InfoProvider
getInfo
in interface InfoProvider<Request,Enrollment>
assignment
- current assignmentinfo
- info tablepublic void getInfo(Assignment<Request,Enrollment> assignment, Map<String,String> info, Collection<Request> variables)
InfoProvider
getInfo
in interface InfoProvider<Request,Enrollment>
assignment
- current assignmentinfo
- info tablevariables
- sub-problempublic boolean variableSelected(Assignment<Request,Enrollment> assignment, long iteration, Request variable)
SolverListener
variableSelected
in interface SolverListener<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationvariable
- selected variablepublic boolean valueSelected(Assignment<Request,Enrollment> assignment, long iteration, Request variable, Enrollment value)
SolverListener
valueSelected
in interface SolverListener<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationvariable
- selected variablevalue
- selected variablepublic boolean neighbourSelected(Assignment<Request,Enrollment> assignment, long iteration, Neighbour<Request,Enrollment> neighbour)
SolverListener
neighbourSelected
in interface SolverListener<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationneighbour
- neighbourpublic void neighbourFailed(Assignment<Request,Enrollment> assignment, long iteration, Neighbour<Request,Enrollment> neighbour)
SolverListener
ParallelSolver
failed to assign the given neighbourneighbourFailed
in interface SolverListener<Request,Enrollment>
assignment
- current assignmentiteration
- current iterationneighbour
- neighbour