V
- VariableT
- Valuepublic class SimulatedAnnealing<V extends Variable<V,T>,T extends Value<V,T>> extends NeighbourSearch<V,T>
SimulatedAnnealing.SimulatedAnnealingContext.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
Neighbour.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. NeighbourSelection
. By default,
each neighbour selection is selected with the same probability (each has 1 point in
a roulette wheel selection). It can be changed by adding @n at the end
of the name of the class, for example:
SimulatedAnnealing.Neighbours=org.cpsolver.ifs.algorithms.neighbourhoods.RandomMove;org.cpsolver.ifs.algorithms.neighbourhoods.RandomSwapMove@0.1
Selector RandomSwapMove is 10× less probable to be selected than other selectors.
When SimulatedAnnealing.Random is true, all selectors are selected with the same probability, ignoring these weights.
NeighbourSelector.update(Assignment, Neighbour, long)
is called
after each iteration (on the selector that was used) and roulette wheel selection
that is using NeighbourSelector.getPoints()
is used to pick a selector in each iteration.
See NeighbourSelector
for more details.
Modifier and Type | Class and Description |
---|---|
class |
SimulatedAnnealing.SimulatedAnnealingContext |
NeighbourSearch.NeighbourSearchContext
iDF2, iPhase
iContextOverride
sMaxSize
Constructor and Description |
---|
SimulatedAnnealing(DataProperties properties)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
NeighbourSearch.NeighbourSearchContext |
createAssignmentContext(Assignment<V,T> assignment)
Create a new assignment context for the given assignment.
|
String |
getParameterBaseName()
Parameter base name.
|
accept, accept, addNeighbourSelection, bestCleared, bestRestored, bestSaved, generateMove, getInfo, getInfo, getNeighbours, info, init, isMaster, logNeibourStatus, nextNeighbourSelection, selectNeighbour, setHCMode, setProgress, setProgressPhase, solutionUpdated
getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReference
public SimulatedAnnealing(DataProperties properties)
NeighbourSelection
NeighbourSelection
NeighbourSelector.getPoints()
weights (roulette wheel selection)
properties
- problem propertiespublic String getParameterBaseName()
NeighbourSearch
getParameterBaseName
in class NeighbourSearch<V extends Variable<V,T>,T extends Value<V,T>>
public NeighbourSearch.NeighbourSearchContext createAssignmentContext(Assignment<V,T> assignment)
HasAssignmentContext
assignment
- an assignment for which there needs to be an assignment context