mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
added method in algorithm.acceptor.SchrimpfAcceptance to get initial
threshold
This commit is contained in:
parent
057f128697
commit
4be6bba15e
1 changed files with 30 additions and 1 deletions
|
|
@ -87,11 +87,28 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
|
||||||
|
|
||||||
private double initialThreshold = 0.0;
|
private double initialThreshold = 0.0;
|
||||||
|
|
||||||
private final int nOfRandomWalks;
|
private int nOfRandomWalks;
|
||||||
|
|
||||||
private final int solutionMemory;
|
private final int solutionMemory;
|
||||||
|
|
||||||
|
private boolean determineInitialThreshold = true;
|
||||||
|
|
||||||
|
public SchrimpfAcceptance(int solutionMemory, double alpha){
|
||||||
|
this.alpha = alpha;
|
||||||
|
this.solutionMemory = solutionMemory;
|
||||||
|
determineInitialThreshold = false;
|
||||||
|
logger.info("initialise " + this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param solutionMemory
|
||||||
|
* @param alpha
|
||||||
|
* @param nOfWarmupIterations
|
||||||
|
* @Deprecated use <code>new SchrimpfAcceptance(solutionMemory,alpha)</code> instead. if you want to determine ini-threshold with a
|
||||||
|
* random walk and the algorithm 'randomWalk.xml' use SchrimpfInitialThresholdGenerator.class instead.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public SchrimpfAcceptance(int solutionMemory, double alpha, int nOfWarmupIterations) {
|
public SchrimpfAcceptance(int solutionMemory, double alpha, int nOfWarmupIterations) {
|
||||||
super();
|
super();
|
||||||
this.alpha = alpha;
|
this.alpha = alpha;
|
||||||
|
|
@ -134,15 +151,27 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getInitialThreshold(){
|
||||||
|
return initialThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets initial threshold.
|
||||||
|
* <p>Note that if initial threshold has been set, automatic generation of initial threshold is disabled.
|
||||||
|
*
|
||||||
* @param initialThreshold the initialThreshold to set
|
* @param initialThreshold the initialThreshold to set
|
||||||
*/
|
*/
|
||||||
public void setInitialThreshold(double initialThreshold) {
|
public void setInitialThreshold(double initialThreshold) {
|
||||||
this.initialThreshold = initialThreshold;
|
this.initialThreshold = initialThreshold;
|
||||||
|
determineInitialThreshold=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) {
|
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) {
|
||||||
|
if(!determineInitialThreshold){
|
||||||
|
logger.info("skip threshold initialization from here");
|
||||||
|
return;
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
logger.info("---------------------------------------------------------------------");
|
logger.info("---------------------------------------------------------------------");
|
||||||
logger.info("prepare schrimpfAcceptanceFunction, i.e. determine initial threshold");
|
logger.info("prepare schrimpfAcceptanceFunction, i.e. determine initial threshold");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue