From 4be6bba15e8b4f9b609306ed90bdf0c4f1d314ab Mon Sep 17 00:00:00 2001
From: oblonski <4sschroeder@gmail.com>
Date: Sat, 10 May 2014 16:35:13 +0200
Subject: [PATCH] added method in algorithm.acceptor.SchrimpfAcceptance to get
initial threshold
---
.../acceptor/SchrimpfAcceptance.java | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java b/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java
index ff567547..924c5833 100644
--- a/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java
+++ b/jsprit-core/src/main/java/jsprit/core/algorithm/acceptor/SchrimpfAcceptance.java
@@ -87,11 +87,28 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
private double initialThreshold = 0.0;
- private final int nOfRandomWalks;
+ private int nOfRandomWalks;
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 new SchrimpfAcceptance(solutionMemory,alpha) 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) {
super();
this.alpha = alpha;
@@ -134,15 +151,27 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
}
+ public double getInitialThreshold(){
+ return initialThreshold;
+ }
+
/**
+ * Sets initial threshold.
+ *
Note that if initial threshold has been set, automatic generation of initial threshold is disabled.
+ *
* @param initialThreshold the initialThreshold to set
*/
public void setInitialThreshold(double initialThreshold) {
this.initialThreshold = initialThreshold;
+ determineInitialThreshold=false;
}
@Override
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection