public class RandomStudentSwap extends StudentSwapGenerator implements HillClimberSelection
StudentSwapGenerator
, but making a random selection of a lecture and of a student.
The selection is only available/enabled when the solver is using a single thread
(Solver.hasSingleSolution()
is true) as student class assignments are not included in the
solution.Modifier and Type | Field and Description |
---|---|
protected boolean |
iEnabled |
protected boolean |
iHC |
Constructor and Description |
---|
RandomStudentSwap(DataProperties config) |
Modifier and Type | Method and Description |
---|---|
void |
init(Solver<Lecture,Placement> solver)
Criterion initialization
|
Neighbour<Lecture,Placement> |
selectNeighbour(Solution<Lecture,Placement> solution)
select a neighbour of a given solution
|
void |
setHcMode(boolean hcMode)
True if employed by a hill climber, e.g., worsening moves may be skipped.
|
generateSwap, selectNeighbour
public RandomStudentSwap(DataProperties config)
public void init(Solver<Lecture,Placement> solver)
NeighbourSelection
init
in interface NeighbourSelection<Lecture,Placement>
init
in class StudentSwapGenerator
solver
- current solverpublic Neighbour<Lecture,Placement> selectNeighbour(Solution<Lecture,Placement> solution)
NeighbourSelection
selectNeighbour
in interface NeighbourSelection<Lecture,Placement>
selectNeighbour
in class StudentSwapGenerator
solution
- given solutionpublic void setHcMode(boolean hcMode)
HillClimberSelection
setHcMode
in interface HillClimberSelection
hcMode
- true if used by a hill climber (worsening moves are automatically discarded)