Class SchrimpfAcceptance
- All Implemented Interfaces:
SolutionAcceptor,AlgorithmStartsListener,IterationStartsListener,VehicleRoutingAlgorithmListener
The idea can be described as follows: Most problems do not only have one unique minimum (maximum) but
a number of local minima (maxima). To avoid to get stuck in a local minimum at the beginning of a search
this threshold-acceptance function accepts also worse solution at the beginning (in contrary to a greedy
approach which only accepts better solutions), and converges to a greedy approach at the end.
The difficulty is to define (i) an appropriate initial threshold and (ii) a corresponding function describing
how the threshold converges to zero, i.e. the greedy threshold.
ad i) The initial threshold is determined by a random walk through the search space. The random walk currently runs with the following algorithm: src/main/resources/randomWalk.xml. It runs as long as it is specified in nuOfWarmupIterations. In the first iteration or walk respectively the algorithm generates a solution. This solution in turn is the basis of the next walk yielding to another solution value ... and so on. Each solution value is memorized since the initial threshold is essentially a function of the standard deviation of these solution values. To be more precise: initial threshold = stddev(solution values) / 2.
ad ii) The threshold of iteration i is determined as follows: threshold(i) = initialThreshold * Math.exp(-Math.log(2) * (i / nuOfTotalIterations) / alpha) To get a better understanding of the threshold-function go to Wolfram Alpha and plot the following line (just copy and paste it into Wolfram's console: www.wolframalpha.com):
100. * exp(-log(2)* (x/1000) / 0.1) (x from 0 to 1000) (y from 0 to 100)
with
initialThreshold = 100
nuOfTotalIter = 1000
alpha = 0.1
x corresponds to i iterations and
y to the threshold(i)
Gerhard Schrimpf, Johannes Schneider, Hermann Stamm- Wilbrandt, and Gunter Dueck (2000). Record breaking optimization results using the ruin and recreate principle. Journal of Computational Physics, 159(2):139 – 171, 2000. ISSN 0021-9991. doi: 10.1006/jcph.1999. 6413. URL http://www.sciencedirect.com/science/article/ pii/S0021999199964136
- Author:
- schroeder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSolution(VehicleRoutingProblemSolution solution, VehicleRoutingProblemSolution newSolution) booleanacceptSolution(Collection<VehicleRoutingProblemSolution> solutions, VehicleRoutingProblemSolution newSolution) Accepts solution or not, and returns true if a new solution has been accepted.doubleReturns the current acceptance threshold.doublevoidvoidinformAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) voidinformIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) voidsetInitialThreshold(double initialThreshold) Sets initial threshold.voidsetMaxIterations(int maxIteration) toString()
-
Constructor Details
-
SchrimpfAcceptance
public SchrimpfAcceptance(int solutionMemory, double alpha)
-
-
Method Details
-
acceptSolution
public boolean acceptSolution(Collection<VehicleRoutingProblemSolution> solutions, VehicleRoutingProblemSolution newSolution) Description copied from interface:SolutionAcceptorAccepts solution or not, and returns true if a new solution has been accepted.If the solution is accepted, it is added to solutions, i.e. the solutions-collections is modified.
- Specified by:
acceptSolutionin interfaceSolutionAcceptor- Parameters:
solutions- collection of existing solutionsnewSolution- new solution to be evaluated- Returns:
- true if solution accepted
-
acceptSolution
public boolean acceptSolution(VehicleRoutingProblemSolution solution, VehicleRoutingProblemSolution newSolution) -
toString
-
getCurrentThreshold
public double getCurrentThreshold()Description copied from interface:SolutionAcceptorReturns the current acceptance threshold.For threshold-based acceptors like Schrimpf acceptance, this returns the current threshold value. For greedy acceptors, this returns 0.
- Specified by:
getCurrentThresholdin interfaceSolutionAcceptor- Returns:
- the current threshold value
-
getInitialThreshold
public double getInitialThreshold() -
setInitialThreshold
public void setInitialThreshold(double initialThreshold) Sets initial threshold.Note that if initial threshold has been set, automatic generation of initial threshold is disabled.
- Parameters:
initialThreshold- the initialThreshold to set
-
setMaxIterations
public void setMaxIterations(int maxIteration) -
incIteration
public void incIteration() -
informAlgorithmStarts
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) - Specified by:
informAlgorithmStartsin interfaceAlgorithmStartsListener
-
informIterationStarts
public void informIterationStarts(int i, VehicleRoutingProblem problem, Collection<VehicleRoutingProblemSolution> solutions) - Specified by:
informIterationStartsin interfaceIterationStartsListener
-