public class ExamHillClimbing extends Object implements NeighbourSelection<Exam,ExamPlacement>, SolutionListener<Exam,ExamPlacement>, LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>
ExamRandomMove
)
ExamTimeMove
)
ExamRoomMove
)
ExamSimpleNeighbour.value()
is below or equal to zero. The search is
stopped after a given amount of idle iterations ( can be defined by problem
property HillClimber.MaxIdle). Constructor and Description |
---|
ExamHillClimbing(DataProperties properties)
Constructor
|
ExamHillClimbing(DataProperties properties,
String name)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(LazyNeighbour<Exam,ExamPlacement> neighbour,
double value)
Accept lazy neighbour
|
void |
bestCleared(Solution<Exam,ExamPlacement> solution)
Called by the solution when method
Solution.clearBest() is
called. |
void |
bestRestored(Solution<Exam,ExamPlacement> solution)
Called by the solution when method
Solution.restoreBest() is
called. |
void |
bestSaved(Solution<Exam,ExamPlacement> solution)
Memorize the iteration when the last best solution was found.
|
void |
getInfo(Solution<Exam,ExamPlacement> solution,
Map<String,String> info)
Called by the solution when it is asked to produce info table, see
Solution.getInfo() . |
void |
getInfo(Solution<Exam,ExamPlacement> solution,
Map<String,String> info,
Collection<Exam> variables)
Called by the solution when it is asked to produce info table, see
Solution.getInfo() . |
void |
init(Solver<Exam,ExamPlacement> solver)
Initialization
|
Neighbour<Exam,ExamPlacement> |
selectNeighbour(Solution<Exam,ExamPlacement> solution)
Select one of the given neighbourhoods randomly, select neighbour, return
it if its value is below or equal to zero (continue with the next
selection otherwise).
|
void |
solutionUpdated(Solution<Exam,ExamPlacement> solution)
Called by the solution when it is updated, see
Solution.update(double) . |
public ExamHillClimbing(DataProperties properties)
properties
- problem properties (use HillClimber.MaxIdle to set maximum
number of idle iterations)public ExamHillClimbing(DataProperties properties, String name)
properties
- problem properties (use HillClimber.MaxIdle to set maximum
number of idle iterations)public void init(Solver<Exam,ExamPlacement> solver)
init
in interface NeighbourSelection<Exam,ExamPlacement>
public Neighbour<Exam,ExamPlacement> selectNeighbour(Solution<Exam,ExamPlacement> solution)
selectNeighbour
in interface NeighbourSelection<Exam,ExamPlacement>
solution
- given solutionpublic void bestSaved(Solution<Exam,ExamPlacement> solution)
bestSaved
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutionpublic void solutionUpdated(Solution<Exam,ExamPlacement> solution)
SolutionListener
Solution.update(double)
.solutionUpdated
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutionpublic void getInfo(Solution<Exam,ExamPlacement> solution, Map<String,String> info)
SolutionListener
Solution.getInfo()
. A listener can also add some its info into
this table.getInfo
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutioninfo
- produced info tablepublic void getInfo(Solution<Exam,ExamPlacement> solution, Map<String,String> info, Collection<Exam> variables)
SolutionListener
Solution.getInfo()
. A listener can also add some its info into
this table.getInfo
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutioninfo
- produced info tablevariables
- only variables from this set are includedpublic void bestCleared(Solution<Exam,ExamPlacement> solution)
SolutionListener
Solution.clearBest()
is
called.bestCleared
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutionpublic void bestRestored(Solution<Exam,ExamPlacement> solution)
SolutionListener
Solution.restoreBest()
is
called.bestRestored
in interface SolutionListener<Exam,ExamPlacement>
solution
- source solutionpublic boolean accept(LazyNeighbour<Exam,ExamPlacement> neighbour, double value)
accept
in interface LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>
neighbour
- neighbour that was assignedvalue
- change in overall solution value