@Deprecated public class ExamSimulatedAnnealing extends NeighbourSelectionWithContext<Exam,ExamPlacement,ExamSimulatedAnnealing.Context> implements SolutionListener<Exam,ExamPlacement>, LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>
ExamRandomMove
)
ExamTimeMove
)
ExamRoomMove
)
ExamSimulatedAnnealing.Context.prob(double)
. The search is guided by the
temperature, which starts at SimulatedAnnealing.InitialTemperature.
After each SimulatedAnnealing.TemperatureLength iterations, the
temperature is reduced by SimulatedAnnealing.CoolingRate. If there was
no improvement in the past SimulatedAnnealing.ReheatLengthCoef *
SimulatedAnnealing.TemperatureLength iterations, the temperature is
increased by SimulatedAnnealing.ReheatRate. If there was no
improvement in the past SimulatedAnnealing.RestoreBestLengthCoef *
SimulatedAnnealing.TemperatureLength iterations, the best ever found
solution is restored. 1.0 / (1.0 + Math.exp(value/temperature))
, otherwise it is
cumputed using simlated annealing criterion, i.e.,
(value<=0.0?1.0:Math.exp(-value/temperature))
. If
SimulatedAnnealing.RelativeAcceptance neighbour value
ExamSimpleNeighbour.value(Assignment)
is taken as the value of the selected
neighbour (difference between the new and the current solution, if the
neighbour is accepted), otherwise the value is computed as the difference
between the value of the current solution if the neighbour is accepted and
the best ever found solution. Modifier and Type | Class and Description |
---|---|
class |
ExamSimulatedAnnealing.Context
Deprecated.
|
iContextOverride
sMaxSize
Constructor and Description |
---|
ExamSimulatedAnnealing(DataProperties properties)
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Assignment<Exam,ExamPlacement> assignment,
LazyNeighbour<Exam,ExamPlacement> neighbour,
double value)
Deprecated.
Accept lazy neighbour
|
protected boolean |
accept(Solution<Exam,ExamPlacement> solution,
Neighbour<Exam,ExamPlacement> neighbour)
Deprecated.
True if the given neighboir is to be be accepted
|
void |
bestCleared(Solution<Exam,ExamPlacement> solution)
Deprecated.
Called by the solution when method
Solution.clearBest() is
called. |
void |
bestRestored(Solution<Exam,ExamPlacement> solution)
Deprecated.
Called by the solution when method
Solution.restoreBest() is
called. |
void |
bestSaved(Solution<Exam,ExamPlacement> solution)
Deprecated.
Called by the solution when method
Solution.saveBest() is called. |
ExamSimulatedAnnealing.Context |
createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)
Deprecated.
Create a new assignment context for the given assignment.
|
Neighbour<Exam,ExamPlacement> |
genMove(Solution<Exam,ExamPlacement> solution)
Deprecated.
Generate neighbour -- select neighbourhood randomly, select neighbour
|
void |
getInfo(Solution<Exam,ExamPlacement> solution,
Map<String,String> info)
Deprecated.
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)
Deprecated.
Called by the solution when it is asked to produce info table, see
Solution.getInfo() . |
void |
init(Solver<Exam,ExamPlacement> solver)
Deprecated.
Initialization
|
Neighbour<Exam,ExamPlacement> |
selectNeighbour(Solution<Exam,ExamPlacement> solution)
Deprecated.
Select neighbour -- generate a move
genMove(Solution) until an acceptable
neighbour is found
accept(Solution, Neighbour) , keep
increasing iteration ExamSimulatedAnnealing.Context.incIter(Solution) . |
void |
solutionUpdated(Solution<Exam,ExamPlacement> solution)
Deprecated.
Called by the solution when it is updated, see
Solution.update(double) . |
getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReference
public ExamSimulatedAnnealing(DataProperties properties)
properties
- problem propertiespublic void init(Solver<Exam,ExamPlacement> solver)
init
in interface NeighbourSelection<Exam,ExamPlacement>
init
in class NeighbourSelectionWithContext<Exam,ExamPlacement,ExamSimulatedAnnealing.Context>
solver
- current solverpublic Neighbour<Exam,ExamPlacement> genMove(Solution<Exam,ExamPlacement> solution)
solution
- current solutoonprotected boolean accept(Solution<Exam,ExamPlacement> solution, Neighbour<Exam,ExamPlacement> neighbour)
solution
- current solutionneighbour
- proposed moveExamSimulatedAnnealing.Context.prob(double)
public boolean accept(Assignment<Exam,ExamPlacement> assignment, LazyNeighbour<Exam,ExamPlacement> neighbour, double value)
accept
in interface LazyNeighbour.LazyNeighbourAcceptanceCriterion<Exam,ExamPlacement>
assignment
- current assignmentneighbour
- neighbour that was assignedvalue
- change in overall solution valuepublic Neighbour<Exam,ExamPlacement> selectNeighbour(Solution<Exam,ExamPlacement> solution)
genMove(Solution)
until an acceptable
neighbour is found
accept(Solution, Neighbour)
, keep
increasing iteration ExamSimulatedAnnealing.Context.incIter(Solution)
.selectNeighbour
in interface NeighbourSelection<Exam,ExamPlacement>
solution
- given solutionpublic void bestSaved(Solution<Exam,ExamPlacement> solution)
SolutionListener
Solution.saveBest()
is called.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 ExamSimulatedAnnealing.Context createAssignmentContext(Assignment<Exam,ExamPlacement> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Exam,ExamPlacement,ExamSimulatedAnnealing.Context>
assignment
- an assignment for which there needs to be an assignment context