|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.cpsolver.exam.heuristics.ExamSimulatedAnnealing
public class ExamSimulatedAnnealing
Simulated annealing. In each iteration, one of the following three neighbourhoods is selected first
ExamRandomMove)
ExamTimeMove)
ExamRoomMove)
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() 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.
| Constructor Summary | |
|---|---|
ExamSimulatedAnnealing(DataProperties properties)
Constructor. |
|
| Method Summary | |
|---|---|
protected boolean |
accept(Solution solution,
Neighbour neighbour)
True if the given neighboir is to be be accepted |
void |
bestCleared(Solution solution)
Called by the solution when method Solution.clearBest() is called. |
void |
bestRestored(Solution solution)
Called by the solution when method Solution.restoreBest() is called. |
void |
bestSaved(Solution solution)
Memorize the iteration when the last best solution was found. |
protected void |
cool(Solution solution)
Cool temperature |
Neighbour |
genMove(Solution solution)
Generate neighbour -- select neighbourhood randomly, select neighbour |
void |
getInfo(Solution solution,
Dictionary info)
Called by the solution when it is asked to produce info table, see Solution.getInfo(). |
void |
getInfo(Solution solution,
Dictionary info,
Vector variables)
Called by the solution when it is asked to produce info table, see Solution.getInfo(). |
protected void |
incIter(Solution solution)
Increment iteration counter, cool/reheat/restoreBest if necessary |
void |
init(Solver solver)
Initialization |
protected double |
prob(double value)
Neighbour acceptance probability |
protected void |
reheat(Solution solution)
Reheat temperature |
protected void |
restoreBest(Solution solution)
restore best ever found solution |
Neighbour |
selectNeighbour(Solution solution)
Select neighbour -- generate a move genMove(Solution) until an acceptable neighbour
is found accept(Solution, Neighbour), keep increasing iteration
incIter(Solution). |
void |
solutionUpdated(Solution solution)
Called by the solution when it is updated, see Solution.update(double). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExamSimulatedAnnealing(DataProperties properties)
properties - problem properties| Method Detail |
|---|
public void init(Solver solver)
init in interface NeighbourSelectionprotected void cool(Solution solution)
protected void reheat(Solution solution)
protected void restoreBest(Solution solution)
public Neighbour genMove(Solution solution)
protected double prob(double value)
value - absolute or relative value of the proposed change (neighbour)
protected boolean accept(Solution solution,
Neighbour neighbour)
solution - current solutionneighbour - proposed move
prob(double)protected void incIter(Solution solution)
public Neighbour selectNeighbour(Solution solution)
genMove(Solution) until an acceptable neighbour
is found accept(Solution, Neighbour), keep increasing iteration
incIter(Solution).
selectNeighbour in interface NeighbourSelectionsolution - given solution
public void bestSaved(Solution solution)
bestSaved in interface SolutionListenersolution - source solutionpublic void solutionUpdated(Solution solution)
SolutionListenerSolution.update(double).
solutionUpdated in interface SolutionListenersolution - source solution
public void getInfo(Solution solution,
Dictionary info)
SolutionListenerSolution.getInfo().
A listener can also add some its info into this table.
getInfo in interface SolutionListenersolution - source solutioninfo - produced info table
public void getInfo(Solution solution,
Dictionary info,
Vector variables)
SolutionListenerSolution.getInfo().
A listener can also add some its info into this table.
getInfo in interface SolutionListenersolution - source solutioninfo - produced info tablevariables - only variables from this set are includedpublic void bestCleared(Solution solution)
SolutionListenerSolution.clearBest() is called.
bestCleared in interface SolutionListenersolution - source solutionpublic void bestRestored(Solution solution)
SolutionListenerSolution.restoreBest() is called.
bestRestored in interface SolutionListenersolution - source solution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||